From nobody Tue Aug 25 05:41:02 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=1783069354; cv=none; d=zohomail.com; s=zohoarc; b=D+AjlnvoIStUQyjoCI2MILv/c0SZC9SxxFJq2FPzv++xxrMUEs+Ql9n2pE9cL0xA4r629wBpLhg/oTijiSgLUv+ZjB9kUum+NhWZj8ko6ZAh+LiuVTerkHqwkcvR7oaxt4KqpHlOU4ExJknVbsepaf2Rjm4TJYGe6ZR3D02MwyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783069354; 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=7UYZAFlQVeRLPk4XdCSTzTtP+9nW4J2FK1+Z4c4Ie7U=; b=dhmFpqe89/aKya/I8m8j5b/tS8YDJv++CfRIQbwP8cI+L9SJZSydnaUpH1AhWHS8gP32aCdXcgzbds0eVthTBJpyMrR1MM7sMXRbYpqZX4xDbi+0rTKVDX8SP2qPUYdmw1qqLORfOfwqYwFCbzlPAPS7y5sElg6HtvN+/9tTw6E= 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 1783069354975381.0847864248203; Fri, 3 Jul 2026 02:02:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wfZlP-0003oZ-GQ; Fri, 03 Jul 2026 05:00:48 -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 1wfZlH-0003mb-Pv; Fri, 03 Jul 2026 05:00:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wfZlE-0004Ev-Nb; Fri, 03 Jul 2026 05:00:39 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6636ISwS1761142; Fri, 3 Jul 2026 09:00:33 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f26mk5w34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jul 2026 09:00:32 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 6638noDX031556; Fri, 3 Jul 2026 09:00:31 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4f2u2gqvwy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Jul 2026 09:00:31 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66390RSa15860098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Jul 2026 09:00:27 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B359C2004B; Fri, 3 Jul 2026 09:00:27 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25C5D20040; Fri, 3 Jul 2026 09:00:21 +0000 (GMT) Received: from li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.ibm.com (unknown [9.124.212.167]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Jul 2026 09:00:20 +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=7UYZAFlQVeRLPk4Xd CSTzTtP+9nW4J2FK1+Z4c4Ie7U=; b=WOE7to8eAZmDlqfE4xDch77xzj10zBNAR 8oQ7mLHFmtfPV641ZjNIS0Q0tz77vD5joPROpIQIjG0oIj2+5pv52v4xUCUQHAzz EgxSBln/FKRqCz0jrEoCrMa/zDebGOGwdHwa8IN5sJ4OFC4u9ejFQdH4G3hc5gIX QUVe9PMRIvedEgtan7w4T34ZJKWGeMqdB/BlCUxT3FMbDYnM0fqwsZ/Dj0yVzAkr 0g1C9AQlMea8alb0okvigbkO3psX11YOcgCSkQ9JVgZytevGO00+qCUMC5IHt229 BPGtsbhoHiCaOcV/QF+8Uh+fFeZ85giAf3Kajv+sb7axJnmvkGFxQ== From: Aditya Gupta To: , , Harsh Prateek Bora Cc: =?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?= , 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 , BALATON Zoltan , Nikhil Kumar Singh Subject: [PATCH v4 RESEND 3/8] tests/qtest: Add Power11 chip & machine to qtests Date: Fri, 3 Jul 2026 14:29:50 +0530 Message-ID: <20260703085955.2318600-4-adityag@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260703085955.2318600-1-adityag@linux.ibm.com> References: <20260703085955.2318600-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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzAzMDA4MyBTYWx0ZWRfX0qC6P6fbML0I lJ3+4Ha+pypIyCTawTGsnIRDBaSBD7daFG5GTquij+Fz5azrV98Q3vMflLxsVH9UnPlpf0Wm9bO BDmbQHb+az97b+1e8WOttD8gJfxMgIqrZLc2AIXBxi4x86OVMpJ8ft23pTqq3yQ/vnWBXY+5mg0 Fwun0mOLowrI7+tzbRFm6sS/GczyVvofJdY/yKDypA5ArL46H5d1JN8sI5uhXgqrWH/WWmnY4s+ EcP0jPie8/t04MjghQGjDXt0e9/0MNY91mzZgxihKzXo5lAFpNsdNzh/URHoxsDVEeLEwIT8wYr FuMK4zFvy1sxLqcOi3277bVF2bshuZXBf7hvJuKvDtPwQbJGeqE4Dg/rb6fGOvWDtrSfiC7dDrs qOPyEOq4NSqdbrYvdk3G24dRJXh/KKxztINQOXBXHFKFsbZ5IVlJb3voHrXUlzgXkDnJ0fdoR1m mII099w6IUkxwo5H2ug== X-Proofpoint-GUID: eS10o2OxqC75fVG6aiJ_O5fKUYNi2_3v X-Authority-Analysis: v=2.4 cv=Z8bc2nRA c=1 sm=1 tr=0 ts=6a477a31 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=jlYlrgOtAAFGYfj3CJAA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzAzMDA4MyBTYWx0ZWRfX5Gk/Pegokv+x A/4CwWyuUFfYJ5qfX2TsinDuNs07yUVTAd9SGYBZ25kH9UMdb5qqelKfwzlTAzZes8FPbhjS8jf 7p+PmO0vvsVSyKy0fTOSU3MsHp4N8ks= X-Proofpoint-ORIG-GUID: Jp1Q_oftgYqS-RHdp3SyL26czdA-Wodu 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-07-03_02,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607030083 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.158.5; envelope-from=adityag@linux.ibm.com; helo=mx0b-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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: 1783069356329158500 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 Tested-by: Misbah Anjum N Reviewed-by: Nikhil Kumar Singh 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 | 21 +++++++++++++++++---- tests/qtest/pnv-xscom-test.c | 22 +++++----------------- tests/qtest/pnv-xscom.h | 29 ++++++++++++++++++++++++++--- 5 files changed, 53 insertions(+), 31 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..9f67a0066864 100644 --- a/tests/qtest/pnv-xive2-test.c +++ b/tests/qtest/pnv-xive2-test.c @@ -14,6 +14,7 @@ #include "libqtest.h" =20 #include "pnv-xive2-common.h" +#include "pnv-xscom.h" #include "hw/intc/pnv_xive2_regs.h" #include "hw/ppc/xive_regs.h" #include "hw/ppc/xive2_regs.h" @@ -544,14 +545,16 @@ static void test_hw_group_irq_backlog(QTestState *qts) g_assert_cmphex(lsmfb, =3D=3D, 0xFF); } =20 -static void test_xive(void) +static void test_xive(const void *data) { + const PnvChip *chip =3D data; + const char *machine =3D pnv_get_machine_type(chip->chip_type); QTestState *qts; =20 - qts =3D qtest_initf("-M powernv10 -smp %d,cores=3D1,threads=3D%d -nogr= aphic " + qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " "-nodefaults -serial mon:stdio -S " "-d guest_errors -trace '*xive*'", - SMT, SMT); + machine, SMT, SMT); init_xive(qts); =20 test_hw_irq(qts); @@ -580,6 +583,16 @@ static void test_xive(void) int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); - qtest_add_func("xive2", test_xive); + + for (int i =3D 0; i < ARRAY_SIZE(pnv_chips); i++) { + /* xive2 exists from Power10 onwards */ + if (pnv_chips[i].chip_type < PNV_CHIP_POWER10) { + continue; + } + + g_autofree char *tname =3D g_strdup_printf("pnv-xive2/%s", + pnv_chips[i].cpu_model); + qtest_add_data_func(tname, &pnv_chips[i], test_xive); + } return g_test_run(); } 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..8e882dac9d36 100644 --- a/tests/qtest/pnv-xscom.h +++ b/tests/qtest/pnv-xscom.h @@ -17,6 +17,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 +61,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 +86,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.55.0