From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031088; cv=none; d=zohomail.com; s=zohoarc; b=bkZ4KVLdRfOem6dpv8GvZwlNSR18DThxAXCi4aWi84Ci4Hq2xjz0AtcSBYyIVWG5BPc3AzWayEmwxbI6SrcYluj3eaYApDtfk/NrbZ/wz5iHjUUCUBmegGFZO0KWEuBUQJoRHjjufa56nqP4zIUlVwQRbGc725X6kMHbzmUJPVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031088; h=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=XhsBSAalXhzycYFT4vqLGhpQUKD4MlWHmIKDc61daz4=; b=RlkLgrefw7wdzMTHiLwhPL2amAjXmk5wl6JuRd1iL2E6wdGkTYMLB4BryHsAs8w8pWpZuSlu7bUs9fZu/BkdBD3HhMBnCjkvzIXmaO0Ug1WGYkYZKN4uzgUBl+VE7kC4U7ezGM4+H/bFutsWe1w7MGN9NZtpdBXZiP2WlSDMnGA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031088204285.45339993834864; Mon, 5 Jun 2023 22:58:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgH-0004jj-Gj; Tue, 06 Jun 2023 01:56:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgE-0004jJ-ER for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgD-00044T-0N for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:30 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-bvZXYsiDPgm6_riKD3tAKQ-1; Tue, 06 Jun 2023 01:56:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69DAF299E740; Tue, 6 Jun 2023 05:56:26 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 171852166B25; Tue, 6 Jun 2023 05:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XhsBSAalXhzycYFT4vqLGhpQUKD4MlWHmIKDc61daz4=; b=TUMUSMJaDL1dzcnxu+6dDDv+Ianj8A71BQsZUC9YRp3zLw9BReGnmTYImqvPVU8yQ31kHd bEv3+9YzohqyqudRDkTlwAB2FQ18fRQuYJQcZxqF0fhXiVJl18QoU7V45/j87wipDqIIvi J4Lip5H3nNyjRCaoTVoL/DhtRbnTskk= X-MC-Unique: bvZXYsiDPgm6_riKD3tAKQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , qemu-stable@nongnu.org, David Hildenbrand Subject: [PULL 01/18] target/s390x: Fix LCBB overwriting the top 32 bits Date: Tue, 6 Jun 2023 07:56:04 +0200 Message-Id: <20230606055621.523175-2-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031090018100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich LCBB is supposed to overwrite only the bottom 32 bits, but QEMU erroneously overwrites the entire register. Fixes: 6d9303322ed9 ("s390x/tcg: Implement LOAD COUNT TO BLOCK BOUNDARY") Cc: qemu-stable@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.1425579-2-iii@linux.ibm.com> Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- target/s390x/tcg/insn-data.h.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/tcg/insn-data.h.inc b/target/s390x/tcg/insn-data.= h.inc index bcc70d99ba..e41672684a 100644 --- a/target/s390x/tcg/insn-data.h.inc +++ b/target/s390x/tcg/insn-data.h.inc @@ -486,7 +486,7 @@ F(0xb343, LCXBR, RRE, Z, x2h, x2l, new_P, x1_P, negf128, f128, I= F_BFP) F(0xb373, LCDFR, RRE, FPSSH, 0, f2, new, f1, negf64, 0, IF_AFP1 | = IF_AFP2) /* LOAD COUNT TO BLOCK BOUNDARY */ - C(0xe727, LCBB, RXE, V, la2, 0, r1, 0, lcbb, 0) + C(0xe727, LCBB, RXE, V, la2, 0, new, r1_32, lcbb, 0) /* LOAD HALFWORD */ C(0xb927, LHR, RRE, EI, 0, r2_16s, 0, r1_32, mov2, 0) C(0xb907, LGHR, RRE, EI, 0, r2_16s, 0, r1, mov2, 0) --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031086; cv=none; d=zohomail.com; s=zohoarc; b=BFw1tUe+hsKLgThNe9TnOB2PNPhOapDeMn2rAQxNrqaQAEQ9N7ImzncaVvc9BNwS6d9UxPeRAhjnsvfB7BUUHAyGGqhgLFz6D06swMWHtWq2Oi8A5rY+qFAqFwlOR9N6DQyCdf3Qy+R7PbFQInyRStZBgYercKjIe6vAagJyXrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031086; h=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=tt73rM8NJ5DyayJocaDCA2D//CCHTDJSW/fH1beXtOQ=; b=lEglO6U0FODEGCbMMPOuQvdGFWE9wio5VnllThNZ5+c53teGRQQbhvJdP1J3kPTLLFccFP5ZXdltcu9ku7r0EvltLpNEJ60+W8voEeM0tDtRZ19RQ9i5Mes/5YJ4GOIAp3/iYhx7jLWap/HqrxT8lbrYsRiZsu7mEaXtOP2gO4I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168603108635184.24814926801514; Mon, 5 Jun 2023 22:58:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgK-0004lY-D0; Tue, 06 Jun 2023 01:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgI-0004k7-3d for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgG-000451-IW for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-twm9V-ZePrOcKeVCkwxu8w-1; Tue, 06 Jun 2023 01:56:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F461101A55C; Tue, 6 Jun 2023 05:56:28 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAA672166B25; Tue, 6 Jun 2023 05:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tt73rM8NJ5DyayJocaDCA2D//CCHTDJSW/fH1beXtOQ=; b=EKvJcODb5RR/UT5nK2zjbVf/R9owMg3qSG4VU4C94h702OEBlqGjko87n3c/32XkdD2OS4 Ml7rCPtZiS3ccQI8J1OS7wGiOq+SPXvHiCET8cbTHzFZ8/uRJwfXOeGX2HyttMTGBTHIku EBl8lzRZ3q0VziHPR6AgUgCuWGrv4vg= X-MC-Unique: twm9V-ZePrOcKeVCkwxu8w-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , qemu-stable@nongnu.org, David Hildenbrand Subject: [PULL 02/18] tests/tcg/s390x: Test LCBB Date: Tue, 6 Jun 2023 07:56:05 +0200 Message-Id: <20230606055621.523175-3-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031087686100003 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a test to prevent regressions. Cc: qemu-stable@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.1425579-3-iii@linux.ibm.com> Reviewed-by: David Hildenbrand Acked-by: Richard Henderson Signed-off-by: Thomas Huth --- tests/tcg/s390x/lcbb.c | 51 +++++++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 52 insertions(+) create mode 100644 tests/tcg/s390x/lcbb.c diff --git a/tests/tcg/s390x/lcbb.c b/tests/tcg/s390x/lcbb.c new file mode 100644 index 0000000000..8d368e0998 --- /dev/null +++ b/tests/tcg/s390x/lcbb.c @@ -0,0 +1,51 @@ +/* + * Test the LCBB instruction. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include + +static inline __attribute__((__always_inline__)) void +lcbb(long *r1, void *dxb2, int m3, int *cc) +{ + asm("lcbb %[r1],%[dxb2],%[m3]\n" + "ipm %[cc]" + : [r1] "+r" (*r1), [cc] "=3Dr" (*cc) + : [dxb2] "R" (*(char *)dxb2), [m3] "i" (m3) + : "cc"); + *cc =3D (*cc >> 28) & 3; +} + +static char buf[0x1000] __attribute__((aligned(0x1000))); + +static inline __attribute__((__always_inline__)) void +test_lcbb(void *p, int m3, int exp_r1, int exp_cc) +{ + long r1 =3D 0xfedcba9876543210; + int cc; + + lcbb(&r1, p, m3, &cc); + assert(r1 =3D=3D (0xfedcba9800000000 | exp_r1)); + assert(cc =3D=3D exp_cc); +} + +int main(void) +{ + test_lcbb(&buf[0], 0, 16, 0); + test_lcbb(&buf[63], 0, 1, 3); + test_lcbb(&buf[0], 1, 16, 0); + test_lcbb(&buf[127], 1, 1, 3); + test_lcbb(&buf[0], 2, 16, 0); + test_lcbb(&buf[255], 2, 1, 3); + test_lcbb(&buf[0], 3, 16, 0); + test_lcbb(&buf[511], 3, 1, 3); + test_lcbb(&buf[0], 4, 16, 0); + test_lcbb(&buf[1023], 4, 1, 3); + test_lcbb(&buf[0], 5, 16, 0); + test_lcbb(&buf[2047], 5, 1, 3); + test_lcbb(&buf[0], 6, 16, 0); + test_lcbb(&buf[4095], 6, 1, 3); + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.tar= get index 23dc8b6a63..4ed07c6ab0 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -47,6 +47,7 @@ $(PGM_SPECIFICATION_TESTS): LDFLAGS+=3Dpgm-specification-= user.o TESTS +=3D $(PGM_SPECIFICATION_TESTS) =20 Z13_TESTS=3Dvistr +Z13_TESTS+=3Dlcbb $(Z13_TESTS): CFLAGS+=3D-march=3Dz13 -O2 TESTS+=3D$(Z13_TESTS) =20 --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031156; cv=none; d=zohomail.com; s=zohoarc; b=JY6W0pHViuF+EnX60kNHmBdC6Mg/HExT23N1IWGkionfZ0OC74T2beYB6hs5NNIT7r+FLf6Xhkf63nCTTD1etZ923EQwCsddwHS4Xmv5GyrKUEqyh4ee7hqJAx+iTPLS24TieA8T58zf/hDWywpLm/hmPSzaeHRz0CjaBfEpt/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031156; h=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=3KGVptQUZiypkFR2AGkp949S3ABkuB53CrW3HeMkh7E=; b=fB42/DSrpVzuTQ3Vt9V6fmQdE51uslKc4h3jYSloqIAYidbzEDxu+c6hc0QS7gqy956+l5mkbIVNLIBW1QGqQpltZ4OGl1lAIctiSuefShhlguj2LRzpo08GX23yYUWdRFzy0NqLUHoeMnnogWrqo30Uil2jTYHE3ffF2sMwfLc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031156967311.8070759131766; Mon, 5 Jun 2023 22:59:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgL-0004la-5y; Tue, 06 Jun 2023 01:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgJ-0004kq-GR for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgH-00045x-Se for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-654-Oc1G0sZ-OvSEacqPr4cpkg-1; Tue, 06 Jun 2023 01:56:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5F47811E86; Tue, 6 Jun 2023 05:56:29 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72A9B2166B25; Tue, 6 Jun 2023 05:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3KGVptQUZiypkFR2AGkp949S3ABkuB53CrW3HeMkh7E=; b=XKJjgFdr5vqJcNoEt2hpiIoM4OcF3IXkzy3eWHR/o8hAxcfecn4DSobO4mCQBvY0B/O1Ps MieI8jrPJmDv3g012thOkuhvqtIRNLOgn949r3/r6GYHlrXcxdIjnOeV9zdHmMCvX9PAyd evdEpYxtZU5uh4zvcx1JX4wRSvMDKM4= X-MC-Unique: Oc1G0sZ-OvSEacqPr4cpkg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , qemu-stable@nongnu.org, Mikhail Mitskevich , David Hildenbrand Subject: [PULL 03/18] target/s390x: Fix LOCFHR taking the wrong half of R2 Date: Tue, 6 Jun 2023 07:56:06 +0200 Message-Id: <20230606055621.523175-4-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031157805100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich LOCFHR should write top-to-top, but QEMU erroneously writes bottom-to-top. Fixes: 45aa9aa3b773 ("target/s390x: Implement load-on-condition-2 insns") Cc: qemu-stable@nongnu.org Reported-by: Mikhail Mitskevich Closes: https://gitlab.com/qemu-project/qemu/-/issues/1668 Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.1425579-4-iii@linux.ibm.com> Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- target/s390x/tcg/insn-data.h.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/tcg/insn-data.h.inc b/target/s390x/tcg/insn-data.= h.inc index e41672684a..937e18ea9d 100644 --- a/target/s390x/tcg/insn-data.h.inc +++ b/target/s390x/tcg/insn-data.h.inc @@ -564,7 +564,7 @@ C(0xec46, LOCGHI, RIE_g, LOC2, r1, i2, r1, 0, loc, 0) C(0xec4e, LOCHHI, RIE_g, LOC2, r1_sr32, i2, new, r1_32h, loc, 0) /* LOAD HIGH ON CONDITION */ - C(0xb9e0, LOCFHR, RRF_c, LOC2, r1_sr32, r2, new, r1_32h, loc, 0) + C(0xb9e0, LOCFHR, RRF_c, LOC2, r1_sr32, r2_sr32, new, r1_32h, loc, 0) C(0xebe0, LOCFH, RSY_b, LOC2, r1_sr32, m2_32u, new, r1_32h, loc, 0) /* LOAD PAIR DISJOINT */ D(0xc804, LPD, SSF, ILA, 0, 0, new_P, r3_P32, lpd, 0, MO_TEUL) --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031092; cv=none; d=zohomail.com; s=zohoarc; b=Xl83bk6oskt6v2nfTJEywXxlapYlvpdDptJlkY8K3OurWFNFdmsWM6j8Izxi/x3yU5vz3vTHvIgshUcFwE4aHXwzqLeT7AQxWPbEAz6gtphrW7e5CjLXK4N7goS0oaRvyHdgYzmB6iWSxPR6PHcqhertDCRronohJr8x+7rraSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031092; h=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=nVXMEjYxa0jQWA9rMKBIZLrOCvcgNOpUUDH8hbg8kHQ=; b=gACeD5bfidJbbekXMXj86ncagp1XYbgvKgVBGE13YppaZXca+XY/NTvlgUePELxHpLC8i371tg40++ZvZS2KsRArOGY0D9b745nhDCwGdbpW88DW3M6jZKudZjvqs4c6J5KwvpPpygW2XchhMPijbgDZ/3WAKbAYN6cW7RUKAzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031092698788.6720377480761; Mon, 5 Jun 2023 22:58:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgN-0004mo-6S; Tue, 06 Jun 2023 01:56:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgL-0004lp-H3 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgJ-00046f-QJ for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:37 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-653-HsChm1LINuet6YaCXdjlkg-1; Tue, 06 Jun 2023 01:56:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F3493C025D8; Tue, 6 Jun 2023 05:56:31 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1482A2166B25; Tue, 6 Jun 2023 05:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nVXMEjYxa0jQWA9rMKBIZLrOCvcgNOpUUDH8hbg8kHQ=; b=CLaDLVKXYJokIjoQQ37uoNFFaGLm96OlKh9mFt2wdrauCUKF5a2td881vSFM+HWMWKRMDk KOVE6RvqmHPAu/WinxbT/Xw0E6wK5CXEm7agBf7kOFehCCqZg17/CQ40euSXqI/EoXDQDH dQ7pkiIUaW0n6tcSx3aiiwCA38n6dBI= X-MC-Unique: HsChm1LINuet6YaCXdjlkg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , qemu-stable@nongnu.org, David Hildenbrand Subject: [PULL 04/18] tests/tcg/s390x: Test LOCFHR Date: Tue, 6 Jun 2023 07:56:07 +0200 Message-Id: <20230606055621.523175-5-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031093523100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a small test to prevent regressions. Cc: qemu-stable@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230526181240.1425579-5-iii@linux.ibm.com> Reviewed-by: Richard Henderson Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- tests/tcg/s390x/locfhr.c | 29 +++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/locfhr.c diff --git a/tests/tcg/s390x/locfhr.c b/tests/tcg/s390x/locfhr.c new file mode 100644 index 0000000000..ab9ff6e449 --- /dev/null +++ b/tests/tcg/s390x/locfhr.c @@ -0,0 +1,29 @@ +/* + * Test the LOCFHR instruction. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include + +static inline __attribute__((__always_inline__)) long +locfhr(long r1, long r2, int m3, int cc) +{ + cc <<=3D 28; + asm("spm %[cc]\n" + "locfhr %[r1],%[r2],%[m3]\n" + : [r1] "+r" (r1) + : [cc] "r" (cc), [r2] "r" (r2), [m3] "i" (m3) + : "cc"); + return r1; +} + +int main(void) +{ + assert(locfhr(0x1111111122222222, 0x3333333344444444, 8, 0) =3D=3D + 0x3333333322222222); + assert(locfhr(0x5555555566666666, 0x7777777788888888, 11, 1) =3D=3D + 0x5555555566666666); + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.tar= get index 4ed07c6ab0..b14c0bd84b 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -48,6 +48,7 @@ TESTS +=3D $(PGM_SPECIFICATION_TESTS) =20 Z13_TESTS=3Dvistr Z13_TESTS+=3Dlcbb +Z13_TESTS+=3Dlocfhr $(Z13_TESTS): CFLAGS+=3D-march=3Dz13 -O2 TESTS+=3D$(Z13_TESTS) =20 --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031139; cv=none; d=zohomail.com; s=zohoarc; b=iC0yHtEJApchqgHLIGlLKamYJq4a/6sXNpNeKeGU8ikmFi3/FAUhRl+6GCjvclhid06PNzQxpltqxqNgqW8ZFQCiNwwF1sBZN0Np9nECewV8GB/58EfjGWZW0AKOEIQFrHN5U9VWReMmdHJIquyh2iQzuLLArJkmE6e7C6n9Eto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031139; h=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=q4bcmti1rh4/WWlPgoLY801itVYYCxnT7SLe6YuP+/E=; b=i1RRsXbxk5WE827fdVWXzrhyNLLggx9Bjao3jbpGbt1jUU+TpC86vBP1xRIgVgBys1t/I0pkyXlVNoADhJ7VECdbg32dXK9+rTpcYHEV5GMKOpyRiceA1GCvSubsoRJmk/QKqf0O3Wn25jgMJLernylSYCeHhTOXZKjhiIfnMHc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031139280726.7737962130499; Mon, 5 Jun 2023 22:58:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgP-0004nU-CM; Tue, 06 Jun 2023 01:56:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgM-0004mU-Nl for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgK-000474-Oo for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:38 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-ZZ7Fw_s-Nk2F1RTIukW8tA-1; Tue, 06 Jun 2023 01:56:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78BE0800BFF; Tue, 6 Jun 2023 05:56:32 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B7082166B25; Tue, 6 Jun 2023 05:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q4bcmti1rh4/WWlPgoLY801itVYYCxnT7SLe6YuP+/E=; b=SEN1mOiM6nW+oiH14NGON2y7D3LqxUeUhSgeKGgOo+nXoz0MUStEc74ZkZIShMyJrkbVKv LoQHILpO3+8kYDImAZ/SBBH/lEpridcev9nt87XavVxT0157CZYZf16DWj8QmhJI/F/ycx qda9Gy64AJq9BxMVlOEF3KUcalLknWg= X-MC-Unique: ZZ7Fw_s-Nk2F1RTIukW8tA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich Subject: [PULL 05/18] linux-user/s390x: Fix single-stepping SVC Date: Tue, 6 Jun 2023 07:56:08 +0200 Message-Id: <20230606055621.523175-6-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031140232100002 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Currently single-stepping SVC executes two instructions. The reason is that EXCP_DEBUG for the SVC instruction itself is masked by EXCP_SVC. Fix by re-raising EXCP_DEBUG. Signed-off-by: Ilya Leoshkevich Message-Id: <20230510230213.330134-2-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- linux-user/s390x/cpu_loop.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c index 285bc60071..8b7ac2879e 100644 --- a/linux-user/s390x/cpu_loop.c +++ b/linux-user/s390x/cpu_loop.c @@ -86,6 +86,15 @@ void cpu_loop(CPUS390XState *env) } else if (ret !=3D -QEMU_ESIGRETURN) { env->regs[2] =3D ret; } + + if (unlikely(cs->singlestep_enabled)) { + /* + * cpu_tb_exec() did not raise EXCP_DEBUG, because it has = seen + * that EXCP_SVC was already pending. + */ + cs->exception_index =3D EXCP_DEBUG; + } + break; =20 case EXCP_DEBUG: --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031214; cv=none; d=zohomail.com; s=zohoarc; b=bfLrW3aLcsALkQYjaX3cO7P+/2DYhbJByHS6zHDzwl7EiH+8WsfdrJFOdUrrMoHIgY5J/rBoyDaSMZq8i3oFXNd3ZBsAv3a3m+7tJdsM/D8SmYOZw+upy9v1YhR7rkBWoVGlpDOvT748KdW6jWnpbu+3Wn7y8Tnxi84+kJhi3hM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031214; 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=6R/39GPqskQ+7PH8eIN8cruERLA6l7OCtIbdQDVg8Eg=; b=EZCR++4/DFiYKAQjDMI6ShpJNgJE/TLpieM+3Lblhf9HYUloGOxvzTCumhLPW8TIbTqZq3D9YdSKGI4b7bU3BC1DPvXalChNepO8vztUmc8pa8aTl2hB0oiv2cD64Eo93c/j1FGOtvYyG3Eyt6NNmdRPt79YKc+K5cbFPlSPeuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031214314689.6759359406079; Mon, 5 Jun 2023 23:00:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgR-0004oR-6j; Tue, 06 Jun 2023 01:56:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgP-0004nS-5e for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgM-00047n-CV for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:40 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-MgCGhmi7OB-m2BZ8455JXA-1; Tue, 06 Jun 2023 01:56:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0265A85A5A8; Tue, 6 Jun 2023 05:56:34 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id C41BF2166B25; Tue, 6 Jun 2023 05:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030997; 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=6R/39GPqskQ+7PH8eIN8cruERLA6l7OCtIbdQDVg8Eg=; b=S3LASlyI+hAigym5wmaO39tryqxCAHORny6S3pRnTsAm6brwpd0sJmtwSH2t2xi1B+sFb9 diR/EuYx4rQ418M4L0RlOXjz2JiduK6LdM2d+SiHZ3Lr51Np65nXDEUAB1icbQkI/9Vts7 9RPHQAq1BsseptM+W1TbzUhJuobFKUo= X-MC-Unique: MgCGhmi7OB-m2BZ8455JXA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 06/18] tests/tcg/s390x: Test single-stepping SVC Date: Tue, 6 Jun 2023 07:56:09 +0200 Message-Id: <20230606055621.523175-7-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031214806100005 From: Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich Acked-by: Alex Benn=C3=A9e Message-Id: <20230510230213.330134-3-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- tests/tcg/s390x/Makefile.target | 11 ++++- tests/tcg/s390x/gdbstub/test-svc.py | 64 +++++++++++++++++++++++++++++ tests/tcg/s390x/hello-s390x-asm.S | 20 +++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/s390x/gdbstub/test-svc.py create mode 100644 tests/tcg/s390x/hello-s390x-asm.S diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.tar= get index b14c0bd84b..a2a15c4a23 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -77,7 +77,16 @@ run-gdbstub-signals-s390x: signals-s390x --bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \ mixing signals and debugging) =20 -EXTRA_RUNS +=3D run-gdbstub-signals-s390x +hello-s390x-asm: CFLAGS+=3D-nostdlib + +run-gdbstub-svc: hello-s390x-asm + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \ + single-stepping svc) + +EXTRA_RUNS +=3D run-gdbstub-signals-s390x run-gdbstub-svc endif =20 # MVX versions of sha512 diff --git a/tests/tcg/s390x/gdbstub/test-svc.py b/tests/tcg/s390x/gdbstub/= test-svc.py new file mode 100644 index 0000000000..7851ca7284 --- /dev/null +++ b/tests/tcg/s390x/gdbstub/test-svc.py @@ -0,0 +1,64 @@ +"""Test single-stepping SVC. + +This runs as a sourced script (via -x, via run-test.py).""" +from __future__ import print_function +import gdb +import sys + + +n_failures =3D 0 + + +def report(cond, msg): + """Report success/fail of a test""" + if cond: + print("PASS: {}".format(msg)) + else: + print("FAIL: {}".format(msg)) + global n_failures + n_failures +=3D 1 + + +def run_test(): + """Run through the tests one by one""" + report("lghi\t" in gdb.execute("x/i $pc", False, True), "insn #1") + gdb.execute("si") + report("larl\t" in gdb.execute("x/i $pc", False, True), "insn #2") + gdb.execute("si") + report("lghi\t" in gdb.execute("x/i $pc", False, True), "insn #3") + gdb.execute("si") + report("svc\t" in gdb.execute("x/i $pc", False, True), "insn #4") + gdb.execute("si") + report("xgr\t" in gdb.execute("x/i $pc", False, True), "insn #5") + gdb.execute("si") + report("svc\t" in gdb.execute("x/i $pc", False, True), "insn #6") + gdb.execute("si") + + +def main(): + """Prepare the environment and run through the tests""" + try: + inferior =3D gdb.selected_inferior() + print("ATTACHED: {}".format(inferior.architecture().name())) + except (gdb.error, AttributeError): + print("SKIPPING (not connected)") + exit(0) + + if gdb.parse_and_eval('$pc') =3D=3D 0: + print("SKIP: PC not set") + exit(0) + + try: + # These are not very useful in scripts + gdb.execute("set pagination off") + gdb.execute("set confirm off") + + # Run the actual tests + run_test() + except gdb.error: + report(False, "GDB Exception: {}".format(sys.exc_info()[0])) + print("All tests complete: %d failures" % n_failures) + exit(n_failures) + + +main() diff --git a/tests/tcg/s390x/hello-s390x-asm.S b/tests/tcg/s390x/hello-s390= x-asm.S new file mode 100644 index 0000000000..2e9faa1604 --- /dev/null +++ b/tests/tcg/s390x/hello-s390x-asm.S @@ -0,0 +1,20 @@ +/* + * Hello, World! in assembly. + */ + +.globl _start +_start: + +/* puts("Hello, World!"); */ +lghi %r2,1 +larl %r3,foo +lghi %r4,foo_end-foo +svc 4 + +/* exit(0); */ +xgr %r2,%r2 +svc 1 + +.align 2 +foo: .asciz "Hello, World!\n" +foo_end: --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031110; cv=none; d=zohomail.com; s=zohoarc; b=R6Yxi47OPYp1cJ+ry6YRt983ngBKK1CPq7MMlh2VAnJQ7gApBQika0VR3+4a3n4VUJictYS4BL9BvrO9gjsmnibqUHEDd4IZAJRVLE6NH0ZHYl/lmd5THeA1idrwPXxc5FqLdIEuTP7Et/yTm9NwHNRpWqKRW/GIMcasbpxO91I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031110; 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=Yryagvf81PRjf69L7mQKMOEyrJPFFx37Qy2oK85oHGo=; b=nS5oRHxS80e8wXeYKGv1xKn4joIMSsX2LxRUT724RSl2bPlj/XSPTv7Pfp6/vBVqFXWSgE94HbxpaMKpS5nmto+LwtV7gAMHuIh9Mt9Td2u9zzTgtwUV4smCmjjgXz1XqZoU75870YHJAUKuT37BK/69JulAXYSqq4LiKc7FjZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031109992530.6257174710404; Mon, 5 Jun 2023 22:58:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgQ-0004o7-L2; Tue, 06 Jun 2023 01:56:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgN-0004mq-BH for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgL-00047K-Qe for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:39 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-171-Pp79o_4vMjCCj8wQCOi1Ow-1; Tue, 06 Jun 2023 01:56:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B408800BFF; Tue, 6 Jun 2023 05:56:35 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5390F2166B25; Tue, 6 Jun 2023 05:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686030997; 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=Yryagvf81PRjf69L7mQKMOEyrJPFFx37Qy2oK85oHGo=; b=UWQAHDgpkcrUIHIydZDKZ1S+gsY+LAIzFqj2SQFxEypT1Ee9EjWd2eSNkGviv1GC87nERA 2ZskwxRp/b+x/qhRQCVyWi7ludmjQfifRj1Nl5X5/QSpaZwArp7i9RE8oMPm8VZzafeHm2 EySnu7/nzPcpTfF/38Qku54XNypAnns= X-MC-Unique: Pp79o_4vMjCCj8wQCOi1Ow-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Max Fritz , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 07/18] Add conditional dependency for libkeyutils Date: Tue, 6 Jun 2023 07:56:10 +0200 Message-Id: <20230606055621.523175-8-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031111703100001 From: Max Fritz This modification enables better control over the inclusion of libkeyutils based on the configuration, enhancing the flexibility of the build system. Signed-off-by: Max Fritz Message-Id: <168471463402.18155.3575359027429939965-1@git.sr.ht> Reviewed-by: Daniel P. Berrang=C3=A9 [thuth: Remove the "kwargs: static_kwargs" part - it's not necessary anymor= e] Signed-off-by: Thomas Huth --- meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a61d3e9b06..576bc2fdbd 100644 --- a/meson.build +++ b/meson.build @@ -1781,8 +1781,10 @@ if gnutls.found() tasn1 =3D dependency('libtasn1', method: 'pkg-config') endif -keyutils =3D dependency('libkeyutils', required: false, - method: 'pkg-config') +keyutils =3D not_found +if get_option('keyring').enabled() + keyutils =3D dependency('libkeyutils', required: false, method: 'pkg-con= fig') +endif =20 has_gettid =3D cc.has_function('gettid') =20 --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031202; cv=none; d=zohomail.com; s=zohoarc; b=gSUBRbNvKv1Xd0rVDubOfVO/fbAgmfd70mouMyxMGuS8/ZUmHLnyl3JssDxg5cMST5zos6BMv7mElpq+khtVkeVy21oNqTkLT338sf1hUgDzVSYZ4pMNmrQT+UktXlW+SCJFiVIi0txyk8v2DQH2AEVW4VwIDd/sD+Y9Jr54gMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031202; h=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=DfFFkSkA+sXqplJuN3OKvutC9SwvPNipO+gGQoPidik=; b=HNUCGUFrQFQoBusTlr0Q18E4wWXMNkrZvPNKLwjhqMMj2IKIcf9sK4Bs+3rg0kJE5va8ntA9H4jfBRRJDhXRjkS6eIJ27Hh5+oeIkMT8PH+U6tu221P1fL8rQbF72Q2Q9d4FBiZA/RTBIOUIi1mMoEjj1qOmlEihvdHJqjm3IzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031202059457.4828995813558; Mon, 5 Jun 2023 23:00:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgU-0004pb-IF; Tue, 06 Jun 2023 01:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgT-0004pD-20 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgR-000499-DQ for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-146-FXo01DxQObiBCiI6DYeqjg-1; Tue, 06 Jun 2023 01:56:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5215A802355; Tue, 6 Jun 2023 05:56:37 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD9692166B25; Tue, 6 Jun 2023 05:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DfFFkSkA+sXqplJuN3OKvutC9SwvPNipO+gGQoPidik=; b=KXn1dL2BoRkhL9xLf0WJzGQ+eSZ8bQ0IYCHBzNKgom7Bo7ODllnh+JtP6JRG+NvtmPTU4b iYOXF3A2pwNwrdKmrDHSbSe6g1XDH+3w/HWSCxn9q9v7zHFCywGGll8lt+nwXFMWRUDjNS /C2PfsTSkwpJujhIWUkMo9aKMPZD9RM= X-MC-Unique: FXo01DxQObiBCiI6DYeqjg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , Tulio Magno Quites Machado Filho , qemu-stable@nongnu.org, David Hildenbrand Subject: [PULL 08/18] target/s390x: Fix MXDB and MXDBR Date: Tue, 6 Jun 2023 07:56:11 +0200 Message-Id: <20230606055621.523175-9-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031202785100002 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich These instructions multiply 64 bits by 64 bits, not 128 bits by 64 bits. Reported-by: Tulio Magno Quites Machado Filho Fixes: 2b91240f95fd ("target/s390x: Use Int128 for passing float128") Cc: qemu-stable@nongnu.org Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D2211472 Signed-off-by: Ilya Leoshkevich Message-Id: <20230601223027.795501-2-iii@linux.ibm.com> Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- target/s390x/helper.h | 2 +- target/s390x/tcg/insn-data.h.inc | 4 ++-- target/s390x/tcg/fpu_helper.c | 5 +++-- target/s390x/tcg/translate.c | 8 +------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/helper.h index 7529e725f2..6bc01df73d 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -50,7 +50,7 @@ DEF_HELPER_FLAGS_3(meeb, TCG_CALL_NO_WG, i64, env, i64, i= 64) DEF_HELPER_FLAGS_3(mdeb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(mdb, TCG_CALL_NO_WG, i64, env, i64, i64) DEF_HELPER_FLAGS_3(mxb, TCG_CALL_NO_WG, i128, env, i128, i128) -DEF_HELPER_FLAGS_3(mxdb, TCG_CALL_NO_WG, i128, env, i128, i64) +DEF_HELPER_FLAGS_3(mxdb, TCG_CALL_NO_WG, i128, env, i64, i64) DEF_HELPER_FLAGS_2(ldeb, TCG_CALL_NO_WG, i64, env, i64) DEF_HELPER_FLAGS_3(ldxb, TCG_CALL_NO_WG, i64, env, i128, i32) DEF_HELPER_FLAGS_2(lxdb, TCG_CALL_NO_WG, i128, env, i64) diff --git a/target/s390x/tcg/insn-data.h.inc b/target/s390x/tcg/insn-data.= h.inc index 937e18ea9d..0a45dbbcda 100644 --- a/target/s390x/tcg/insn-data.h.inc +++ b/target/s390x/tcg/insn-data.h.inc @@ -668,11 +668,11 @@ F(0xb31c, MDBR, RRE, Z, f1, f2, new, f1, mdb, 0, IF_BFP) F(0xb34c, MXBR, RRE, Z, x1, x2, new_x, x1, mxb, 0, IF_BFP) F(0xb30c, MDEBR, RRE, Z, f1, e2, new, f1, mdeb, 0, IF_BFP) - F(0xb307, MXDBR, RRE, Z, 0, f2, x1, x1, mxdb, 0, IF_BFP) + F(0xb307, MXDBR, RRE, Z, f1, f2, new_x, x1, mxdb, 0, IF_BFP) F(0xed17, MEEB, RXE, Z, e1, m2_32u, new, e1, meeb, 0, IF_BFP) F(0xed1c, MDB, RXE, Z, f1, m2_64, new, f1, mdb, 0, IF_BFP) F(0xed0c, MDEB, RXE, Z, f1, m2_32u, new, f1, mdeb, 0, IF_BFP) - F(0xed07, MXDB, RXE, Z, 0, m2_64, x1, x1, mxdb, 0, IF_BFP) + F(0xed07, MXDB, RXE, Z, f1, m2_64, new_x, x1, mxdb, 0, IF_BFP) /* MULTIPLY HALFWORD */ C(0x4c00, MH, RX_a, Z, r1_o, m2_16s, new, r1_32, mul, 0) C(0xe37c, MHY, RXY_a, GIE, r1_o, m2_16s, new, r1_32, mul, 0) diff --git a/target/s390x/tcg/fpu_helper.c b/target/s390x/tcg/fpu_helper.c index 0bdab5bcf7..57e5829283 100644 --- a/target/s390x/tcg/fpu_helper.c +++ b/target/s390x/tcg/fpu_helper.c @@ -321,10 +321,11 @@ Int128 HELPER(mxb)(CPUS390XState *env, Int128 a, Int1= 28 b) } =20 /* 128/64-bit FP multiplication */ -Int128 HELPER(mxdb)(CPUS390XState *env, Int128 a, uint64_t f2) +Int128 HELPER(mxdb)(CPUS390XState *env, uint64_t f1, uint64_t f2) { + float128 f1_128 =3D float64_to_float128(f1, &env->fpu_status); float128 ret =3D float64_to_float128(f2, &env->fpu_status); - ret =3D float128_mul(ARG128(a), ret, &env->fpu_status); + ret =3D float128_mul(f1_128, ret, &env->fpu_status); handle_exceptions(env, false, GETPC()); return RET128(ret); } diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 3eb3708d55..3ac573dfce 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -3421,7 +3421,7 @@ static DisasJumpType op_mxb(DisasContext *s, DisasOps= *o) =20 static DisasJumpType op_mxdb(DisasContext *s, DisasOps *o) { - gen_helper_mxdb(o->out_128, cpu_env, o->in1_128, o->in2); + gen_helper_mxdb(o->out_128, cpu_env, o->in1, o->in2); return DISAS_NEXT; } =20 @@ -5183,12 +5183,6 @@ static void prep_r1_P(DisasContext *s, DisasOps *o) } #define SPEC_prep_r1_P SPEC_r1_even =20 -static void prep_x1(DisasContext *s, DisasOps *o) -{ - o->out_128 =3D load_freg_128(get_field(s, r1)); -} -#define SPEC_prep_x1 SPEC_r1_f128 - /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* The "Write OUTput" generators. These generally perform some non-trivial copy of data to TCG globals, or to main memory. The trivial cases are --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031234; cv=none; d=zohomail.com; s=zohoarc; b=OFAjIggIv9c7/gZNqmSJRsw6p9gl2antSwBnKXYZUsJeUkITnWtFmuZZVu/VSI/GGpaK7Dge5Opk2rnUo1YasV/6egoV4+mPG4WRJt+29ZxGeZXGBbaZmYRWeJRCTUTTJTq2F1JIhcqZ8aVCYrmgfW1dTe8fdsKBYnacbvyoA30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031234; h=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=oHRTL85XxJgPRvE/Ju5GyJ2XKuGglMdx9+z41yApVOM=; b=aBd5qkQ4Pakwulc3aK7UtMfZOkygcztutzsH8Y8aQ2bBpTBGNDwZxmmITAuMXJKsmbXm1I0pFv9yHe6LrGpn1LO5Y9o8OKvry66eyKz/F6djjnXRC21s1ACJf2YRtOR744dIKHr5KXxkal+hqVM97Tys6tPxJ/UBk6fjdXBDxsM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16860312345185.300113680024879; Mon, 5 Jun 2023 23:00:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgX-0004r5-Vr; Tue, 06 Jun 2023 01:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgU-0004pT-5n for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgS-00049S-Od for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-394-qrDlsnTMN-ycycoVnZJsdg-1; Tue, 06 Jun 2023 01:56:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7A3085A5A8; Tue, 6 Jun 2023 05:56:38 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98D9A2166B25; Tue, 6 Jun 2023 05:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oHRTL85XxJgPRvE/Ju5GyJ2XKuGglMdx9+z41yApVOM=; b=hryitKvlvoaHUQG8qXEsVGLlc4sGic096pqmURpYZfSy9nk1n61GMyATca1vvGd+snMQ4C roLhiBrOlDGDxBQMpsjRDnllVT9AWNJ0AleMwy48UJx/HaAhZkc3L3OZcZWJtx01EYPsKx 3E5ORW+o2vf96GhsCvBNM2ZLqMDO3IU= X-MC-Unique: qrDlsnTMN-ycycoVnZJsdg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , qemu-stable@nongnu.org, David Hildenbrand Subject: [PULL 09/18] tests/tcg/s390x: Test MXDB and MXDBR Date: Tue, 6 Jun 2023 07:56:12 +0200 Message-Id: <20230606055621.523175-10-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031236225100001 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Add a small test to prevent regressions. Cc: qemu-stable@nongnu.org Signed-off-by: Ilya Leoshkevich Message-Id: <20230601223027.795501-3-iii@linux.ibm.com> Acked-by: David Hildenbrand Signed-off-by: Thomas Huth --- tests/tcg/s390x/mxdb.c | 30 ++++++++++++++++++++++++++++++ tests/tcg/s390x/Makefile.target | 1 + 2 files changed, 31 insertions(+) create mode 100644 tests/tcg/s390x/mxdb.c diff --git a/tests/tcg/s390x/mxdb.c b/tests/tcg/s390x/mxdb.c new file mode 100644 index 0000000000..ae922559d3 --- /dev/null +++ b/tests/tcg/s390x/mxdb.c @@ -0,0 +1,30 @@ +/* + * Test the MXDB and MXDBR instructions. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include + +int main(void) +{ + union { + double d[2]; + long double ld; + } a; + double b; + + a.d[0] =3D 1.2345; + a.d[1] =3D 999; + b =3D 6.789; + asm("mxdb %[a],%[b]" : [a] "+f" (a.ld) : [b] "R" (b)); + assert(a.ld > 8.38 && a.ld < 8.39); + + a.d[0] =3D 1.2345; + a.d[1] =3D 999; + b =3D 6.789; + asm("mxdbr %[a],%[b]" : [a] "+f" (a.ld) : [b] "f" (b)); + assert(a.ld > 8.38 && a.ld < 8.39); + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.tar= get index a2a15c4a23..85abfbb98c 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -35,6 +35,7 @@ TESTS+=3Dchrl TESTS+=3Drxsbg TESTS+=3Dex-relative-long TESTS+=3Dex-branch +TESTS+=3Dmxdb =20 cdsg: CFLAGS+=3D-pthread cdsg: LDFLAGS+=3D-pthread --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031176; cv=none; d=zohomail.com; s=zohoarc; b=hkEXUp5lA+Px+Enj7ai9NzC2CxaMtFZ6QvYkmuTxgQG86B4MHYjH05Cyd+pC9acuO9i18L23xIGboMuVGbEEziVWjkHY45bGn2Y9/7prSF7zr7GVL/WatX8R3yqnU5eBBnGBEwTVtPjWl917hAxL/1zEh6ZBPq/Lc6WVjWnyF3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031176; h=Content-Transfer-Encoding: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=IKXW/UQDNfReYaz1XirYDzrJor/YRoWCcj7/j927cPE=; b=lUDYENHR41sSxCbFbEA+ygo55wy8KweWEVSviniMv4mDwVBBEKH6jf56nWgx23kgFHNaZ+QA4+oVkKHCBsSfofX2zPO/KklGKs+sKNQl+qjPXx3CIgBrLzoOes06lNYz9rJzq18CLU9mwHoHkVNg7mlzWZVHK8aGGmzR7QgRBzc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031176574989.2645523536065; Mon, 5 Jun 2023 22:59:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgW-0004pq-0D; Tue, 06 Jun 2023 01:56:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgT-0004pL-Os for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgS-00049K-9q for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-190-zKI-Z6RENB-iewVF_voc8Q-1; Tue, 06 Jun 2023 01:56:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E9640811E7C; Tue, 6 Jun 2023 05:56:39 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33D062166B25; Tue, 6 Jun 2023 05:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IKXW/UQDNfReYaz1XirYDzrJor/YRoWCcj7/j927cPE=; b=SVaCnBGwkF/yxKPkj221eg3eAEawfi8gLLK0PgoBPP210HpOuha/vP4Td9QoyNuvcqxwzo PwfqNYrEStA8TgrrS54q8cDkr6kr2zWpK/9G7nuIjq6d6//juTG28XdcaVx2n+e+onW6fQ CFeiej/73I+Ev3VS8WUVzNzrEgoH4rA= X-MC-Unique: zKI-Z6RENB-iewVF_voc8Q-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Subject: [PULL 10/18] tests/qtest: Run ipmi-bt-test only if CONFIG_IPMI_EXTERN is set Date: Tue, 6 Jun 2023 07:56:13 +0200 Message-Id: <20230606055621.523175-11-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031178680100007 Content-Type: text/plain; charset="utf-8" The ipmi-bt-test uses "-device ipmi-bmc-extern", thus it should only be run if this device has been enabled in the configuration. Message-Id: <20230524081024.1619273-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/qtest/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 087f2dc9d7..1d8a53a669 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -49,7 +49,8 @@ qtests_i386 =3D \ (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) += \ (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] := []) + \ (config_host.has_key('CONFIG_LINUX') and = \ - config_all_devices.has_key('CONFIG_ISA_IPMI_BT') ? ['ipmi-bt-test'] : [= ]) + \ + config_all_devices.has_key('CONFIG_ISA_IPMI_BT') and + config_all_devices.has_key('CONFIG_IPMI_EXTERN') ? ['ipmi-bt-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_PVPANIC_ISA') ? ['pvpanic-test'] : [= ]) + \ (config_all_devices.has_key('CONFIG_PVPANIC_PCI') ? ['pvpanic-pci-test']= : []) + \ --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031235; cv=none; d=zohomail.com; s=zohoarc; b=QHFCw+LPtU7kK2Nh7tgqUniyPbwopO7LOkGfRf5u8ul69anazCfZLj8Fhwegt5y/BJ8wGIg2GIY3SJHCeJl/R6gkGvub11v4F+XO3WcETUECGrIdFdijy/8avBs8TOb2diZja/VVIPOnL0Wk9d2+gaFnwFIS8951I41MCAS8Uzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031235; 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=+uQwwPtz4DspYHNqIHFxsjZmiGzLxYPAFBsB9XPFdB0=; b=AcntwWmn1IET4xflEx24DqqrshFNdOz5BTQlI0iXksGFrISXJaqZ81urnSXOGDcwIXrcgLZGnSvZ078TMb7mCiSyDGfwZLkcWBUI3RbetVLFHszwZecR57N8x7CP1g1Z83Jo9qOR+Kz0B6c0QellYbSupSouWmjIFF18Imq0+PE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031235845931.2950182029581; Mon, 5 Jun 2023 23:00:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6PgX-0004qp-3P; Tue, 06 Jun 2023 01:56:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgV-0004ph-5B for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgT-00049t-Jy for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:46 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-462-BzPKCGcIMn605upAgrnjfw-1; Tue, 06 Jun 2023 01:56:41 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F2A9801182; Tue, 6 Jun 2023 05:56:41 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 523DD2166B25; Tue, 6 Jun 2023 05:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031005; 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=+uQwwPtz4DspYHNqIHFxsjZmiGzLxYPAFBsB9XPFdB0=; b=KKWEnpIhwVpSvlrDDzcrKVJeSzDWc2OoQ1WDMQVnMBwJUXAGJ+2aBPcrQjrh1gwULy9qjV 0Xp9EKJLXJ7lqfWzPlUpNa9U7f9Yv0LKf++DFnn11XCpnK35zIuEwBfKBfSTns5wcaTuWC fgIsxJyBMMFEdEHzZ9PqPdlPqC7XyTQ= X-MC-Unique: BzPKCGcIMn605upAgrnjfw-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Camilla Conte , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 11/18] gitlab-ci: Remove unused Python package Date: Tue, 6 Jun 2023 07:56:14 +0200 Message-Id: <20230606055621.523175-12-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031237321100005 From: Camilla Conte Python should have been removed in this commit: https://gitlab.com/qemu-project/qemu/-/commit/94b8b146df84ba472f461398d93fb= 9cdf0db8f94 Signed-off-by: Camilla Conte Message-Id: <20230531150824.32349-2-cconte@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Thomas Huth --- .gitlab-ci.d/container-template.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.d/container-template.yml b/.gitlab-ci.d/container-t= emplate.yml index 8c1370b8f0..77aa839e9e 100644 --- a/.gitlab-ci.d/container-template.yml +++ b/.gitlab-ci.d/container-template.yml @@ -7,7 +7,6 @@ before_script: - export TAG=3D"$CI_REGISTRY_IMAGE/qemu/$NAME:latest" - export COMMON_TAG=3D"$CI_REGISTRY/qemu-project/qemu/qemu/$NAME:lates= t" - - apk add python3 - docker login $CI_REGISTRY -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PA= SSWORD" - until docker info; do sleep 1; done script: --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031142; cv=none; d=zohomail.com; s=zohoarc; b=OqJdQjzHuoYO+TrNoNDrEihU8whm5bMGBzwGVd4O/1Ux3XM4nSKu1blSVWMcyuYJm7mVgjMXP85UDICC+8tXDDUKGw6AxCzaynUGF+gG+/syeYpqdBfdZC6YK6CzKwT7k/9KSay75hXJvXNec1qmfXgsXg2nyLjddtF7rRbrVo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031142; h=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=huSfNPp8zg1hWlnqaPD+jP2ndtJPMzf8twEx+oT9Jq0=; b=TjJUrSmKHv91Bzbb1ZSSHp46BKB1MlIQF0fEC+b2Ejl9qYj+My8SHABAlVO57FaJFAk9JfeqW9caDbfzaMFTnaNaEZJqHyy5mU4gPCpjZZ9vLMClvydgouSZ0KS0K4IRStdV2F5DM5z8LAhHDvHew84YHXe1f0x+T5YXm9YStCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031142636532.5054842151469; Mon, 5 Jun 2023 22:59:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pgc-0004sK-Bq; Tue, 06 Jun 2023 01:56:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgY-0004rR-Dz for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgX-0004Aq-07 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-308-rVESNpixNHq7QWTLAYgdZw-1; Tue, 06 Jun 2023 01:56:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C955E185A78E; Tue, 6 Jun 2023 05:56:42 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABA4C2166B25; Tue, 6 Jun 2023 05:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=huSfNPp8zg1hWlnqaPD+jP2ndtJPMzf8twEx+oT9Jq0=; b=WNi+dIZveBOGNem7bzNN2p5q6DonwFyqn8VmHH9tF/iM7lOrhkI6Uc8xhICaSP7u5XiA9E fEEEFJY5oDprZCbB6Yjjl+uSWTX9UK2GpCJYfapXVAqHG7LVjO6orWVMsifhDJmQqmVJ+2 n3ava4qmmSvQM6/YoJ03DH+kxyJdwK4= X-MC-Unique: rVESNpixNHq7QWTLAYgdZw-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: qemu-stable@nongnu.org, Peter Maydell Subject: [PULL 12/18] hw/mips/malta: Fix the malta machine on big endian hosts Date: Tue, 6 Jun 2023 07:56:15 +0200 Message-Id: <20230606055621.523175-13-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031144285100003 Content-Type: text/plain; charset="utf-8" Booting a Linux kernel with the malta machine is currently broken on big endian hosts. The cpu_to_gt32 macro wants to byteswap a value for little endian targets only, but uses the wrong way to do this: cpu_to_[lb]e32 works the other way round on big endian hosts! Fix it by using the same ways on both, big and little endian hosts. Fixes: 0c8427baf0 ("hw/mips/malta: Use bootloader helper to set BAR registe= rs") Cc: qemu-stable@nongnu.org Message-Id: <20230330152613.232082-1-thuth@redhat.com> Reviewed-by: Peter Maydell Signed-off-by: Thomas Huth --- hw/mips/malta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index e3be2eea56..47cb49f691 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -629,9 +629,9 @@ static void bl_setup_gt64120_jump_kernel(void **p, uint= 64_t run_addr, =20 /* Bus endianess is always reversed */ #if TARGET_BIG_ENDIAN -#define cpu_to_gt32 cpu_to_le32 +#define cpu_to_gt32(x) (x) #else -#define cpu_to_gt32 cpu_to_be32 +#define cpu_to_gt32(x) bswap32(x) #endif =20 /* setup MEM-to-PCI0 mapping as done by YAMON */ --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031210; cv=none; d=zohomail.com; s=zohoarc; b=MzrQtCqCQH9+W4mGiIgT3yiEKpL6D4HamLH6SV8DZcqGkbbTyaKrSBcZfCysn5ZvXRpCy3bJB6r/Gl+0cn2zHf/s4+F34QBtVNjFqBtlEmdvfzeLXEK49Dfi6Bw3HdlM9hANtyUttBHsVWrCQUGvvXc5UyGYv9dvA6ILAlEMYWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031210; 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=DMQO0TnJoS6hEZikAOD2aAaF6PaDGIaaThsJFz5o7vI=; b=S9AGDo3t72jYKuK8as4qzm88stUAXmetNwNeXjTpNcQ+jP3ArFlehvqF2wP02DoGTJulTHLuwLxAXS1+fJ5HmiXeWKEmukCIZFknhy5NIIG27CDNNxL5fi14nTx9oOkZrt8hNyhav85xr7QqA1MyZlurJjDaRC5Xh69EWPbahgE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031210868947.1012656103852; Mon, 5 Jun 2023 23:00:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pga-0004rq-3h; Tue, 06 Jun 2023 01:56:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgY-0004r9-6D for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgW-0004Ag-HM for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:49 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-1xvoFSsmMW2PJEnt90HCkQ-1; Tue, 06 Jun 2023 01:56:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C84585A5AA; Tue, 6 Jun 2023 05:56:44 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 249712166B25; Tue, 6 Jun 2023 05:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031007; 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=DMQO0TnJoS6hEZikAOD2aAaF6PaDGIaaThsJFz5o7vI=; b=MsNbc7p3/Hgv+wM7PY220sJ64QbuzPyFck7KZVFWdZ69Lyte/Or68UJrpLx1l9ylW+zW2B RTGjxMWq5b3jiJ7JhLN24ufgv8yFbuNaErc5bYRDMWu6o6tihMgnt7X5JTL5HkKlzhoCFz Wcup+w73j8wn9bXlTca604ZMslge7rg= X-MC-Unique: 1xvoFSsmMW2PJEnt90HCkQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster Subject: [PULL 13/18] scripts: Add qom-cast-macro-clean-cocci-gen.py Date: Tue, 6 Jun 2023 07:56:16 +0200 Message-Id: <20230606055621.523175-14-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031212008100002 From: Philippe Mathieu-Daud=C3=A9 Add a script to generate Coccinelle semantic patch removing all pointless QOM cast macro uses. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230601093452.38972-2-philmd@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth --- MAINTAINERS | 1 + scripts/qom-cast-macro-clean-cocci-gen.py | 49 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 scripts/qom-cast-macro-clean-cocci-gen.py diff --git a/MAINTAINERS b/MAINTAINERS index 89f274f85e..b2137111f1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3045,6 +3045,7 @@ F: include/qom/ F: qapi/qom.json F: qapi/qdev.json F: scripts/coccinelle/qom-parent-type.cocci +F: scripts/qom-cast-macro-clean-cocci-gen.py F: softmmu/qdev-monitor.c F: stubs/qdev.c F: qom/ diff --git a/scripts/qom-cast-macro-clean-cocci-gen.py b/scripts/qom-cast-m= acro-clean-cocci-gen.py new file mode 100644 index 0000000000..2fa8438a14 --- /dev/null +++ b/scripts/qom-cast-macro-clean-cocci-gen.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# +# Generate a Coccinelle semantic patch to remove pointless QOM cast. +# +# Usage: +# +# $ qom-cast-macro-clean-cocci-gen.py $(git ls-files) > qom_pointless_cast= .cocci +# $ spatch \ +# --macro-file scripts/cocci-macro-file.h \ +# --sp-file qom_pointless_cast.cocci \ +# --keep-comments \ +# --use-gitgrep \ +# --in-place \ +# --dir . +# +# SPDX-FileContributor: Philippe Mathieu-Daud=C3=A9 +# SPDX-FileCopyrightText: 2023 Linaro Ltd. +# SPDX-License-Identifier: GPL-2.0-or-later + +import re +import sys + +assert len(sys.argv) > 0 + +def print_cocci_rule(qom_typedef, qom_cast_macro): + print(f'''@@ +typedef {qom_typedef}; +{qom_typedef} *obj; +@@ +- {qom_cast_macro}(obj) ++ obj +''') + +patterns =3D [ + r'DECLARE_INSTANCE_CHECKER\((\w+),\W*(\w+),\W*TYPE_\w+\)', + r'DECLARE_OBJ_CHECKERS\((\w+),\W*\w+,\W*(\w+),\W*TYPE_\w+\)', + r'OBJECT_DECLARE_TYPE\((\w+),\W*\w+,\W*(\w+)\)', + r'OBJECT_DECLARE_SIMPLE_TYPE\((\w+),\W*(\w+)\)', + r'INTERFACE_CHECK\((\w+),\W*\(\w+\),\W*TYPE_(\w+)\)', +] + +for fn in sys.argv[1:]: + try: + content =3D open(fn, 'rt').read() + except: + continue + for pattern in patterns: + for match in re.findall(pattern, content): + print_cocci_rule(match[0], match[1]) --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031201; cv=none; d=zohomail.com; s=zohoarc; b=RCuGqaH9spnEKaaxuWqMCzODWefk9dwD5QhyDgqlFpb6e9VgUpFOxbXCBe6hVGNRlAMNjzPcTPLjLBSY8/13eMd1HZmycsSRACtHMXE+SyoYYkRNF91tcW0kA6KFjSD96ZrwBWCcodydHsz0IY9+m0sKtdYLC5XGUtOWaMRAGSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031201; 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=rGsdDiQMWD86wwm5do/HlURnSAwxjW7zKAQYq21KywQ=; b=bmf35STNGKrVAKHldPQ99TWfJXMWcEKgS3xJIMtpiJGQQWyfLa/hzdZqzgvNWMdW48ll6nkL0PIEs1fmRRWuBgkCUIxdG+x0SiqZCMF13GDRTPDEEXa0MlkXpsInX5NL1UGJWndVWV4iz5hqCr7c3LJVvxXzfRl7Gb8azJ0rZEg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031201924351.30477423968307; Mon, 5 Jun 2023 23:00:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pge-0004sp-4w; Tue, 06 Jun 2023 01:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgb-0004sD-T3 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6PgY-0004B7-8e for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-358-6nLh-E18MmCBVNwLSr8UZA-1; Tue, 06 Jun 2023 01:56:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9250811E7C; Tue, 6 Jun 2023 05:56:45 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CAE12166B25; Tue, 6 Jun 2023 05:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031009; 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=rGsdDiQMWD86wwm5do/HlURnSAwxjW7zKAQYq21KywQ=; b=L/kp+vW36ac94CXkw9p/d5ccfCdFk79LbjG9uKsaZJOAxtuQ63k/keGA3n2SG+pqYkjVYT I2XiagCY4svVmuENONoLJzAlsqCnEzgYGKWA+MXa5NkhXxWbi5RQvC3BALSLCGqvoW/Bzl 5lLnqvDTlMqocYp1Um9DCX8WCCeSU0s= X-MC-Unique: 6nLh-E18MmCBVNwLSr8UZA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster Subject: [PULL 14/18] bulk: Remove pointless QOM casts Date: Tue, 6 Jun 2023 07:56:17 +0200 Message-Id: <20230606055621.523175-15-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031204195100007 From: Philippe Mathieu-Daud=C3=A9 Mechanical change running Coccinelle spatch with content generated from the qom-cast-macro-clean-cocci-gen.py added in the previous commit. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230601093452.38972-3-philmd@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth --- block/nbd.c | 4 ++-- chardev/char-pty.c | 2 +- hw/arm/musicpal.c | 2 +- hw/arm/xlnx-versal.c | 2 +- hw/display/vhost-user-gpu.c | 4 ++-- hw/intc/loongarch_extioi.c | 6 +++--- hw/m68k/q800.c | 2 +- hw/pci-host/bonito.c | 2 +- hw/ppc/pnv_lpc.c | 2 +- hw/ppc/pnv_occ.c | 2 +- hw/ppc/pnv_sbe.c | 2 +- hw/riscv/virt.c | 10 +++++----- hw/rx/rx62n.c | 2 +- hw/scsi/esp-pci.c | 18 +++++++++--------- hw/sparc/sun4m.c | 4 ++-- hw/virtio/virtio-mem-pci.c | 6 +++--- hw/virtio/virtio-pmem-pci.c | 6 +++--- migration/fd.c | 4 ++-- migration/multifd.c | 2 +- migration/yank_functions.c | 4 ++-- nbd/client-connection.c | 2 +- nbd/server.c | 2 +- softmmu/qdev-monitor.c | 2 +- ui/vnc-ws.c | 6 +++--- 24 files changed, 49 insertions(+), 49 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index a3f8f8a9d5..5aef5cb6bd 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -397,7 +397,7 @@ static void coroutine_fn GRAPH_RDLOCK nbd_reconnect_att= empt(BDRVNBDState *s) =20 /* Finalize previous connection if any */ if (s->ioc) { - qio_channel_detach_aio_context(QIO_CHANNEL(s->ioc)); + qio_channel_detach_aio_context(s->ioc); yank_unregister_function(BLOCKDEV_YANK_INSTANCE(s->bs->node_name), nbd_yank, s->bs); object_unref(OBJECT(s->ioc)); @@ -1455,7 +1455,7 @@ static void nbd_yank(void *opaque) BDRVNBDState *s =3D (BDRVNBDState *)bs->opaque; =20 QEMU_LOCK_GUARD(&s->requests_lock); - qio_channel_shutdown(QIO_CHANNEL(s->ioc), QIO_CHANNEL_SHUTDOWN_BOTH, N= ULL); + qio_channel_shutdown(s->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL); s->state =3D NBD_CLIENT_QUIT; } =20 diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 92fd33c854..4e5deac18a 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -334,7 +334,7 @@ static void char_pty_open(Chardev *chr, s =3D PTY_CHARDEV(chr); s->ioc =3D QIO_CHANNEL(qio_channel_file_new_fd(master_fd)); name =3D g_strdup_printf("chardev-pty-%s", chr->label); - qio_channel_set_name(QIO_CHANNEL(s->ioc), name); + qio_channel_set_name(s->ioc, name); g_free(name); s->timer_src =3D NULL; *be_opened =3D false; diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 58f3d30c9b..dc4e43e0ee 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -1250,7 +1250,7 @@ static void musicpal_init(MachineState *machine) uart_orgate =3D DEVICE(object_new(TYPE_OR_IRQ)); object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fa= tal); qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); - qdev_connect_gpio_out(DEVICE(uart_orgate), 0, + qdev_connect_gpio_out(uart_orgate, 0, qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ)); =20 serial_mm_init(address_space_mem, MP_UART1_BASE, 2, diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 69b1b99e93..db1e0dee6e 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -327,7 +327,7 @@ static void versal_create_rtc(Versal *s, qemu_irq *pic) object_initialize_child(OBJECT(s), "rtc", &s->pmc.rtc, TYPE_XLNX_ZYNQMP_RTC); sbd =3D SYS_BUS_DEVICE(&s->pmc.rtc); - sysbus_realize(SYS_BUS_DEVICE(sbd), &error_fatal); + sysbus_realize(sbd, &error_fatal); =20 mr =3D sysbus_mmio_get_region(sbd, 0); memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr); diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 71dfd956b8..1386e869e5 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -364,11 +364,11 @@ vhost_user_gpu_gl_flushed(VirtIOGPUBase *b) VhostUserGPU *g =3D VHOST_USER_GPU(b); =20 if (g->backend_blocked) { - vhost_user_gpu_unblock(VHOST_USER_GPU(g)); + vhost_user_gpu_unblock(g); g->backend_blocked =3D false; } =20 - vhost_user_gpu_update_blocked(VHOST_USER_GPU(g), false); + vhost_user_gpu_update_blocked(g, false); } =20 static bool diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c index 0e7a3e32f3..af75460643 100644 --- a/hw/intc/loongarch_extioi.c +++ b/hw/intc/loongarch_extioi.c @@ -276,7 +276,7 @@ static void loongarch_extioi_instance_init(Object *obj) int i, cpu, pin; =20 for (i =3D 0; i < EXTIOI_IRQS; i++) { - sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq[i]); + sysbus_init_irq(dev, &s->irq[i]); } =20 qdev_init_gpio_in(DEVICE(obj), extioi_setirq, EXTIOI_IRQS); @@ -284,14 +284,14 @@ static void loongarch_extioi_instance_init(Object *ob= j) for (cpu =3D 0; cpu < EXTIOI_CPUS; cpu++) { memory_region_init_io(&s->extioi_iocsr_mem[cpu], OBJECT(s), &extio= i_ops, s, "extioi_iocsr", 0x900); - sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->extioi_iocsr_mem[cpu]); + sysbus_init_mmio(dev, &s->extioi_iocsr_mem[cpu]); for (pin =3D 0; pin < LS3A_INTC_IP; pin++) { qdev_init_gpio_out(DEVICE(obj), &s->parent_irq[cpu][pin], 1); } } memory_region_init_io(&s->extioi_system_mem, OBJECT(s), &extioi_ops, s, "extioi_system_mem", 0x900); - sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->extioi_system_mem); + sysbus_init_mmio(dev, &s->extioi_system_mem); } =20 static void loongarch_extioi_class_init(ObjectClass *klass, void *data) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index b35ecafbc7..68f0cd8cac 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -525,7 +525,7 @@ static void q800_init(MachineState *machine) qdev_realize_and_unref(escc_orgate, NULL, &error_fatal); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(escc_orgate, 0)); sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(escc_orgate, 1)); - qdev_connect_gpio_out(DEVICE(escc_orgate), 0, + qdev_connect_gpio_out(escc_orgate, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_ESCC)); sysbus_mmio_map(sysbus, 0, SCC_BASE); =20 diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 1cf25bab8d..4701481b9b 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -656,7 +656,7 @@ static void bonito_pci_realize(PCIDevice *dev, Error **= errp) PCIBonitoState *s =3D PCI_BONITO(dev); SysBusDevice *sysbus =3D SYS_BUS_DEVICE(s->pcihost); PCIHostState *phb =3D PCI_HOST_BRIDGE(s->pcihost); - BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(s->pcihost); + BonitoState *bs =3D s->pcihost; MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); =20 /* diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c index 605d390861..d692858bee 100644 --- a/hw/ppc/pnv_lpc.c +++ b/hw/ppc/pnv_lpc.c @@ -744,7 +744,7 @@ static void pnv_lpc_realize(DeviceState *dev, Error **e= rrp) memory_region_add_subregion(&lpc->opb_mr, LPC_HC_REGS_OPB_ADDR, &lpc->lpc_hc_regs); =20 - qdev_init_gpio_out(DEVICE(dev), &lpc->psi_irq, 1); + qdev_init_gpio_out(dev, &lpc->psi_irq, 1); } =20 static void pnv_lpc_class_init(ObjectClass *klass, void *data) diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c index 9fa6d91d31..48123ceae1 100644 --- a/hw/ppc/pnv_occ.c +++ b/hw/ppc/pnv_occ.c @@ -278,7 +278,7 @@ static void pnv_occ_realize(DeviceState *dev, Error **e= rrp) occ, "occ-common-area", PNV_OCC_SENSOR_DATA_BLOCK_SIZE); =20 - qdev_init_gpio_out(DEVICE(dev), &occ->psi_irq, 1); + qdev_init_gpio_out(dev, &occ->psi_irq, 1); } =20 static void pnv_occ_class_init(ObjectClass *klass, void *data) diff --git a/hw/ppc/pnv_sbe.c b/hw/ppc/pnv_sbe.c index 1c7812a135..74cee4eea7 100644 --- a/hw/ppc/pnv_sbe.c +++ b/hw/ppc/pnv_sbe.c @@ -381,7 +381,7 @@ static void pnv_sbe_realize(DeviceState *dev, Error **e= rrp) psc->xscom_mbox_ops, sbe, "xscom-sbe-mbox", psc->xscom_mbox_size); =20 - qdev_init_gpio_out(DEVICE(dev), &sbe->psi_irq, 1); + qdev_init_gpio_out(dev, &sbe->psi_irq, 1); =20 sbe->timer =3D timer_new_us(QEMU_CLOCK_VIRTUAL, sbe_timer, sbe); } diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 4e3efbee16..245c7b97b2 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1488,7 +1488,7 @@ static void virt_machine_init(MachineState *machine) for (i =3D 0; i < VIRTIO_COUNT; i++) { sysbus_create_simple("virtio-mmio", memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size, - qdev_get_gpio_in(DEVICE(virtio_irqchip), VIRTIO_IRQ + i)); + qdev_get_gpio_in(virtio_irqchip, VIRTIO_IRQ + i)); } =20 gpex_pcie_init(system_memory, @@ -1499,16 +1499,16 @@ static void virt_machine_init(MachineState *machine) virt_high_pcie_memmap.base, virt_high_pcie_memmap.size, memmap[VIRT_PCIE_PIO].base, - DEVICE(pcie_irqchip)); + pcie_irqchip); =20 - create_platform_bus(s, DEVICE(mmio_irqchip)); + create_platform_bus(s, mmio_irqchip); =20 serial_mm_init(system_memory, memmap[VIRT_UART0].base, - 0, qdev_get_gpio_in(DEVICE(mmio_irqchip), UART0_IRQ), 399193, + 0, qdev_get_gpio_in(mmio_irqchip, UART0_IRQ), 399193, serial_hd(0), DEVICE_LITTLE_ENDIAN); =20 sysbus_create_simple("goldfish_rtc", memmap[VIRT_RTC].base, - qdev_get_gpio_in(DEVICE(mmio_irqchip), RTC_IRQ)); + qdev_get_gpio_in(mmio_irqchip, RTC_IRQ)); =20 virt_flash_create(s); =20 diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c index fa5add9f9d..3e887a0fc7 100644 --- a/hw/rx/rx62n.c +++ b/hw/rx/rx62n.c @@ -154,7 +154,7 @@ static void register_icu(RX62NState *s) sysbus_connect_irq(icu, 0, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_IR= Q)); sysbus_connect_irq(icu, 1, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_FI= R)); sysbus_connect_irq(icu, 2, s->irq[SWI]); - sysbus_mmio_map(SYS_BUS_DEVICE(icu), 0, RX62N_ICU_BASE); + sysbus_mmio_map(icu, 0, RX62N_ICU_BASE); } =20 static void register_tmr(RX62NState *s, int unit) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 2f7f11e70b..4e890db0e2 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -79,7 +79,7 @@ struct PCIESPState { =20 static void esp_pci_handle_idle(PCIESPState *pci, uint32_t val) { - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 trace_esp_pci_dma_idle(val); esp_dma_enable(s, 0, 0); @@ -93,7 +93,7 @@ static void esp_pci_handle_blast(PCIESPState *pci, uint32= _t val) =20 static void esp_pci_handle_abort(PCIESPState *pci, uint32_t val) { - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 trace_esp_pci_dma_abort(val); if (s->current_req) { @@ -103,7 +103,7 @@ static void esp_pci_handle_abort(PCIESPState *pci, uint= 32_t val) =20 static void esp_pci_handle_start(PCIESPState *pci, uint32_t val) { - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 trace_esp_pci_dma_start(val); =20 @@ -161,7 +161,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_= t saddr, uint32_t val) =20 static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr) { - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; uint32_t val; =20 val =3D pci->dma_regs[saddr]; @@ -183,7 +183,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr, uint64_t val, unsigned int size) { PCIESPState *pci =3D opaque; - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 if (size < 4 || addr & 3) { /* need to upgrade request: we only support 4-bytes accesses */ @@ -228,7 +228,7 @@ static uint64_t esp_pci_io_read(void *opaque, hwaddr ad= dr, unsigned int size) { PCIESPState *pci =3D opaque; - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; uint32_t ret; =20 if (addr < 0x40) { @@ -315,7 +315,7 @@ static const MemoryRegionOps esp_pci_io_ops =3D { static void esp_pci_hard_reset(DeviceState *dev) { PCIESPState *pci =3D PCI_ESP(dev); - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 esp_hard_reset(s); pci->dma_regs[DMA_CMD] &=3D ~(DMA_CMD_DIR | DMA_CMD_INTE_D | DMA_CMD_I= NTE_P @@ -366,7 +366,7 @@ static void esp_pci_scsi_realize(PCIDevice *dev, Error = **errp) { PCIESPState *pci =3D PCI_ESP(dev); DeviceState *d =3D DEVICE(dev); - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; uint8_t *pci_conf; =20 if (!qdev_realize(DEVICE(s), NULL, errp)) { @@ -394,7 +394,7 @@ static void esp_pci_scsi_realize(PCIDevice *dev, Error = **errp) static void esp_pci_scsi_exit(PCIDevice *d) { PCIESPState *pci =3D PCI_ESP(d); - ESPState *s =3D ESP(&pci->esp); + ESPState *s =3D &pci->esp; =20 qemu_free_irq(s->irq); } diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index d9288326d6..17bf5f2879 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -982,7 +982,7 @@ static void sun4m_hw_init(MachineState *machine) qdev_realize_and_unref(ms_kb_orgate, NULL, &error_fatal); sysbus_connect_irq(s, 0, qdev_get_gpio_in(ms_kb_orgate, 0)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(ms_kb_orgate, 1)); - qdev_connect_gpio_out(DEVICE(ms_kb_orgate), 0, slavio_irq[14]); + qdev_connect_gpio_out(ms_kb_orgate, 0, slavio_irq[14]); =20 dev =3D qdev_new(TYPE_ESCC); qdev_prop_set_uint32(dev, "disabled", 0); @@ -1004,7 +1004,7 @@ static void sun4m_hw_init(MachineState *machine) qdev_realize_and_unref(serial_orgate, NULL, &error_fatal); sysbus_connect_irq(s, 0, qdev_get_gpio_in(serial_orgate, 0)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(serial_orgate, 1)); - qdev_connect_gpio_out(DEVICE(serial_orgate), 0, slavio_irq[15]); + qdev_connect_gpio_out(serial_orgate, 0, slavio_irq[15]); =20 if (hwdef->apc_base) { apc_init(hwdef->apc_base, qemu_allocate_irq(cpu_halt_signal, NULL,= 0)); diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index e8c338c5d9..b85c12668d 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -42,7 +42,7 @@ static MemoryRegion *virtio_mem_pci_get_memory_region(Mem= oryDeviceState *md, Error **errp) { VirtIOMEMPCI *pci_mem =3D VIRTIO_MEM_PCI(md); - VirtIOMEM *vmem =3D VIRTIO_MEM(&pci_mem->vdev); + VirtIOMEM *vmem =3D &pci_mem->vdev; VirtIOMEMClass *vmc =3D VIRTIO_MEM_GET_CLASS(vmem); =20 return vmc->get_memory_region(vmem, errp); @@ -60,7 +60,7 @@ static void virtio_mem_pci_fill_device_info(const MemoryD= eviceState *md, { VirtioMEMDeviceInfo *vi =3D g_new0(VirtioMEMDeviceInfo, 1); VirtIOMEMPCI *pci_mem =3D VIRTIO_MEM_PCI(md); - VirtIOMEM *vmem =3D VIRTIO_MEM(&pci_mem->vdev); + VirtIOMEM *vmem =3D &pci_mem->vdev; VirtIOMEMClass *vpc =3D VIRTIO_MEM_GET_CLASS(vmem); DeviceState *dev =3D DEVICE(md); =20 @@ -123,7 +123,7 @@ static void virtio_mem_pci_instance_init(Object *obj) TYPE_VIRTIO_MEM); =20 dev->size_change_notifier.notify =3D virtio_mem_pci_size_change_notify; - vmem =3D VIRTIO_MEM(&dev->vdev); + vmem =3D &dev->vdev; vmc =3D VIRTIO_MEM_GET_CLASS(vmem); /* * We never remove the notifier again, as we expect both devices to diff --git a/hw/virtio/virtio-pmem-pci.c b/hw/virtio/virtio-pmem-pci.c index 1b89ade9d1..197d219204 100644 --- a/hw/virtio/virtio-pmem-pci.c +++ b/hw/virtio/virtio-pmem-pci.c @@ -42,7 +42,7 @@ static MemoryRegion *virtio_pmem_pci_get_memory_region(Me= moryDeviceState *md, Error **errp) { VirtIOPMEMPCI *pci_pmem =3D VIRTIO_PMEM_PCI(md); - VirtIOPMEM *pmem =3D VIRTIO_PMEM(&pci_pmem->vdev); + VirtIOPMEM *pmem =3D &pci_pmem->vdev; VirtIOPMEMClass *vpc =3D VIRTIO_PMEM_GET_CLASS(pmem); =20 return vpc->get_memory_region(pmem, errp); @@ -52,7 +52,7 @@ static uint64_t virtio_pmem_pci_get_plugged_size(const Me= moryDeviceState *md, Error **errp) { VirtIOPMEMPCI *pci_pmem =3D VIRTIO_PMEM_PCI(md); - VirtIOPMEM *pmem =3D VIRTIO_PMEM(&pci_pmem->vdev); + VirtIOPMEM *pmem =3D &pci_pmem->vdev; VirtIOPMEMClass *vpc =3D VIRTIO_PMEM_GET_CLASS(pmem); MemoryRegion *mr =3D vpc->get_memory_region(pmem, errp); =20 @@ -65,7 +65,7 @@ static void virtio_pmem_pci_fill_device_info(const Memory= DeviceState *md, { VirtioPMEMDeviceInfo *vi =3D g_new0(VirtioPMEMDeviceInfo, 1); VirtIOPMEMPCI *pci_pmem =3D VIRTIO_PMEM_PCI(md); - VirtIOPMEM *pmem =3D VIRTIO_PMEM(&pci_pmem->vdev); + VirtIOPMEM *pmem =3D &pci_pmem->vdev; VirtIOPMEMClass *vpc =3D VIRTIO_PMEM_GET_CLASS(pmem); DeviceState *dev =3D DEVICE(md); =20 diff --git a/migration/fd.c b/migration/fd.c index 6f2f50475f..0eb677dcae 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -38,7 +38,7 @@ void fd_start_outgoing_migration(MigrationState *s, const= char *fdname, Error ** return; } =20 - qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-outgoing"); + qio_channel_set_name(ioc, "migration-fd-outgoing"); migration_channel_connect(s, ioc, NULL, NULL); object_unref(OBJECT(ioc)); } @@ -68,7 +68,7 @@ void fd_start_incoming_migration(const char *fdname, Erro= r **errp) return; } =20 - qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-incoming"); + qio_channel_set_name(ioc, "migration-fd-incoming"); qio_channel_add_watch_full(ioc, G_IO_IN, fd_accept_incoming_migration, NULL, NULL, diff --git a/migration/multifd.c b/migration/multifd.c index 0bf5958a9c..3387d8277f 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -894,7 +894,7 @@ static void multifd_new_send_channel_async(QIOTask *tas= k, gpointer opaque) =20 trace_multifd_new_send_channel_async(p->id); if (!qio_task_propagate_error(task, &local_err)) { - p->c =3D QIO_CHANNEL(sioc); + p->c =3D sioc; qio_channel_set_delay(p->c, false); p->running =3D true; if (multifd_channel_connect(p, sioc, local_err)) { diff --git a/migration/yank_functions.c b/migration/yank_functions.c index 8c08aef14a..d5a710a3f2 100644 --- a/migration/yank_functions.c +++ b/migration/yank_functions.c @@ -35,7 +35,7 @@ void migration_ioc_register_yank(QIOChannel *ioc) if (migration_ioc_yank_supported(ioc)) { yank_register_function(MIGRATION_YANK_INSTANCE, migration_yank_iochannel, - QIO_CHANNEL(ioc)); + ioc); } } =20 @@ -44,7 +44,7 @@ void migration_ioc_unregister_yank(QIOChannel *ioc) if (migration_ioc_yank_supported(ioc)) { yank_unregister_function(MIGRATION_YANK_INSTANCE, migration_yank_iochannel, - QIO_CHANNEL(ioc)); + ioc); } } =20 diff --git a/nbd/client-connection.c b/nbd/client-connection.c index e5b1046a1c..3d14296c04 100644 --- a/nbd/client-connection.c +++ b/nbd/client-connection.c @@ -156,7 +156,7 @@ static int nbd_connect(QIOChannelSocket *sioc, SocketAd= dress *addr, * channel. */ if (outioc && *outioc) { - qio_channel_close(QIO_CHANNEL(*outioc), NULL); + qio_channel_close(*outioc, NULL); object_unref(OBJECT(*outioc)); *outioc =3D NULL; } else { diff --git a/nbd/server.c b/nbd/server.c index 2664d43bff..febe001a39 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1189,7 +1189,7 @@ static int nbd_negotiate_options(NBDClient *client, E= rror **errp) } ret =3D 0; object_unref(OBJECT(client->ioc)); - client->ioc =3D QIO_CHANNEL(tioc); + client->ioc =3D tioc; break; =20 case NBD_OPT_EXPORT_NAME: diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index b8d2c4dadd..74f4e41338 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -711,7 +711,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *op= ts, goto err_del_dev; } =20 - if (!qdev_realize(DEVICE(dev), bus, errp)) { + if (!qdev_realize(dev, bus, errp)) { goto err_del_dev; } return dev; diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index 6d79f3e5a5..9e3503d93d 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -40,9 +40,9 @@ static void vncws_tls_handshake_done(QIOTask *task, if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); } - vs->ioc_tag =3D qio_channel_add_watch( - QIO_CHANNEL(vs->ioc), G_IO_IN | G_IO_HUP | G_IO_ERR, - vncws_handshake_io, vs, NULL); + vs->ioc_tag =3D qio_channel_add_watch(vs->ioc, + G_IO_IN | G_IO_HUP | G_IO_ERR, + vncws_handshake_io, vs, NULL); } } =20 --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031118; cv=none; d=zohomail.com; s=zohoarc; b=lOKrKkEwu0X+rdCHP2dAFWFRpi1a7R5PAd04RctsOVZKLDQ+rvqx0mc4W1G9aLpJJKp3395sBOX3gPp/gh3fZyCceywyom/s4eQADElYt3XNtKvfbqbgR3UOd7nD1PdN9OMUpFmRHAQEHu6vyijqe/Os1c1xOKUsFnMBBtCkeC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031118; h=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=uX6P3ku7G8vYa9FjFhSZobfFV7qQ9qxxl2iJ328L79g=; b=iNObqdqEveRByq+LDpZJ9yEYoWnZVnjPuD5yoRh5KKGlAQ2jUnySZnKMeyBO4EXofw3aXlxEoHveyZ0vLhj2lJdzJQnEoWAhFZdlEZP4Km7euuwdFQMQjaj1sdoAgW55SPz1ZAN7DEp2GL87BkfGjGqkdnaHcEBsMRI4ikWOGFA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031118970543.4343097066253; Mon, 5 Jun 2023 22:58:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pgf-0004t2-52; Tue, 06 Jun 2023 01:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgd-0004sc-D5 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgb-0004Bp-QY for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:55 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-408-9Sp_-ZW-N_ezEEyrekoO-g-1; Tue, 06 Jun 2023 01:56:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4E27299E745; Tue, 6 Jun 2023 05:56:47 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 304EF2166B25; Tue, 6 Jun 2023 05:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uX6P3ku7G8vYa9FjFhSZobfFV7qQ9qxxl2iJ328L79g=; b=i/pLR1OBP6P6e7kJwUKG13WTv8sfotHKAmv9xWi1SNpkzgbojF6mV5gLaoLpkRuJ0nccjb OnAgNNaQB9k14BSVqq0RPdOL3kVf9Zaw0JuhXqU3eqq3r+4a07tJpV1INtVrY1IOvdzvKe j6HX4Ws+Z3+xn48a2Pn3ET7IhFBgLAM= X-MC-Unique: 9Sp_-ZW-N_ezEEyrekoO-g-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , David Hildenbrand Subject: [PULL 15/18] s390x/tcg: Fix CPU address returned by STIDP Date: Tue, 6 Jun 2023 07:56:18 +0200 Message-Id: <20230606055621.523175-16-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031120117100003 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich In qemu-user-s390x, /proc/cpuinfo contains: processor 0: version =3D 00, identification =3D 000000, machine =3D 8561 processor 1: version =3D 00, identification =3D 400000, machine =3D 8561 The highest nibble is supposed to contain the CPU address, but it's off by 2 bits. Fix the shift value and provide a symbolic constant for it. With the fix we get: processor 0: version =3D 00, identification =3D 000000, machine =3D 8561 processor 1: version =3D 00, identification =3D 100000, machine =3D 8561 Fixes: 076d4d39b65f ("s390x/cpumodel: wire up cpu type + id for TCG") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Message-Id: <20230605113950.1169228-2-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- target/s390x/cpu_models.h | 10 +++++++++- target/s390x/cpu_models.c | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h index fb1adc8b21..cc7305ec21 100644 --- a/target/s390x/cpu_models.h +++ b/target/s390x/cpu_models.h @@ -96,10 +96,18 @@ static inline bool s390_known_cpu_type(uint16_t type) { return s390_get_gen_for_cpu_type(type) !=3D 0; } +#define CPU_ID_SHIFT 32 +#define CPU_ID_BITS 24 +/* + * When cpu_id_format is 0 (basic mode), the leftmost 4 bits of cpu_id con= tain + * the rightmost 4 bits of the physical CPU address. + */ +#define CPU_PHYS_ADDR_BITS 4 +#define CPU_PHYS_ADDR_SHIFT (CPU_ID_SHIFT + CPU_ID_BITS - CPU_PHYS_ADDR_BI= TS) static inline uint64_t s390_cpuid_from_cpu_model(const S390CPUModel *model) { return ((uint64_t)model->cpu_ver << 56) | - ((uint64_t)model->cpu_id << 32) | + ((uint64_t)model->cpu_id << CPU_ID_SHIFT) | ((uint64_t)model->def->type << 16) | (model->def->gen =3D=3D 7 ? 0 : (uint64_t)model->cpu_id_format = << 15); } diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 457b5cb10c..ae8880e81d 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -607,8 +607,8 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) #if !defined(CONFIG_USER_ONLY) cpu->env.cpuid =3D s390_cpuid_from_cpu_model(cpu->model); if (tcg_enabled()) { - /* basic mode, write the cpu address into the first 4 bit of the I= D */ - cpu->env.cpuid =3D deposit64(cpu->env.cpuid, 54, 4, cpu->env.core_= id); + cpu->env.cpuid =3D deposit64(cpu->env.cpuid, CPU_PHYS_ADDR_SHIFT, + CPU_PHYS_ADDR_BITS, cpu->env.core_id); } #endif } --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031120; cv=none; d=zohomail.com; s=zohoarc; b=Rx3Ga3plrILb3KfS7qOeTXaKjQbzhBAC7W28wLgHgdd6v/sIBFxOpebf3TKumG25Gi2xAr2HSzfVb+lZNv0IxmHy16nRMtVsQsfz/DTMawW8YGqwy+klbWCkMYWlaSxuYcOF9NvdEZ5nfyVtOBy/CSswu+JZCGNys8MsEP9E5I4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031120; h=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=iWkaS2fs4a5HyuCggdt4oCmY3Kp+kn9vkKcqb1+h0ZY=; b=i+EHAXf7ULbdgey1HHrq5WQijxBPcn9kh/dhgfhceOdSoWmPtIqJP5dlIAubbHW/4wBl+gFN17yfSjyqL4shJjWYYWfqReSvbJURwmdR3BlipXRzEdtVAyLj7DExc9kWwI0uWiTPpq1/xDmT/fAGcOeQOQIao4ORMObmwbGwGDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031120300580.4502563228028; Mon, 5 Jun 2023 22:58:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pgh-0004tn-0o; Tue, 06 Jun 2023 01:56:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgf-0004t4-E1 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgd-0004CL-V9 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-130-7gNBOiPIN7i6010DdeG0nQ-1; Tue, 06 Jun 2023 01:56:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52E2C85A5AA; Tue, 6 Jun 2023 05:56:49 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C5302166B25; Tue, 6 Jun 2023 05:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iWkaS2fs4a5HyuCggdt4oCmY3Kp+kn9vkKcqb1+h0ZY=; b=bf6ZE9EZ9DnMR2cP6LkYQRBMOYFVxsHeuOdL2X80G2eR6OshLe6mOTMgi2EVLh2zzlVzIr yuQZ3qFwsMZsUkFxbJ/NCOA4nkEYCgQJkUiPPa5PSssUdfS1PZIwkka8SoSf/vM2C4hHXw FNnDBck51CpMqn3fRwNiGi7YBHV4NE8= X-MC-Unique: 7gNBOiPIN7i6010DdeG0nQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , David Hildenbrand Subject: [PULL 16/18] linux-user/elfload: Expose get_elf_hwcap() on s390x Date: Tue, 6 Jun 2023 07:56:19 +0200 Message-Id: <20230606055621.523175-17-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031122102100007 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich It is required for implementing /proc/cpuinfo emulation. Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Message-Id: <20230605113950.1169228-3-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- linux-user/loader.h | 4 ++++ linux-user/elfload.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-user/loader.h b/linux-user/loader.h index f375ee0679..ad6ca9dbe3 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -56,4 +56,8 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src, =20 extern unsigned long guest_stack_size; =20 +#ifdef TARGET_S390X +uint32_t get_elf_hwcap(void); +#endif + #endif /* LINUX_USER_LOADER_H */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 418ad92598..49ec9ccc94 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1583,7 +1583,7 @@ static inline void init_thread(struct target_pt_regs = *regs, #define GET_FEATURE(_feat, _hwcap) \ do { if (s390_has_feat(_feat)) { hwcap |=3D _hwcap; } } while (0) =20 -static uint32_t get_elf_hwcap(void) +uint32_t get_elf_hwcap(void) { /* * Let's assume we always have esan3 and zarch. --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031101; cv=none; d=zohomail.com; s=zohoarc; b=KLc0GFOSRD/DG0i17+ts/4Q1xJIBmM29MexbQUi8jyLTpHG+3rPA2ldPGOqpGFnPXfQZArdiIoxVZXVcRTtah1Qq8z3IcjFS1jr3byzfGqBHfTVPJOQYaPFKgL0uhvHAqmZsbPVPTWPemz0QCfIpUMSpDL9Tod/kkJo4ZBHWbVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031101; h=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=/4VWB/QIRuKBo2P+IdJiLWtR4YzapCXGmuLXjtj1eBc=; b=fs+ZhDk0vjFbNNUFAZSs6t8rhXgTdYFSHk8Itf910ndQkj9FqNgN09sUc7EYZr63R5/YOAcybIid4YSiUBb6puWWtKJPh9QwpY/5ffeCudT4h4zU8R6u/0jsvkoiyZ8vL2Vm0vYKx64EaPLSPk6c3zs+eMzTHL5eRnkX9aLL/CY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031101581437.3119283860109; Mon, 5 Jun 2023 22:58:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pgk-0004v6-5u; Tue, 06 Jun 2023 01:57:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgi-0004ui-W3 for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:57:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgh-0004D5-FU for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:57:00 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-q9sgLEW3N_a8AYByp_YOng-1; Tue, 06 Jun 2023 01:56:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D32453C025D8; Tue, 6 Jun 2023 05:56:50 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1CF92166B25; Tue, 6 Jun 2023 05:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/4VWB/QIRuKBo2P+IdJiLWtR4YzapCXGmuLXjtj1eBc=; b=R5qdofAJaDFsCDDso3ezXrtNEcmjWHbQ6RG/DcNZaiRXIwNOC1a2hmIg99XLf2WOrTNWiy MaFSs5e8TOJGPf1y0YZO3JEX8+2srbnoV+0dfcktQxnHGns5608j6GjXnbWsiE3IxCtQm5 1Mwuq7u589hnc1EjB3LpbtLzi6WiSEk= X-MC-Unique: q9sgLEW3N_a8AYByp_YOng-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , David Hildenbrand Subject: [PULL 17/18] linux-user/elfload: Introduce elf_hwcap_str() on s390x Date: Tue, 6 Jun 2023 07:56:20 +0200 Message-Id: <20230606055621.523175-18-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031103552100003 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich It is required for implementing /proc/cpuinfo emulation. Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Message-Id: <20230605113950.1169228-4-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- linux-user/loader.h | 1 + linux-user/elfload.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/linux-user/loader.h b/linux-user/loader.h index ad6ca9dbe3..59cbeacf24 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -58,6 +58,7 @@ extern unsigned long guest_stack_size; =20 #ifdef TARGET_S390X uint32_t get_elf_hwcap(void); +const char *elf_hwcap_str(uint32_t bit); #endif =20 #endif /* LINUX_USER_LOADER_H */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 49ec9ccc94..d80d68484b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1605,6 +1605,33 @@ uint32_t get_elf_hwcap(void) return hwcap; } =20 +const char *elf_hwcap_str(uint32_t bit) +{ + static const char *hwcap_str[] =3D { + [HWCAP_S390_ESAN3] =3D "esan3", + [HWCAP_S390_ZARCH] =3D "zarch", + [HWCAP_S390_STFLE] =3D "stfle", + [HWCAP_S390_MSA] =3D "msa", + [HWCAP_S390_LDISP] =3D "ldisp", + [HWCAP_S390_EIMM] =3D "eimm", + [HWCAP_S390_DFP] =3D "dfp", + [HWCAP_S390_HPAGE] =3D "edat", + [HWCAP_S390_ETF3EH] =3D "etf3eh", + [HWCAP_S390_HIGH_GPRS] =3D "highgprs", + [HWCAP_S390_TE] =3D "te", + [HWCAP_S390_VXRS] =3D "vx", + [HWCAP_S390_VXRS_BCD] =3D "vxd", + [HWCAP_S390_VXRS_EXT] =3D "vxe", + [HWCAP_S390_GS] =3D "gs", + [HWCAP_S390_VXRS_EXT2] =3D "vxe2", + [HWCAP_S390_VXRS_PDE] =3D "vxp", + [HWCAP_S390_SORT] =3D "sort", + [HWCAP_S390_DFLT] =3D "dflt", + }; + + return bit < ARRAY_SIZE(hwcap_str) ? hwcap_str[bit] : NULL; +} + static inline void init_thread(struct target_pt_regs *regs, struct image_i= nfo *infop) { regs->psw.addr =3D infop->entry; --=20 2.31.1 From nobody Fri May 17 03:54:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686031175; cv=none; d=zohomail.com; s=zohoarc; b=EsomaSwL3sv5UEuL1/q3U9RciQqOjNIimgT3YiXzkFDPCMCsQ4FlQYJlp7D7GEoSrJCg0ZTUdxoUY4MDa6+3ZWqOiFA4hxDEOPAwVB8jIW3gYpcmeCgWWeEhg5l5Q/AEcw9a6nOL7vfsc8Sc0kSYU4jP0ytSJCY/VI2j4K9B6lM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686031175; h=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=5IeASP+feAXEMJEqRk06AP6n/Wy3o7p7DE/u+5rC0+s=; b=iTgrRqWZxZPG4r8u6plQRxAzG0ox38m24UiReQnhhBNbx0sFiCUt4NVdN8VQ+ArAx8LkRqbHevwBKPiIDD1xnM+ybXHx4eUjUVloHkgJaOqbR47SGpNdA85MEaGBF4HeXyAbd7mqwTCZYwIjN3wbQsUXAH+GF2na4kXh8DQ0UZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686031175495647.1113746029222; Mon, 5 Jun 2023 22:59:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6Pgi-0004u0-55; Tue, 06 Jun 2023 01:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pgg-0004tV-Fz for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6Pge-0004CW-Jt for qemu-devel@nongnu.org; Tue, 06 Jun 2023 01:56:58 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214--5e0aIMUOquseExzcEpREA-1; Tue, 06 Jun 2023 01:56:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 84E6B299E74A; Tue, 6 Jun 2023 05:56:52 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2319A2166B25; Tue, 6 Jun 2023 05:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686031016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5IeASP+feAXEMJEqRk06AP6n/Wy3o7p7DE/u+5rC0+s=; b=CKN61bYISxjJ4CwU6F1PZJgn3xNYXzMhpXEcxO6kGiHkJzFmYBxE5xEbJjcX3vKUpqRAQZ kHgbVCwRdN/cHe36ImzqJN76cVVjJQJbc7b7RsffOwNJ9+Ow8AzogrtQKmZWCCtyocQv9c 3xbKQNJbCXNKhPJf59QCbIBvEpnzA+Q= X-MC-Unique: -5e0aIMUOquseExzcEpREA-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: Ilya Leoshkevich , Tulio Magno Quites Machado Filho , David Hildenbrand Subject: [PULL 18/18] linux-user: Emulate /proc/cpuinfo on s390x Date: Tue, 6 Jun 2023 07:56:21 +0200 Message-Id: <20230606055621.523175-19-thuth@redhat.com> In-Reply-To: <20230606055621.523175-1-thuth@redhat.com> References: <20230606055621.523175-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686031176447100003 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Some s390x userspace programs are confused when seeing a foreign /proc/cpuinfo [1]. Add the emulation for s390x; follow the respective kernel code structure where possible. Output example: vendor_id : IBM/S390 # processors : 12 bogomips per cpu: 13370.00 max thread id : 0 features : esan3 zarch stfle msa facilities : 0 1 2 3 4 7 9 16 17 18 19 21 22 24 25 27 30 31 32 33 34 = 35 37 40 41 45 49 51 52 53 57 58 61 69 71 72 75 76 77 129 130 131 135 138 1= 46 148 processor 0: version =3D 00, identification =3D 000000, machine =3D 8561 processor 1: version =3D 00, identification =3D 100000, machine =3D 8561 [...] cpu number : 0 version : 00 identification : 000000 machine : 8561 cpu number : 1 version : 00 identification : 100000 machine : 8561 [...] [1] https://bugzilla.redhat.com/show_bug.cgi?id=3D2211472 Reported-by: Tulio Magno Quites Machado Filho Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich Message-Id: <20230605113950.1169228-5-iii@linux.ibm.com> Signed-off-by: Thomas Huth --- linux-user/syscall.c | 106 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 89b58b386b..83685f0aa5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8232,7 +8232,7 @@ void target_exception_dump(CPUArchState *env, const c= har *fmt, int code) =20 #if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN || \ defined(TARGET_SPARC) || defined(TARGET_M68K) || defined(TARGET_HPPA) = || \ - defined(TARGET_RISCV) + defined(TARGET_RISCV) || defined(TARGET_S390X) static int is_proc(const char *filename, const char *entry) { return strcmp(filename, entry) =3D=3D 0; @@ -8339,6 +8339,107 @@ static int open_cpuinfo(CPUArchState *cpu_env, int = fd) } #endif =20 +#if defined(TARGET_S390X) +/* + * Emulate what a Linux kernel running in qemu-system-s390x -M accel=3Dtcg= would + * show in /proc/cpuinfo. + * + * Skip the following in order to match the missing support in op_ecag(): + * - show_cacheinfo(). + * - show_cpu_topology(). + * - show_cpu_mhz(). + * + * Use fixed values for certain fields: + * - bogomips per cpu - from a qemu-system-s390x run. + * - max thread id =3D 0, since SMT / SIGP_SET_MULTI_THREADING is not supp= orted. + * + * Keep the code structure close to arch/s390/kernel/processor.c. + */ + +static void show_facilities(int fd) +{ + size_t sizeof_stfl_bytes =3D 2048; + g_autofree uint8_t *stfl_bytes =3D g_new0(uint8_t, sizeof_stfl_bytes); + unsigned int bit; + + dprintf(fd, "facilities :"); + s390_get_feat_block(S390_FEAT_TYPE_STFL, stfl_bytes); + for (bit =3D 0; bit < sizeof_stfl_bytes * 8; bit++) { + if (test_be_bit(bit, stfl_bytes)) { + dprintf(fd, " %d", bit); + } + } + dprintf(fd, "\n"); +} + +static int cpu_ident(unsigned long n) +{ + return deposit32(0, CPU_ID_BITS - CPU_PHYS_ADDR_BITS, CPU_PHYS_ADDR_BI= TS, + n); +} + +static void show_cpu_summary(CPUArchState *cpu_env, int fd) +{ + S390CPUModel *model =3D env_archcpu(cpu_env)->model; + int num_cpus =3D sysconf(_SC_NPROCESSORS_ONLN); + uint32_t elf_hwcap =3D get_elf_hwcap(); + const char *hwcap_str; + int i; + + dprintf(fd, "vendor_id : IBM/S390\n" + "# processors : %i\n" + "bogomips per cpu: 13370.00\n", + num_cpus); + dprintf(fd, "max thread id : 0\n"); + dprintf(fd, "features\t: "); + for (i =3D 0; i < sizeof(elf_hwcap) * 8; i++) { + if (!(elf_hwcap & (1 << i))) { + continue; + } + hwcap_str =3D elf_hwcap_str(i); + if (hwcap_str) { + dprintf(fd, "%s ", hwcap_str); + } + } + dprintf(fd, "\n"); + show_facilities(fd); + for (i =3D 0; i < num_cpus; i++) { + dprintf(fd, "processor %d: " + "version =3D %02X, " + "identification =3D %06X, " + "machine =3D %04X\n", + i, model->cpu_ver, cpu_ident(i), model->def->type); + } +} + +static void show_cpu_ids(CPUArchState *cpu_env, int fd, unsigned long n) +{ + S390CPUModel *model =3D env_archcpu(cpu_env)->model; + + dprintf(fd, "version : %02X\n", model->cpu_ver); + dprintf(fd, "identification : %06X\n", cpu_ident(n)); + dprintf(fd, "machine : %04X\n", model->def->type); +} + +static void show_cpuinfo(CPUArchState *cpu_env, int fd, unsigned long n) +{ + dprintf(fd, "\ncpu number : %ld\n", n); + show_cpu_ids(cpu_env, fd, n); +} + +static int open_cpuinfo(CPUArchState *cpu_env, int fd) +{ + int num_cpus =3D sysconf(_SC_NPROCESSORS_ONLN); + int i; + + show_cpu_summary(cpu_env, fd); + for (i =3D 0; i < num_cpus; i++) { + show_cpuinfo(cpu_env, fd, i); + } + return 0; +} +#endif + #if defined(TARGET_M68K) static int open_hardware(CPUArchState *cpu_env, int fd) { @@ -8363,7 +8464,8 @@ static int do_openat(CPUArchState *cpu_env, int dirfd= , const char *pathname, int #if HOST_BIG_ENDIAN !=3D TARGET_BIG_ENDIAN { "/proc/net/route", open_net_route, is_proc }, #endif -#if defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined(TARGET_RISCV) +#if defined(TARGET_SPARC) || defined(TARGET_HPPA) || \ + defined(TARGET_RISCV) || defined(TARGET_S390X) { "/proc/cpuinfo", open_cpuinfo, is_proc }, #endif #if defined(TARGET_M68K) --=20 2.31.1