From nobody Fri Nov 7 05:38:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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=listsout.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from listsout.gnu.org (listsout.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1546514025541451.416780885314; Thu, 3 Jan 2019 03:13:45 -0800 (PST) Received: from localhost ([127.0.0.1]:52417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf0wa-00070C-Fp for importer@patchew.org; Thu, 03 Jan 2019 06:13:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gf0tA-0003TT-8B for qemu-devel@nongnu.org; Thu, 03 Jan 2019 06:10:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gf0t7-00024H-68 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 06:10:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46202) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gf0t6-00022t-Ua for qemu-devel@nongnu.org; Thu, 03 Jan 2019 06:10:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC238C057E00; Thu, 3 Jan 2019 11:10:07 +0000 (UTC) Received: from thuth.com (dhcp-200-199.str.redhat.com [10.33.200.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id D61F060BEC; Thu, 3 Jan 2019 11:10:02 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Laurent Vivier Date: Thu, 3 Jan 2019 12:09:52 +0100 Message-Id: <1546513792-17773-4-git-send-email-thuth@redhat.com> In-Reply-To: <1546513792-17773-1-git-send-email-thuth@redhat.com> References: <1546513792-17773-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 03 Jan 2019 11:10:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] tests/pnv-xscom: Make test independent of global_qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Pass around the QTestState, so that we can finally get rid of the out-of-favor global_qtest variable in this file, too. Signed-off-by: Thomas Huth --- tests/pnv-xscom-test.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/pnv-xscom-test.c b/tests/pnv-xscom-test.c index 70f4c84..974f8da 100644 --- a/tests/pnv-xscom-test.c +++ b/tests/pnv-xscom-test.c @@ -63,14 +63,15 @@ static uint64_t pnv_xscom_addr(const PnvChip *chip, uin= t32_t pcba) return addr; } =20 -static uint64_t pnv_xscom_read(const PnvChip *chip, uint32_t pcba) +static uint64_t pnv_xscom_read(QTestState *qts, const PnvChip *chip, + uint32_t pcba) { - return readq(pnv_xscom_addr(chip, pcba)); + return qtest_readq(qts, pnv_xscom_addr(chip, pcba)); } =20 -static void test_xscom_cfam_id(const PnvChip *chip) +static void test_xscom_cfam_id(QTestState *qts, const PnvChip *chip) { - uint64_t f000f =3D pnv_xscom_read(chip, 0xf000f); + uint64_t f000f =3D pnv_xscom_read(qts, chip, 0xf000f); =20 g_assert_cmphex(f000f, =3D=3D, chip->cfam_id); } @@ -78,11 +79,11 @@ static void test_xscom_cfam_id(const PnvChip *chip) static void test_cfam_id(const void *data) { const PnvChip *chip =3D data; + QTestState *qts; =20 - global_qtest =3D qtest_initf("-M powernv,accel=3Dtcg -cpu %s", - chip->cpu_model); - test_xscom_cfam_id(chip); - qtest_quit(global_qtest); + qts =3D qtest_initf("-M powernv,accel=3Dtcg -cpu %s", chip->cpu_model); + test_xscom_cfam_id(qts, chip); + qtest_quit(qts); } =20 =20 @@ -94,7 +95,7 @@ static void test_cfam_id(const void *data) =20 #define PNV_XSCOM_EX_DTS_RESULT0 0x50000 =20 -static void test_xscom_core(const PnvChip *chip) +static void test_xscom_core(QTestState *qts, const PnvChip *chip) { uint32_t first_core_dts0 =3D PNV_XSCOM_EX_DTS_RESULT0; uint64_t dts0; @@ -105,7 +106,7 @@ static void test_xscom_core(const PnvChip *chip) first_core_dts0 |=3D PNV_XSCOM_P9_EC_BASE(chip->first_core); } =20 - dts0 =3D pnv_xscom_read(chip, first_core_dts0); + dts0 =3D pnv_xscom_read(qts, chip, first_core_dts0); =20 g_assert_cmphex(dts0, =3D=3D, 0x26f024f023f0000ull); } @@ -113,11 +114,11 @@ static void test_xscom_core(const PnvChip *chip) static void test_core(const void *data) { const PnvChip *chip =3D data; + QTestState *qts; =20 - global_qtest =3D qtest_initf("-M powernv,accel=3Dtcg -cpu %s", - chip->cpu_model); - test_xscom_core(chip); - qtest_quit(global_qtest); + qts =3D qtest_initf("-M powernv,accel=3Dtcg -cpu %s", chip->cpu_model); + test_xscom_core(qts, chip); + qtest_quit(qts); } =20 static void add_test(const char *name, void (*test)(const void *data)) --=20 1.8.3.1