From nobody Tue Aug 25 23:56:35 2026 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1782731185; cv=none; d=zohomail.com; s=zohoarc; b=DXjDO8EjzQMuXmvvIlbgC2/TebVglzaNf3EAEU4wqP5OjBgcfIf+kYtlIfsUdngdH6x+MEfukXRhjuNwMtxjKsHnWmWodOLIA4cyYXpw5FgDZxSxB6G6LQJrJqgr7AMXeCaFmdJlQcn/+zm/GDOjsmSahjHekE4kbj8/mzmGGhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782731185; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3bHy0bjaJ+P+Q6EON1VYPG0VERhf+UUVuwCQJEFkrJs=; b=IZ7kZScIJByBgEfvZLw4PbzquA4o9fZ674NFx+mnFjeB+Yr5CYTRUwDluTe1gBMccmYNjMvHrGl8gMvzJ/E62bgjBn7MBRzgJ8ZcaCnp2rRHGs4mwZXjQg51vq2TckoPpsA+JRa2+vsBVF5IXJ6GTvfkO3QQfbnpFGEZe8ull/U= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782731185457400.1150274857873; Mon, 29 Jun 2026 04:06:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1we9nu-000409-KT; Mon, 29 Jun 2026 07:05:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1we9nd-0003nX-PB; Mon, 29 Jun 2026 07:05:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1we9nb-0002uA-Ez; Mon, 29 Jun 2026 07:05:13 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65TAmYag3182095; Mon, 29 Jun 2026 11:05:08 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f26qfrvw5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Jun 2026 11:05:08 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 65TB4fdi001013; Mon, 29 Jun 2026 11:05:07 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f2s7vw666-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Jun 2026 11:05:06 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 65TB52Or51184108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Jun 2026 11:05:03 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC8E920043; Mon, 29 Jun 2026 11:05:02 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C84820040; Mon, 29 Jun 2026 11:04:58 +0000 (GMT) Received: from li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.bl1-in.ibm.com (unknown [9.123.10.203]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 29 Jun 2026 11:04:58 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=3bHy0bjaJ+P+Q6EON 1VYPG0VERhf+UUVuwCQJEFkrJs=; b=ppJiD5EswmDlnwxRNotJaOCqCKxXCffm0 8MhcZzqgH/DsVPEsB5dJVOTd9uuzX58PnZ9sBIBOzi2P+IeS82baiQaQx07BVsv4 XCuTt9P+lgAKK6ishzzE8A3w0ZkK9R/3MT7py7U5USrsdqn2DnOnM5n2mF0BgKcg w7EEnvUyMR2QDjioCKbzJ6IpVbbeoDnKnAoREhY90bCiOztrDdNjznIilB3GcJf8 DuBLBHqjQaixdo3mRIHjLyo7+cTfFVy1CPR36YYdEP+jEVq2UQMZqVa1KJ6I+Ga/ oewg+3q+dpFgB8aiSbSeOq8HGlEVJaO35Xu/vnLJ37tsa2WqOPmFA== From: Aditya Gupta To: , , Harsh Prateek Bora , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Shivang Upadhyay , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Cc: Sourabh Jain , Hari Bathini , Nicholas Piggin , Miles Glenn , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , devel@lists.libvirt.org, Misbah Anjum N , Anushree Mathur , Pierrick Bouvier , kvm@vger.kernel.org, Gautam Menghani , Chinmay Rath Subject: [PATCH v3 3/8] tests/qtest: Add Power11 chip & machine to qtests Date: Mon, 29 Jun 2026 16:34:06 +0530 Message-ID: <20260629110411.3051274-4-adityag@linux.ibm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260629110411.3051274-1-adityag@linux.ibm.com> References: <20260629110411.3051274-1-adityag@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=RYqgzVtv c=1 sm=1 tr=0 ts=6a425164 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=ecs4qFjb3cSJlp2yJ8oA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjI5MDA4OCBTYWx0ZWRfX3bBj8pMoq/+v Q1RnWRCR8LR8otUXB3f0foajVLU9qzIuwZ5kkgKLf2+DAroDI/TcL7M13ZJC/7bIl0VinolB2/x SMGFpQYq5X6mXbRMMFYDNmKrpG11t9o= X-Proofpoint-GUID: j66v-6MjuA8lFnjxklxNSbU6jbeD0MLL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjI5MDA4OCBTYWx0ZWRfX8bzEYXuu8o/h jVssvRimL6NoSglUasD9wuD10fHCXnKIyDjQmAa1+lwypwADiH+foY3+Y5JRxKtLLCl50UCPwqj 2L2j3c5NYVJ4W0QE6ShrzPEBDbs4qi/ZMYbi+kHOb1fGIb/I9Hws1c6Vyl9+1IUN0l9EKiMLZ1q /ZeoSwW64ySJKaRp6M/PcKP1VLJeOuE8p6naBLMxn2M94ESxYic8BDs9AJIzBzMhVaO6x/yj2PW DbDGT2VW+L2msetioB+XkqlNVatvg1pl6yi8Hl3nSYIw8lcok/qhTElkBLzPJnaGiBxGw+jVJq0 v0hVRM4LSxMyp86Q48svgLULqvsN4L224sM/sG71Uq973vaGrGq0+SrYKTint+5OuM3+5Qty1Nk jl4wIkuIIDa4C/f3CmCM1/BoPUeg5JcFjBWHKBO77iccjf730tv17g/PX2Hrz2Sl6pCP+Ewmd5n 0zZ8WOK8nUfowV+0q+w== X-Proofpoint-ORIG-GUID: 2OdOIM7OdOHNpybW8EDh2-jTKYAJQdPx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-29_03,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606290088 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=adityag@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @ibm.com) X-ZM-MESSAGEID: 1782731188143158500 Content-Type: text/plain; charset="utf-8" Previously the machines/chips tested by qtest was till Power10, update the tests to also test PowerNV11 and Power11 PNV Chip Since if-else-if ladder was common pattern to get machine type, implement pnv_get_machine_type so new processor cases can be implemented in one location in pnv_get_machine_type While at it, also add g_autofree to allocation by g_strdup_printf in modified tests Signed-off-by: Aditya Gupta --- tests/qtest/pnv-host-i2c-test.c | 10 ++++------ tests/qtest/pnv-spi-seeprom-test.c | 2 +- tests/qtest/pnv-xive2-test.c | 2 +- tests/qtest/pnv-xscom-test.c | 22 +++++--------------- tests/qtest/pnv-xscom.h | 32 +++++++++++++++++++++++++++--- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/tests/qtest/pnv-host-i2c-test.c b/tests/qtest/pnv-host-i2c-tes= t.c index 51e613ebdcb2..5fd54f9de771 100644 --- a/tests/qtest/pnv-host-i2c-test.c +++ b/tests/qtest/pnv-host-i2c-test.c @@ -402,15 +402,14 @@ static void reset_all(QTestState *qts, const PnvChip = *chip) static void test_host_i2c(const void *data) { const PnvChip *chip =3D data; + const char *machine =3D pnv_get_machine_type(chip->chip_type); QTestState *qts; - const char *machine =3D "powernv8"; PnvI2cCtlr ctlr; PnvI2cDev pca9552; PnvI2cDev pca9554; =20 - if (chip->chip_type =3D=3D PNV_CHIP_POWER9) { - machine =3D "powernv9"; - } else if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { + /* i2c is initialised for rainier in case of P10 */ + if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { machine =3D "powernv10-rainier"; } =20 @@ -473,10 +472,9 @@ static void add_test(const char *name, void (*test)(co= nst void *data)) int i; =20 for (i =3D 0; i < ARRAY_SIZE(pnv_chips); i++) { - char *tname =3D g_strdup_printf("pnv-xscom/%s/%s", name, + g_autofree char *tname =3D g_strdup_printf("pnv-xscom/%s/%s", name, pnv_chips[i].cpu_model); qtest_add_data_func(tname, &pnv_chips[i], test); - g_free(tname); } } =20 diff --git a/tests/qtest/pnv-spi-seeprom-test.c b/tests/qtest/pnv-spi-seepr= om-test.c index 1a78e8d966a5..8bb30eb649aa 100644 --- a/tests/qtest/pnv-spi-seeprom-test.c +++ b/tests/qtest/pnv-spi-seeprom-test.c @@ -77,7 +77,7 @@ static void test_spi_seeprom(const void *data) const PnvChip *chip =3D data; QTestState *qts =3D NULL; g_autofree char *tmp_path =3D NULL; - const char *machine =3D "powernv10"; + const char *machine =3D pnv_get_machine_type(chip->chip_type); int ret; int fd; =20 diff --git a/tests/qtest/pnv-xive2-test.c b/tests/qtest/pnv-xive2-test.c index 5313d4ef18b7..80de9d09ed09 100644 --- a/tests/qtest/pnv-xive2-test.c +++ b/tests/qtest/pnv-xive2-test.c @@ -548,7 +548,7 @@ static void test_xive(void) { QTestState *qts; =20 - qts =3D qtest_initf("-M powernv10 -smp %d,cores=3D1,threads=3D%d -nogr= aphic " + qts =3D qtest_initf("-M powernv11 -smp %d,cores=3D1,threads=3D%d -nogr= aphic " "-nodefaults -serial mon:stdio -S " "-d guest_errors -trace '*xive*'", SMT, SMT); diff --git a/tests/qtest/pnv-xscom-test.c b/tests/qtest/pnv-xscom-test.c index c814c0f4f5b1..94b50c071c02 100644 --- a/tests/qtest/pnv-xscom-test.c +++ b/tests/qtest/pnv-xscom-test.c @@ -28,15 +28,9 @@ static void test_xscom_cfam_id(QTestState *qts, const Pn= vChip *chip) static void test_cfam_id(const void *data) { const PnvChip *chip =3D data; - const char *machine =3D "powernv8"; + const char *machine =3D pnv_get_machine_type(chip->chip_type); QTestState *qts; =20 - if (chip->chip_type =3D=3D PNV_CHIP_POWER9) { - machine =3D "powernv9"; - } else if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { - machine =3D "powernv10"; - } - qts =3D qtest_initf("-M %s -accel tcg -cpu %s", machine, chip->cpu_model); test_xscom_cfam_id(qts, chip); @@ -57,7 +51,8 @@ static void test_cfam_id(const void *data) =20 static void test_xscom_core(QTestState *qts, const PnvChip *chip) { - if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { + if ((chip->chip_type =3D=3D PNV_CHIP_POWER10) || + (chip->chip_type =3D=3D PNV_CHIP_POWER11)) { uint32_t first_core_thread_state =3D PNV_XSCOM_P10_EC_BASE(chip->first_core) + 0x412; uint64_t thread_state; @@ -84,14 +79,8 @@ static void test_xscom_core(QTestState *qts, const PnvCh= ip *chip) static void test_core(const void *data) { const PnvChip *chip =3D data; + const char *machine =3D pnv_get_machine_type(chip->chip_type); QTestState *qts; - const char *machine =3D "powernv8"; - - if (chip->chip_type =3D=3D PNV_CHIP_POWER9) { - machine =3D "powernv9"; - } else if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { - machine =3D "powernv10"; - } =20 qts =3D qtest_initf("-M %s -accel tcg -cpu %s", machine, chip->cpu_model); @@ -104,10 +93,9 @@ static void add_test(const char *name, void (*test)(con= st void *data)) int i; =20 for (i =3D 0; i < ARRAY_SIZE(pnv_chips); i++) { - char *tname =3D g_strdup_printf("pnv-xscom/%s/%s", name, + g_autofree char *tname =3D g_strdup_printf("pnv-xscom/%s/%s", name, pnv_chips[i].cpu_model); qtest_add_data_func(tname, &pnv_chips[i], test); - g_free(tname); } } =20 diff --git a/tests/qtest/pnv-xscom.h b/tests/qtest/pnv-xscom.h index 5aa1701ea768..eefe206a2007 100644 --- a/tests/qtest/pnv-xscom.h +++ b/tests/qtest/pnv-xscom.h @@ -9,6 +9,9 @@ #ifndef PNV_XSCOM_H #define PNV_XSCOM_H =20 +#include +#include + #define SMT 4 /* some tests will break if less than 4 = */ =20 typedef enum PnvChipType { @@ -17,6 +20,7 @@ typedef enum PnvChipType { PNV_CHIP_POWER8NVL, /* AKA Naples */ PNV_CHIP_POWER9, /* AKA Nimbus */ PNV_CHIP_POWER10, + PNV_CHIP_POWER11, } PnvChipType; =20 typedef struct PnvChip { @@ -60,15 +64,23 @@ static const PnvChip pnv_chips[] =3D { .first_core =3D 0x0, .num_i2c =3D 4, }, + { + .chip_type =3D PNV_CHIP_POWER11, + .cpu_model =3D "Power11", + .xscom_base =3D 0x000603fc00000000ull, + .cfam_id =3D 0x220da04980000000ull, + .first_core =3D 0x0, + .num_i2c =3D 0, + }, }; =20 static inline uint64_t pnv_xscom_addr(const PnvChip *chip, uint32_t pcba) { uint64_t addr =3D chip->xscom_base; =20 - if (chip->chip_type =3D=3D PNV_CHIP_POWER10) { - addr |=3D ((uint64_t) pcba << 3); - } else if (chip->chip_type =3D=3D PNV_CHIP_POWER9) { + if ((chip->chip_type =3D=3D PNV_CHIP_POWER11) || + (chip->chip_type =3D=3D PNV_CHIP_POWER10) || + (chip->chip_type =3D=3D PNV_CHIP_POWER9)) { addr |=3D ((uint64_t) pcba << 3); } else { addr |=3D (((uint64_t) pcba << 4) & ~0xffull) | @@ -77,4 +89,18 @@ static inline uint64_t pnv_xscom_addr(const PnvChip *chi= p, uint32_t pcba) return addr; } =20 +static const char *pnv_get_machine_type(enum PnvChipType chip_type) +{ + static const char *const machine_types[] =3D { + [PNV_CHIP_POWER8] =3D "powernv8", + [PNV_CHIP_POWER9] =3D "powernv9", + [PNV_CHIP_POWER10] =3D "powernv10", + [PNV_CHIP_POWER11] =3D "powernv11", + }; + + g_assert(chip_type <=3D PNV_CHIP_POWER11); + + return machine_types[chip_type]; +} + #endif /* PNV_XSCOM_H */ --=20 2.54.0