From nobody Sat Feb 7 06:20:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610383198; cv=none; d=zohomail.com; s=zohoarc; b=kcVslIakvuMMmZLJ69ZGCA0IuvI+jk+M2V17UVISuGQHl5Bor3LnMmNj8Gh+fQ9Mdn33lhZRm+4n77TgasemPIdN45KXLrMcsSEbt0XJvus3unfWjbRwRurYtRtDgM5Okh+DUIzoEhbFy4dU/Tl5k6pCZkDzZu7LdSWCuzaBzSY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610383198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dcL3JiDdrgheCaJxJGKj3OEf8MIV5KlgDXI9W+pBN0o=; b=GsTT+lBWu8fH2N3hsiac9aUg8mn31rd/2LvYQrcqCRiqDq9aBvA8uiD7iZC7xiBo6OGWIEgrFEOPcUzerWbZrXVqWHeKg4E4sMsWjMvvhaaECjp1pPd2churNC+ink6BdqaXfHlR26Vh9M9/ck2x+RvQqDkGdxzgi/6KFXpCvN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610383198433940.6582855980373; Mon, 11 Jan 2021 08:39:58 -0800 (PST) Received: from localhost ([::1]:57354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0ET-0006ck-FI for importer@patchew.org; Mon, 11 Jan 2021 11:39:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0Db-0005Jf-8q for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:38:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kz0DZ-0000Ws-It for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:38:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-ykChhc8YOYisUHP7Pl6Ziw-1; Mon, 11 Jan 2021 11:38:55 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E55DEB8100; Mon, 11 Jan 2021 16:38:53 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-103.ams2.redhat.com [10.36.115.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 371DF1971B; Mon, 11 Jan 2021 16:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610383136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dcL3JiDdrgheCaJxJGKj3OEf8MIV5KlgDXI9W+pBN0o=; b=iqoSw09hT6nDHRfESapTnVpSC3cQPA7Y1f3agzwzpeDvrWBl4KgnoB+Lk8Dt9fZgqVFQtS 635TGCbsdox2xhdYFwd/JWK4fsyrohbsjJ2Mpk6I9DOpkXlM+2w5u7nG2hxMyXrI17L6Oz Ux7VLmVpcdvtpn9bTkxdjyZhySlAqDs= X-MC-Unique: ykChhc8YOYisUHP7Pl6Ziw-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v3 1/5] s390x/tcg: Fix ALGSI Date: Mon, 11 Jan 2021 17:38:41 +0100 Message-Id: <20210111163845.18148-2-david@redhat.com> In-Reply-To: <20210111163845.18148-1-david@redhat.com> References: <20210111163845.18148-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Richard Henderson , Cornelia Huck , Nick Desaulniers , qemu-s390x@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Looks like something went wrong whiel touching that line. Instead of "r1" we need a new temporary. Also, we have to pass MO_TEQ, to indicate that we are working with 64-bit values. Let's revert these changes. Fixes: ff26d287bddc ("target/s390x: Improve cc computation for ADD LOGICAL") Reviewed-by: Richard Henderson Tested-by: Nick Desaulniers Tested-by: Guenter Roeck Signed-off-by: David Hildenbrand --- target/s390x/insn-data.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 26badb663a..eac5136ee5 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -76,7 +76,7 @@ /* ADD LOGICAL WITH SIGNED IMMEDIATE */ D(0xeb6e, ALSI, SIY, GIE, la1, i2_32u, new, 0, asi, addu32, MO_TE= UL) C(0xecda, ALHSIK, RIE_d, DO, r3_32u, i2_32u, new, r1_32, add, addu32) - C(0xeb7e, ALGSI, SIY, GIE, la1, i2, r1, 0, asiu64, addu64) + D(0xeb7e, ALGSI, SIY, GIE, la1, i2, new, 0, asiu64, addu64, MO_TEQ) C(0xecdb, ALGHSIK, RIE_d, DO, r3, i2, r1, 0, addu64, addu64) /* ADD LOGICAL WITH SIGNED IMMEDIATE HIGH */ C(0xcc0a, ALSIH, RIL_a, HW, r1_sr32, i2_32u, new, r1_32h, add, addu= 32) --=20 2.29.2 From nobody Sat Feb 7 06:20:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610383197; cv=none; d=zohomail.com; s=zohoarc; b=BhBiIRnLCIR0FBboaWjbJdrow/QFjJRXfEOGGjE1sm0BwrTpytfmsfOUmZFr9mw9BP8B6BBNzJhOOfo5kGFFZ66IYZry/duD7gCzs/ljsAnOkFJNlNPpXQnX2XC3WgoOTG29GoreY7slyKvePXZN2tsnxTZLBkiOguM4/8uSBLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610383197; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SM/HiraRjjnuaXCMYVbHLIrF5l/zwOvMei/dhMnVQLA=; b=PxOSyczPo19TtVp+/2mGsYofdB7Y2isH67u9401+MhNA0i3nGaiM1ZvSExfqu+4AE5YjD/JixKfLbGV9FXLdKCkNunPoPtOigjqHKQ0V6Bz2p6JI++ooLAAU+Lnl8X5EmlTs/hRJ/GMu/gyWKuhBFbft8YSL/prrNcIysOxG2is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610383197838698.2998930221207; Mon, 11 Jan 2021 08:39:57 -0800 (PST) Received: from localhost ([::1]:57520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0EV-0006gu-Nd for importer@patchew.org; Mon, 11 Jan 2021 11:39:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dd-0005Ns-W0 for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dc-0000Xc-7T for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:01 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-81-OpcvpUEwOpCDBykrHkxGvA-1; Mon, 11 Jan 2021 11:38:58 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45BE1803622; Mon, 11 Jan 2021 16:38:56 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-103.ams2.redhat.com [10.36.115.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42CDC17F6E; Mon, 11 Jan 2021 16:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610383139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SM/HiraRjjnuaXCMYVbHLIrF5l/zwOvMei/dhMnVQLA=; b=TXfvUFxmC4Rqc/CN0I+hjFO6J/x+t9y7BJRGbpnmzc3DmCnLe8OMPKybgOcSKQO2rWu/zE DiAZk6LG+IPn3FNpwGlgLyxJ7CwLc1dQ+j1hXytfeNWEwH+G32qUPKKgoSiOcXAFPxa6g6 Ks0eFSAC69Y4VGzGi0a7fP1hrKgb+pE= X-MC-Unique: OpcvpUEwOpCDBykrHkxGvA-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] s390x/tcg: Fix RISBHG Date: Mon, 11 Jan 2021 17:38:42 +0100 Message-Id: <20210111163845.18148-3-david@redhat.com> In-Reply-To: <20210111163845.18148-1-david@redhat.com> References: <20210111163845.18148-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Richard Henderson , Cornelia Huck , Nick Desaulniers , Christian Borntraeger , qemu-s390x@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" RISBHG is broken and currently hinders clang-11 builds of upstream kernels from booting: the kernel crashes early, while decompressing the image. [...] Kernel fault: interruption code 0005 ilc:2 Kernel random base: 0000000000000000 PSW : 0000200180000000 0000000000017a1e R:0 T:0 IO:0 EX:0 Key:0 M:0 W:0 P:0 AS:0 CC:2 PM:0 RI:0 EA:3 GPRS: 0000000000000001 0000000c00000000 00000003fffffff4 00000000fffffff0 0000000000000000 00000000fffffff4 000000000000000c 00000000fffffff0 00000000fffffffc 0000000000000000 00000000fffffff8 00000000008e25a8 0000000000000009 0000000000000002 0000000000000008 000000000000bce0 One example of a buggy instruction is: 17dde: ec 1e 00 9f 20 5d risbhg %r1,%r14,0,159,32 With %r14 =3D 0x9 and %r1 =3D 0x7 should result in %r1 =3D 0x900000007, how= ever, results in %r1 =3D 0. Let's interpret values of i3/i4 as documented in the PoP and make computation of "mask" only based on i3 and i4 and use "pmask" only at the very end to make sure wrapping is only applied to the high/low doubleword. With this patch, I can successfully boot a v5.11-rc2 kernel built with clang-11, and gcc builds keep on working. Fixes: 2d6a869833d9 ("target-s390: Implement RISBG") Reported-by: Nick Desaulniers Reviewed-by: Richard Henderson Tested-by: Guenter Roeck Tested-by: Nick Desaulniers Cc: Guenter Roeck Cc: Christian Borntraeger Signed-off-by: David Hildenbrand --- target/s390x/translate.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 3d5c0d6106..39e33eeb67 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3815,22 +3815,23 @@ static DisasJumpType op_risbg(DisasContext *s, Disa= sOps *o) pmask =3D 0xffffffff00000000ull; break; case 0x51: /* risblg */ - i3 &=3D 31; - i4 &=3D 31; + i3 =3D (i3 & 31) + 32; + i4 =3D (i4 & 31) + 32; pmask =3D 0x00000000ffffffffull; break; default: g_assert_not_reached(); } =20 - /* MASK is the set of bits to be inserted from R2. - Take care for I3/I4 wraparound. */ - mask =3D pmask >> i3; + /* MASK is the set of bits to be inserted from R2. */ if (i3 <=3D i4) { - mask ^=3D pmask >> i4 >> 1; + /* [0...i3---i4...63] */ + mask =3D (-1ull >> i3) & (-1ull << (63 - i4)); } else { - mask |=3D ~(pmask >> i4 >> 1); + /* [0---i4...i3---63] */ + mask =3D (-1ull >> i3) | (-1ull << (63 - i4)); } + /* For RISBLG/RISBHG, the wrapping is limited to the high/low doublewo= rd. */ mask &=3D pmask; =20 /* IMASK is the set of bits to be kept from R1. In the case of the hi= gh/low @@ -3843,9 +3844,6 @@ static DisasJumpType op_risbg(DisasContext *s, DisasO= ps *o) len =3D i4 - i3 + 1; pos =3D 63 - i4; rot =3D i5 & 63; - if (s->fields.op2 =3D=3D 0x5d) { - pos +=3D 32; - } =20 /* In some cases we can implement this with extract. */ if (imask =3D=3D 0 && pos =3D=3D 0 && len > 0 && len <=3D rot) { --=20 2.29.2 From nobody Sat Feb 7 06:20:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610383325; cv=none; d=zohomail.com; s=zohoarc; b=glMsw9bofSTPcoQZCRV83xyw8Oa9WZMWmoMpVUTfHiSeoSpQAwJmwkFwT/8+2PQ2ZMdS14MwaMoFgqvWV8C35FDAoOXnjkzEp9Mh5DHodIpAskumWVRKKwXXSvjD27gUCUCe4OUl+GtBnYTJ2hR5hwpkcyJB4OReN6Kk7UOHSCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610383325; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ug6VeOhu1tQ4Kdbb2mf2+tuNKGgEI0pMs9tZg89YZ0w=; b=gTNIx2mCHbzsFGnwBTglJ2b8wkLE7/TjMGUBP4ICKB8ZYgtUW76qhgCwc6TK+RfwndWLHZAmCNL27J1He18tTxEcf2No59K+sm2qAJaYKTr/LyHxC1lbLow0vqPE+fTGKmhdRUJxMuU9t4BzwfdiXpvVrKlmS9fXkWffnswyQV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610383325174755.6362000209854; Mon, 11 Jan 2021 08:42:05 -0800 (PST) Received: from localhost ([::1]:34964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0Ga-0000rH-3A for importer@patchew.org; Mon, 11 Jan 2021 11:42:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dn-0005jJ-Cg for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dl-0000ZM-99 for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-rBshehE6PMq1wrkJa3XGfg-1; Mon, 11 Jan 2021 11:39:02 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5ECEFB8101; Mon, 11 Jan 2021 16:39:01 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-103.ams2.redhat.com [10.36.115.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7509E1971A; Mon, 11 Jan 2021 16:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610383148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ug6VeOhu1tQ4Kdbb2mf2+tuNKGgEI0pMs9tZg89YZ0w=; b=h7jf0bClOIKGKP0FRzPr6o/vd4lyvaDTQ0ZOMtTpcajRUIivSiGymJJnvetBEH2Zg+89xO LoHXVA/crHFQqUmEQ04ObITVOfyNzCDT09D+veI8g8EiR+jqKSFBV0PLoUo+2eN00QtYjo lwm2iJxj/GoN7p3RALuTA+E2Sqn4rcM= X-MC-Unique: rBshehE6PMq1wrkJa3XGfg-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] s390x/tcg: Don't ignore content in r0 when not specified via "b" or "x" Date: Mon, 11 Jan 2021 17:38:43 +0100 Message-Id: <20210111163845.18148-4-david@redhat.com> In-Reply-To: <20210111163845.18148-1-david@redhat.com> References: <20210111163845.18148-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Richard Henderson , Heiko Carstens , Cornelia Huck , Nick Desaulniers , Christian Borntraeger , qemu-s390x@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Using get_address() with register identifiers comming from an "r" field is wrong: if the "r" field designates "r0", we don't read the content and instead assume 0 - which should only be applied when the register was specified via "b" or "x". PoP 5-11 "Operand-Address Generation": "A zero in any of the B1, B2, X2, B3, or B4 fields indicates the absence of the corresponding address component. For the absent component, a zero is used in forming the intermediate sum, regardless of the contents of general register 0. A displacement of zero has no special significance." This BUG became visible for CSPG as generated by LLVM-12 in the upstream Linux kernel (v5.11-rc2), used while creating the linear mapping in vmem_map_init(): Trying to store to address 0 results in a Low Address Protection exception. Debugging this was more complicated than it could have been: The program interrupt handler in the kernel will try to crash the kernel: doing so, it will enable DAT. As the linear mapping is not created yet (asce=3D0), we run into an addressing exception while tring to walk non-existant DAT tables, resulting in a program exception loop. This allows for booting upstream Linux kernels compiled by clang-12. Most of these cases seem to be broken forever. Reported-by: Nick Desaulniers Reviewed-by: Richard Henderson Tested-by: Nick Desaulniers Tested-by: Guenter Roeck Cc: Guenter Roeck Cc: Christian Borntraeger Cc: Heiko Carstens Signed-off-by: David Hildenbrand --- target/s390x/insn-data.def | 8 ++++---- target/s390x/translate.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index eac5136ee5..e5b6efabf3 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -1290,8 +1290,8 @@ F(0xe313, LRAY, RXY_a, LD, 0, a2, r1, 0, lra, 0, IF_PRIV) F(0xe303, LRAG, RXY_a, Z, 0, a2, r1, 0, lra, 0, IF_PRIV) /* LOAD USING REAL ADDRESS */ - E(0xb24b, LURA, RRE, Z, 0, 0, new, r1_32, lura, 0, MO_TEUL, IF_= PRIV) - E(0xb905, LURAG, RRE, Z, 0, 0, r1, 0, lura, 0, MO_TEQ, IF_PRIV) + E(0xb24b, LURA, RRE, Z, 0, ra2, new, r1_32, lura, 0, MO_TEUL, I= F_PRIV) + E(0xb905, LURAG, RRE, Z, 0, ra2, r1, 0, lura, 0, MO_TEQ, IF_PRIV) /* MOVE TO PRIMARY */ F(0xda00, MVCP, SS_d, Z, la1, a2, 0, 0, mvcp, 0, IF_PRIV) /* MOVE TO SECONDARY */ @@ -1344,8 +1344,8 @@ /* STORE THEN OR SYSTEM MASK */ F(0xad00, STOSM, SI, Z, la1, 0, 0, 0, stnosm, 0, IF_PRIV) /* STORE USING REAL ADDRESS */ - E(0xb246, STURA, RRE, Z, r1_o, 0, 0, 0, stura, 0, MO_TEUL, IF_PR= IV) - E(0xb925, STURG, RRE, Z, r1_o, 0, 0, 0, stura, 0, MO_TEQ, IF_PRI= V) + E(0xb246, STURA, RRE, Z, r1_o, ra2, 0, 0, stura, 0, MO_TEUL, IF_= PRIV) + E(0xb925, STURG, RRE, Z, r1_o, ra2, 0, 0, stura, 0, MO_TEQ, IF_P= RIV) /* TEST BLOCK */ F(0xb22c, TB, RRE, Z, 0, r2_o, 0, 0, testblock, 0, IF_PRIV) /* TEST PROTECTION */ diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 39e33eeb67..61dd0341e4 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3285,8 +3285,7 @@ static DisasJumpType op_lpq(DisasContext *s, DisasOps= *o) #ifndef CONFIG_USER_ONLY static DisasJumpType op_lura(DisasContext *s, DisasOps *o) { - o->addr1 =3D get_address(s, 0, get_field(s, r2), 0); - tcg_gen_qemu_ld_tl(o->out, o->addr1, MMU_REAL_IDX, s->insn->data); + tcg_gen_qemu_ld_tl(o->out, o->in2, MMU_REAL_IDX, s->insn->data); return DISAS_NEXT; } #endif @@ -4234,7 +4233,8 @@ static DisasJumpType op_ectg(DisasContext *s, DisasOp= s *o) tcg_gen_addi_i64(o->in1, regs[b1], d1); o->in2 =3D tcg_temp_new_i64(); tcg_gen_addi_i64(o->in2, regs[b2], d2); - o->addr1 =3D get_address(s, 0, r3, 0); + o->addr1 =3D tcg_temp_new_i64(); + gen_addi_and_wrap_i64(s, o->addr1, regs[r3], 0); =20 /* load the third operand into r3 before modifying anything */ tcg_gen_qemu_ld64(regs[r3], o->addr1, get_mem_index(s)); @@ -4539,8 +4539,7 @@ static DisasJumpType op_stnosm(DisasContext *s, Disas= Ops *o) =20 static DisasJumpType op_stura(DisasContext *s, DisasOps *o) { - o->addr1 =3D get_address(s, 0, get_field(s, r2), 0); - tcg_gen_qemu_st_tl(o->in1, o->addr1, MMU_REAL_IDX, s->insn->data); + tcg_gen_qemu_st_tl(o->in1, o->in2, MMU_REAL_IDX, s->insn->data); =20 if (s->base.tb->flags & FLAG_MASK_PER) { update_psw_addr(s); @@ -5923,7 +5922,11 @@ static void in2_x2l(DisasContext *s, DisasOps *o) =20 static void in2_ra2(DisasContext *s, DisasOps *o) { - o->in2 =3D get_address(s, 0, get_field(s, r2), 0); + int r2 =3D get_field(s, r2); + + /* Note: *don't* treat !r2 as 0, use the reg value. */ + o->in2 =3D tcg_temp_new_i64(); + gen_addi_and_wrap_i64(s, o->in2, regs[r2], 0); } #define SPEC_in2_ra2 0 =20 --=20 2.29.2 From nobody Sat Feb 7 06:20:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610383417; cv=none; d=zohomail.com; s=zohoarc; b=RZ3JWK2J+Fnwzk4ZAo6vqzM5aWOZtD1m9a+pfD6/bcUxqHhM6y76VSIbaMLOlvV03DlM9oCtO1n04fkzV5+RhoWlvBO4/Zl6IfxQB1pgmSPhc1VLwllM051fj1wHkVxyZ2aY/TFdr+Zq2zhKER989e9fLG3iAYybuaZxszKpd24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610383417; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tW7i05tAjAUYUi+ApZdtCCAcOR+Q5y3i0kouOwQaj2w=; b=f501jc9ThvlMtPPwjNTumdjdbAXM23USLmIJ+T69q/AXAlYD9CVJMxmXu/3ZI1ukRd5unZsFPRSrLFXrhQN39OEJvird/S4D9/TFBQEoRQ3vI5WPQja0SI6WIN6gXhqqTkhNhGdajBdzy97Vpgckula3XzGvy8ItbAjq8QbP4YM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610383417007686.7895360072897; Mon, 11 Jan 2021 08:43:37 -0800 (PST) Received: from localhost ([::1]:39074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0I3-0002cG-SV for importer@patchew.org; Mon, 11 Jan 2021 11:43:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dm-0005gN-9C for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dk-0000Z6-Ki for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:10 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-fa80lBdINdaE1XgChgGpbg-1; Mon, 11 Jan 2021 11:39:04 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1376019251A1; Mon, 11 Jan 2021 16:39:03 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-103.ams2.redhat.com [10.36.115.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE5191971A; Mon, 11 Jan 2021 16:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610383147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tW7i05tAjAUYUi+ApZdtCCAcOR+Q5y3i0kouOwQaj2w=; b=gqoCJk/8eOlcoivGo7+RlP/eOw2UHeN+iMbIq9R0kbIBXU06xqooE5M9JNfdlwwGqH6kWV idyxwRBih9zazpw/GGXY8xx7G0AxHj0K8ZboRm+8irVKo5YDcJTwDpOnCfkkXaCA/bJ4E3 R6eXQviga63+E+nzj3sLs8zZ6SMNtCc= X-MC-Unique: fa80lBdINdaE1XgChgGpbg-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v3 4/5] tests/tcg/s390x: Fix EXRL tests Date: Mon, 11 Jan 2021 17:38:44 +0100 Message-Id: <20210111163845.18148-5-david@redhat.com> In-Reply-To: <20210111163845.18148-1-david@redhat.com> References: <20210111163845.18148-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , Thomas Huth , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The current EXRL tests crash on real machines: we must not use r0 as a base register for trt/trtr, otherwise the content gets ignored. Also, we must not use r0 for exrl, otherwise it gets ignored. Let's use the "a" constraint so we get a general purpose register !=3D r0. For op2, we can simply specify a memory operand directly via "Q" (Memory reference without index register and with short displacement). Fixes: ad8c851d2e77 ("target/s390x: add EX support for TRT and TRTR") Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- tests/tcg/s390x/exrl-trt.c | 8 ++++---- tests/tcg/s390x/exrl-trtr.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/tcg/s390x/exrl-trt.c b/tests/tcg/s390x/exrl-trt.c index 3c5323aecb..16711a3181 100644 --- a/tests/tcg/s390x/exrl-trt.c +++ b/tests/tcg/s390x/exrl-trt.c @@ -19,7 +19,7 @@ int main(void) } asm volatile( " j 2f\n" - "1: trt 0(1,%[op1]),0(%[op2])\n" + "1: trt 0(1,%[op1]),%[op2]\n" "2: exrl %[op1_len],1b\n" " lgr %[r1],%%r1\n" " lgr %[r2],%%r2\n" @@ -27,9 +27,9 @@ int main(void) : [r1] "+r" (r1), [r2] "+r" (r2), [cc] "=3Dr" (cc) - : [op1] "r" (&op1), - [op1_len] "r" (5), - [op2] "r" (&op2) + : [op1] "a" (&op1), + [op1_len] "a" (5), + [op2] "Q" (op2) : "r1", "r2", "cc"); cc =3D (cc >> 28) & 3; if (cc !=3D 2) { diff --git a/tests/tcg/s390x/exrl-trtr.c b/tests/tcg/s390x/exrl-trtr.c index c33153ad7e..5f30cda6bd 100644 --- a/tests/tcg/s390x/exrl-trtr.c +++ b/tests/tcg/s390x/exrl-trtr.c @@ -19,7 +19,7 @@ int main(void) } asm volatile( " j 2f\n" - "1: trtr 3(1,%[op1]),0(%[op2])\n" + "1: trtr 3(1,%[op1]),%[op2]\n" "2: exrl %[op1_len],1b\n" " lgr %[r1],%%r1\n" " lgr %[r2],%%r2\n" @@ -27,9 +27,9 @@ int main(void) : [r1] "+r" (r1), [r2] "+r" (r2), [cc] "=3Dr" (cc) - : [op1] "r" (&op1), - [op1_len] "r" (3), - [op2] "r" (&op2) + : [op1] "a" (&op1), + [op1_len] "a" (3), + [op2] "Q" (op2) : "r1", "r2", "cc"); cc =3D (cc >> 28) & 3; if (cc !=3D 1) { --=20 2.29.2 From nobody Sat Feb 7 06:20:41 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610383326; cv=none; d=zohomail.com; s=zohoarc; b=PqDTSJn6fV8KietIMpNfuc3K1bCsNU8WZI8+Cr5NSOCX7K6d5aO+uxaydtdYATHFVoLWFIRBldp+fkEfj1zXi+mn2n/3a5p0m+8xshSGT1l+p/bHWSg7n6XpHovv9lDovQnY34gUqasaX7FsgUVxCjhKiGpgvoN9690wey1u4gU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610383326; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UNX38AuloCa9Rt+ZF43j1K4sgMxXKCpz7PBSU7u0cnE=; b=a7fWqTGP7gyFJpnHnk2xM7frdVJt283pxRuuzPDVu4sK0UOPqggqGVXAQ/lyPQI63ePvJ6A63IoXONnIYLR8329I3EDf7rG18bggPI1ujh917U5TA92z/G1fbCKELRjRlF7/RzhYd1CL2peGXWi6rxzg5Ejc1i2PALnLHrFRp8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610383326316644.8299129906936; Mon, 11 Jan 2021 08:42:06 -0800 (PST) Received: from localhost ([::1]:35056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0Gb-0000tX-4D for importer@patchew.org; Mon, 11 Jan 2021 11:42:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dm-0005gF-6w for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kz0Dk-0000Z4-IE for qemu-devel@nongnu.org; Mon, 11 Jan 2021 11:39:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-4mz3iwFQO4mqri8LxevXkA-1; Mon, 11 Jan 2021 11:39:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19C08803628; Mon, 11 Jan 2021 16:39:05 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-103.ams2.redhat.com [10.36.115.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64EB01971A; Mon, 11 Jan 2021 16:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610383147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UNX38AuloCa9Rt+ZF43j1K4sgMxXKCpz7PBSU7u0cnE=; b=b/dB2oj7hyKIO3qm6jgKGIm62WASVFsi1F4iseiHwxAcjb0iLO5F3OZ9DZMDzENifwqGBg zaN59DiVCe8CjF6Cu9S/mQvrRKn7RyUINrkPsJz7019rEMmTAQg/weZovdk6IzXWdy8g61 rgIgKNyS8ZUfUhyWRAhaDYHY9QEeyuQ= X-MC-Unique: 4mz3iwFQO4mqri8LxevXkA-1 From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v3 5/5] s390x/tcg: Ignore register content if b1/b2 is zero when handling EXECUTE Date: Mon, 11 Jan 2021 17:38:45 +0100 Message-Id: <20210111163845.18148-6-david@redhat.com> In-Reply-To: <20210111163845.18148-1-david@redhat.com> References: <20210111163845.18148-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=david@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Richard Henderson , Cornelia Huck , Nick Desaulniers , qemu-s390x@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In our EXECUTE fast path, we have to ignore the content of r0, if specified by b1 or b2. Fixes: d376f123c7de ("target/s390x: Re-implement a few EXECUTE target insns= directly") Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Tested-by: Nick Desaulniers Tested-by: Guenter Roeck Signed-off-by: David Hildenbrand --- target/s390x/mem_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 0108611cc9..1901e9dfc7 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -2473,8 +2473,8 @@ void HELPER(ex)(CPUS390XState *env, uint32_t ilen, ui= nt64_t r1, uint64_t addr) uint32_t d1 =3D extract64(insn, 32, 12); uint32_t b2 =3D extract64(insn, 28, 4); uint32_t d2 =3D extract64(insn, 16, 12); - uint64_t a1 =3D wrap_address(env, env->regs[b1] + d1); - uint64_t a2 =3D wrap_address(env, env->regs[b2] + d2); + uint64_t a1 =3D wrap_address(env, (b1 ? env->regs[b1] : 0) + d= 1); + uint64_t a2 =3D wrap_address(env, (b2 ? env->regs[b2] : 0) + d= 2); =20 env->cc_op =3D helper(env, l, a1, a2, 0); env->psw.addr +=3D ilen; --=20 2.29.2