From patchwork Tue Jun 20 00:03:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9798257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F9BB600C5 for ; Tue, 20 Jun 2017 00:14:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12DD823E64 for ; Tue, 20 Jun 2017 00:14:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 064EB26E46; Tue, 20 Jun 2017 00:14:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A96DA23E64 for ; Tue, 20 Jun 2017 00:14:47 +0000 (UTC) Received: from localhost ([::1]:44905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN6og-0004EH-Qs for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Jun 2017 20:14:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN6ec-0003WU-Gb for qemu-devel@nongnu.org; Mon, 19 Jun 2017 20:04:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dN6eb-0001xF-I1 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 20:04:22 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:35683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dN6eb-0001wa-Ch for qemu-devel@nongnu.org; Mon, 19 Jun 2017 20:04:21 -0400 Received: by mail-pf0-x243.google.com with SMTP id s66so19892196pfs.2 for ; Mon, 19 Jun 2017 17:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4waIJ8ZjYoTzgMdlDdPZMgUKNEErhrHKVjmRQOIMTCI=; b=TqqBojMyFcXrw3QV2KyH8cyr/TF3tHucxODfB/dYTItN97075FdgUUm+W9DIqUXzSv 2A75N3eQyhBQ5GxqsnsiZoV824dTUb7jwBM6nb9j7tT1VC2Ug4PRX8THPJXJEGamMZmN n7Z8TMCbH5e+7YsJvyOziWM+U5eLX+S7tPbaCHSAJcgnKppvyssROe1bRi3RZ6nmfRZI SNpRr24NorvtmSzqtLf2NVZmgtwJkWcnX1ueZOvnWj4hfVQDWZhiiQXGPNpaf9QmkJ7C mn2f5dCVPHevWeuEVgBlT+pvxRZUB1gHSquAuB8xv6S1UPnvCs4Bv/ekfCM5ki/pn1f3 bGLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4waIJ8ZjYoTzgMdlDdPZMgUKNEErhrHKVjmRQOIMTCI=; b=BCoLdSXKCpCVsKU/gqHEVcPHNCv2PsvW1m82Wql2TfwPw/4PZMoIaLCxogGEVbRXwg ZVBETOkG3S94JlgAxAAzA02Ub4pKKIiEM2oR6PggFRwJ8YTCq+mQEBnSnH2urwb3eenG UmRI5qQyYdjQ1L8hOOl2HrTCOIZp2yGxi3AGFgdlcApTVswd3jICWm7QzDPQbjbz432s MprGkCr2cpFYHyKhu2OurA2CCySC3bqcgBU2L2j869zfoUbi9F+Zq9pOUKfnZSxTJwk+ gQ0uVeetL1zsMaCn7JOB7yETYLgQCu9X4MnQd2CELxxNm6ziatXKZb/E1E6kpe6ab1EC jSOw== X-Gm-Message-State: AKS2vOw2SkZtl+3wRwYCTIBUmA+nzNMpJ8cNNk573lViDuEt75qXDs0j W1bvDXd2txBjXjuAlA0= X-Received: by 10.98.107.137 with SMTP id g131mr28248632pfc.27.1497917060322; Mon, 19 Jun 2017 17:04:20 -0700 (PDT) Received: from bigtime.twiddle.net (97-113-165-157.tukw.qwest.net. [97.113.165.157]) by smtp.gmail.com with ESMTPSA id o8sm23064937pgn.52.2017.06.19.17.04.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 17:04:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Jun 2017 17:03:59 -0700 Message-Id: <20170620000405.3391-13-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170620000405.3391-1-rth@twiddle.net> References: <20170620000405.3391-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v3 12/18] target/s390x: Finish implementing ETF2-ENH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Missed the proper alignment in TRTO/TRTT, and ignoring the M3 field for all TRXX insns without ETF2-ENH. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- target/s390x/mem_helper.c | 11 ++++++++++- target/s390x/translate.c | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4a7d770..4376c72 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1265,13 +1265,22 @@ uint32_t HELPER(trXX)(CPUS390XState *env, uint32_t r1, uint32_t r2, uintptr_t ra = GETPC(); int dsize = (sizes & 1) ? 1 : 2; int ssize = (sizes & 2) ? 1 : 2; - uint64_t tbl = get_address(env, 1) & ~7; + uint64_t tbl = get_address(env, 1); uint64_t dst = get_address(env, r1); uint64_t len = get_length(env, r1 + 1); uint64_t src = get_address(env, r2); uint32_t cc = 3; int i; + /* The lower address bits of TBL are ignored. For TROO, TROT, it's + the low 3 bits (double-word aligned). For TRTO, TRTT, it's either + the low 12 bits (4K, without ETF2-ENH) or 3 bits (with ETF2-ENH). */ + if (ssize == 2 && !s390_has_feat(S390_FEAT_ETF2_ENH)) { + tbl &= -4096; + } else { + tbl &= -8; + } + check_alignment(env, len, ssize, ra); /* Lest we fail to service interrupts in a timely manner, */ diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 3ffb304..630eacb 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -4363,8 +4363,9 @@ static ExitStatus op_trXX(DisasContext *s, DisasOps *o) TCGv_i32 tst = tcg_temp_new_i32(); int m3 = get_field(s->fields, m3); - /* XXX: the C bit in M3 should be considered as 0 when the - ETF2-enhancement facility is not installed. */ + if (!s390_has_feat(S390_FEAT_ETF2_ENH)) { + m3 = 0; + } if (m3 & 1) { tcg_gen_movi_i32(tst, -1); } else {