From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402866715119.10968491927088; Mon, 13 Dec 2021 05:41:06 -0800 (PST) Received: from localhost ([::1]:44414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlZh-0001fC-Ig for importer@patchew.org; Mon, 13 Dec 2021 08:41:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO2-0007q0-Pz; Mon, 13 Dec 2021 08:29:02 -0500 Received: from smtpout4.mo529.mail-out.ovh.net ([217.182.185.173]:35977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNv-0000Cf-JL; Mon, 13 Dec 2021 08:29:02 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.120]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id DAA2BD19BE9E; Mon, 13 Dec 2021 14:28:40 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:40 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003f2ba0b70-f2f9-486e-a627-95fce242bea6, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 01/19] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Date: Mon, 13 Dec 2021 14:28:12 +0100 Message-ID: <20211213132830.108372-2-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 27ee67b2-e203-4689-a683-c623a499412e X-Ovh-Tracer-Id: 5370542556547025702 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=217.182.185.173; envelope-from=clg@kaod.org; helo=smtpout4.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402867940100001 The POWER8 processors with a NVLink logic unit have 4 PHB3 devices per chip. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- hw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 44ae41a9cb6b..6359bce549ca 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1309,7 +1309,7 @@ static void pnv_chip_power8nvl_class_init(ObjectClass= *klass, void *data) =20 k->chip_cfam_id =3D 0x120d304980000000ull; /* P8 Naples DD1.0 */ k->cores_mask =3D POWER8_CORE_MASK; - k->num_phbs =3D 3; + k->num_phbs =3D 4; k->core_pir =3D pnv_chip_core_pir_p8; k->intc_create =3D pnv_chip_power8_intc_create; k->intc_reset =3D pnv_chip_power8_intc_reset; --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402450655826.9579314124546; Mon, 13 Dec 2021 05:34:10 -0800 (PST) Received: from localhost ([::1]:34806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlSz-00030t-2V for importer@patchew.org; Mon, 13 Dec 2021 08:34:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNw-0007WO-Sq; Mon, 13 Dec 2021 08:28:56 -0500 Received: from smtpout2.mo529.mail-out.ovh.net ([79.137.123.220]:39371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000Cq-9s; Mon, 13 Dec 2021 08:28:56 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.156.206]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 5E203D19BEA1; Mon, 13 Dec 2021 14:28:41 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:40 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00397d45a91-5e47-4011-bc7c-9db01472d232, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 02/19] ppc/pnv: Introduce a "chip" property under PHB3 Date: Mon, 13 Dec 2021 14:28:13 +0100 Message-ID: <20211213132830.108372-3-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 74066975-1654-477d-96ac-70fc8c1da4a0 X-Ovh-Tracer-Id: 5370824033535626022 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout2.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402453151100001 This change will help us move the mapping of XSCOM regions under the PHB3 realize routine, which will be necessary for user created PHB3 devices. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- include/hw/pci-host/pnv_phb3.h | 3 +++ hw/pci-host/pnv_phb3.c | 1 + hw/ppc/pnv.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index e2a2e3624532..e9c13e6bd821 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -16,6 +16,7 @@ #include "qom/object.h" =20 typedef struct PnvPHB3 PnvPHB3; +typedef struct PnvChip PnvChip; =20 /* * PHB3 XICS Source for MSIs @@ -157,6 +158,8 @@ struct PnvPHB3 { PnvPHB3RootPort root; =20 QLIST_HEAD(, PnvPhb3DMASpace) dma_spaces; + + PnvChip *chip; }; =20 uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, unsigned size); diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index a7f96850055a..3aa42ef9d4b9 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -1092,6 +1092,7 @@ static const char *pnv_phb3_root_bus_path(PCIHostStat= e *host_bridge, static Property pnv_phb3_properties[] =3D { DEFINE_PROP_UINT32("index", PnvPHB3, phb_id, 0), DEFINE_PROP_UINT32("chip-id", PnvPHB3, chip_id, 0), + DEFINE_PROP_LINK("chip", PnvPHB3, chip, TYPE_PNV_CHIP, PnvChip *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 6359bce549ca..74c25c1c5d98 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1231,6 +1231,8 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) object_property_set_int(OBJECT(phb), "index", i, &error_fatal); object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id, &error_fatal); + object_property_set_link(OBJECT(phb), "chip", OBJECT(chip), + &error_fatal); if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { return; } --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403270442437.49828075520304; Mon, 13 Dec 2021 05:47:50 -0800 (PST) Received: from localhost ([::1]:58764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlgD-0003yP-8y for importer@patchew.org; Mon, 13 Dec 2021 08:47:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO1-0007jn-4d for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:01 -0500 Received: from smtpout2.mo529.mail-out.ovh.net ([79.137.123.220]:43169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNv-0000Cv-37 for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:00 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.52]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id B8004D19BEA7; Mon, 13 Dec 2021 14:28:41 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:41 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00395b82ffa-5e11-4190-a5d4-8439e8b6991c, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 03/19] ppc/pnv: Use the chip class to check the index of PHB3 devices Date: Mon, 13 Dec 2021 14:28:14 +0100 Message-ID: <20211213132830.108372-4-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 9886c31d-57cf-416b-a2af-c5fbb226d1fa X-Ovh-Tracer-Id: 5370824031883922214 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=79.137.123.220; envelope-from=clg@kaod.org; helo=smtpout2.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403271014100001 The maximum number of PHB3 devices per chip can be different depending on the POWER8 processor model. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 3aa42ef9d4b9..9c4451ca0d1c 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -993,7 +993,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **= errp) PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); int i; =20 - if (phb->phb_id >=3D PNV8_CHIP_PHB3_MAX) { + if (phb->phb_id >=3D PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) { error_setg(errp, "invalid PHB index: %d", phb->phb_id); return; } --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403974306271.6190851646352; Mon, 13 Dec 2021 05:59:34 -0800 (PST) Received: from localhost ([::1]:56398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlrZ-0005Qa-6i for importer@patchew.org; Mon, 13 Dec 2021 08:59:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO6-00086X-Bj for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:06 -0500 Received: from 5.mo552.mail-out.ovh.net ([188.165.45.220]:54759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNx-0000D9-2e for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:06 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.180]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id 5CAFD22D31; Mon, 13 Dec 2021 13:28:42 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:41 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00320f9b1fe-e32a-429e-99f2-e0ae53728771, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 04/19] ppc/pnv: Drop the "num-phbs" property Date: Mon, 13 Dec 2021 14:28:15 +0100 Message-ID: <20211213132830.108372-5-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 2853b085-2d08-41ef-92be-15e612643056 X-Ovh-Tracer-Id: 5371105507604073254 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=188.165.45.220; envelope-from=clg@kaod.org; helo=5.mo552.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403975041100001 It is never used. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/pnv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 74c25c1c5d98..0413d221b311 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1771,7 +1771,6 @@ static Property pnv_chip_properties[] =3D { DEFINE_PROP_UINT32("nr-cores", PnvChip, nr_cores, 1), DEFINE_PROP_UINT64("cores-mask", PnvChip, cores_mask, 0x0), DEFINE_PROP_UINT32("nr-threads", PnvChip, nr_threads, 1), - DEFINE_PROP_UINT32("num-phbs", PnvChip, num_phbs, 0), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402884645486.64738393272535; Mon, 13 Dec 2021 05:41:24 -0800 (PST) Received: from localhost ([::1]:44858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlZz-00020c-Kk for importer@patchew.org; Mon, 13 Dec 2021 08:41:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNz-0007eA-Rg for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:59 -0500 Received: from 7.mo552.mail-out.ovh.net ([188.165.59.253]:59337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000DG-Ga for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:59 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.138.84]) by mo552.mail-out.ovh.net (Postfix) with ESMTPS id A7A7422EA8; Mon, 13 Dec 2021 13:28:42 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:42 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003d2c394b2-8826-4cb1-86ad-f8e9666ee95e, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 05/19] ppc/pnv: Move mapping of the PHB3 CQ regions under pnv_pbcq_realize() Date: Mon, 13 Dec 2021 14:28:16 +0100 Message-ID: <20211213132830.108372-6-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 7cbcc315-6499-4aa6-ac44-9780173ca23a X-Ovh-Tracer-Id: 5371105506932919078 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=188.165.59.253; envelope-from=clg@kaod.org; helo=7.mo552.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402885605100001 This change will help us providing support for user created PHB3 devices. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb3_pbcq.c | 11 +++++++++++ hw/ppc/pnv.c | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hw/pci-host/pnv_phb3_pbcq.c b/hw/pci-host/pnv_phb3_pbcq.c index a0526aa1eca3..c7426cd27a20 100644 --- a/hw/pci-host/pnv_phb3_pbcq.c +++ b/hw/pci-host/pnv_phb3_pbcq.c @@ -284,6 +284,17 @@ static void pnv_pbcq_realize(DeviceState *dev, Error *= *errp) pnv_xscom_region_init(&pbcq->xscom_spci_regs, OBJECT(dev), &pnv_pbcq_spci_xscom_ops, pbcq, name, PNV_XSCOM_PBCQ_SPCI_SIZE); + + /* Populate the XSCOM address space. */ + pnv_xscom_add_subregion(phb->chip, + PNV_XSCOM_PBCQ_NEST_BASE + 0x400 * phb->phb_id, + &pbcq->xscom_nest_regs); + pnv_xscom_add_subregion(phb->chip, + PNV_XSCOM_PBCQ_PCI_BASE + 0x400 * phb->phb_id, + &pbcq->xscom_pci_regs); + pnv_xscom_add_subregion(phb->chip, + PNV_XSCOM_PBCQ_SPCI_BASE + 0x040 * phb->phb_id, + &pbcq->xscom_spci_regs); } =20 static int pnv_pbcq_dt_xscom(PnvXScomInterface *dev, void *fdt, diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 0413d221b311..65196a2a5d00 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1226,7 +1226,6 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) /* PHB3 controllers */ for (i =3D 0; i < chip->num_phbs; i++) { PnvPHB3 *phb =3D &chip8->phbs[i]; - PnvPBCQState *pbcq =3D &phb->pbcq; =20 object_property_set_int(OBJECT(phb), "index", i, &error_fatal); object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id, @@ -1236,17 +1235,6 @@ static void pnv_chip_power8_realize(DeviceState *dev= , Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { return; } - - /* Populate the XSCOM address space. */ - pnv_xscom_add_subregion(chip, - PNV_XSCOM_PBCQ_NEST_BASE + 0x400 * phb->ph= b_id, - &pbcq->xscom_nest_regs); - pnv_xscom_add_subregion(chip, - PNV_XSCOM_PBCQ_PCI_BASE + 0x400 * phb->phb= _id, - &pbcq->xscom_pci_regs); - pnv_xscom_add_subregion(chip, - PNV_XSCOM_PBCQ_SPCI_BASE + 0x040 * phb->ph= b_id, - &pbcq->xscom_spci_regs); } } =20 --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402801457497.55303775924426; Mon, 13 Dec 2021 05:40:01 -0800 (PST) Received: from localhost ([::1]:42792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlYd-0000ao-Oi for importer@patchew.org; Mon, 13 Dec 2021 08:40:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNx-0007WW-4D for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:57 -0500 Received: from smtpout4.mo529.mail-out.ovh.net ([217.182.185.173]:37887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000En-0k for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:56 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.146.27]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id C0927D19BEB4; Mon, 13 Dec 2021 14:28:43 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:42 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00376504725-c465-4e87-b4e5-60221bb66a39, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 06/19] ppc/pnv: Use QOM hierarchy to scan PHB3 devices Date: Mon, 13 Dec 2021 14:28:17 +0100 Message-ID: <20211213132830.108372-7-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: c4c30209-ab32-4a86-972c-5542b70ae557 X-Ovh-Tracer-Id: 5371386980891069222 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=217.182.185.173; envelope-from=clg@kaod.org; helo=smtpout4.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402803842100001 When -nodefaults is supported for PHB3 devices, the phbs array under the chip will be empty. This will break the XICSFabric handlers, and all interrupt delivery, and the 'info pic' HMP command. Do a QOM loop on the chip children and look for PHB3 devices instead. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- hw/ppc/pnv.c | 72 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 65196a2a5d00..cbc3f8ed62f7 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -638,16 +638,25 @@ static ISABus *pnv_isa_create(PnvChip *chip, Error **= errp) return PNV_CHIP_GET_CLASS(chip)->isa_create(chip, errp); } =20 +static int pnv_chip_power8_pic_print_info_child(Object *child, void *opaqu= e) +{ + Monitor *mon =3D opaque; + PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + + if (phb3) { + pnv_phb3_msi_pic_print_info(&phb3->msis, mon); + ics_pic_print_info(&phb3->lsis, mon); + } + return 0; +} + static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon) { Pnv8Chip *chip8 =3D PNV8_CHIP(chip); - int i; =20 ics_pic_print_info(&chip8->psi.ics, mon); - for (i =3D 0; i < chip->num_phbs; i++) { - pnv_phb3_msi_pic_print_info(&chip8->phbs[i].msis, mon); - ics_pic_print_info(&chip8->phbs[i].lsis, mon); - } + object_child_foreach(OBJECT(chip), + pnv_chip_power8_pic_print_info_child, mon); } =20 static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon) @@ -1789,10 +1798,32 @@ PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32= _t pir) return NULL; } =20 +typedef struct ForeachPhb3Args { + int irq; + ICSState *ics; +} ForeachPhb3Args; + +static int pnv_ics_get_child(Object *child, void *opaque) +{ + ForeachPhb3Args *args =3D opaque; + PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + + if (phb3) { + if (ics_valid_irq(&phb3->lsis, args->irq)) { + args->ics =3D &phb3->lsis; + } + if (ics_valid_irq(ICS(&phb3->msis), args->irq)) { + args->ics =3D ICS(&phb3->msis); + } + } + return args->ics ? 1 : 0; +} + static ICSState *pnv_ics_get(XICSFabric *xi, int irq) { PnvMachineState *pnv =3D PNV_MACHINE(xi); - int i, j; + ForeachPhb3Args args =3D { irq, NULL }; + int i; =20 for (i =3D 0; i < pnv->num_chips; i++) { PnvChip *chip =3D pnv->chips[i]; @@ -1801,32 +1832,37 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int ir= q) if (ics_valid_irq(&chip8->psi.ics, irq)) { return &chip8->psi.ics; } - for (j =3D 0; j < chip->num_phbs; j++) { - if (ics_valid_irq(&chip8->phbs[j].lsis, irq)) { - return &chip8->phbs[j].lsis; - } - if (ics_valid_irq(ICS(&chip8->phbs[j].msis), irq)) { - return ICS(&chip8->phbs[j].msis); - } + + object_child_foreach(OBJECT(chip), pnv_ics_get_child, &args); + if (args.ics) { + return args.ics; } } return NULL; } =20 +static int pnv_ics_resend_child(Object *child, void *opaque) +{ + PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + + if (phb3) { + ics_resend(&phb3->lsis); + ics_resend(ICS(&phb3->msis)); + } + return 0; +} + static void pnv_ics_resend(XICSFabric *xi) { PnvMachineState *pnv =3D PNV_MACHINE(xi); - int i, j; + int i; =20 for (i =3D 0; i < pnv->num_chips; i++) { PnvChip *chip =3D pnv->chips[i]; Pnv8Chip *chip8 =3D PNV8_CHIP(pnv->chips[i]); =20 ics_resend(&chip8->psi.ics); - for (j =3D 0; j < chip->num_phbs; j++) { - ics_resend(&chip8->phbs[j].lsis); - ics_resend(ICS(&chip8->phbs[j].msis)); - } + object_child_foreach(OBJECT(chip), pnv_ics_resend_child, NULL); } } =20 --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403177327230.31911796185693; Mon, 13 Dec 2021 05:46:17 -0800 (PST) Received: from localhost ([::1]:56344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlei-00021V-8g for importer@patchew.org; Mon, 13 Dec 2021 08:46:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO8-0008GH-7T for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:08 -0500 Received: from 4.mo548.mail-out.ovh.net ([188.165.42.229]:56201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO1-0000JM-BR for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:07 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.164]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 2773A2164A; Mon, 13 Dec 2021 13:28:50 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:44 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003f94e4152-b6ea-4644-9af1-cd74d6fa2988, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 07/19] ppc/pnv: Introduce a num_pecs class attribute for PHB4 PEC devices Date: Mon, 13 Dec 2021 14:28:18 +0100 Message-ID: <20211213132830.108372-8-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 4c5fe693-e006-41ee-a05d-88428e8585da X-Ovh-Tracer-Id: 5373357308946189094 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=188.165.42.229; envelope-from=clg@kaod.org; helo=4.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403179416100001 POWER9 processor comes with 3 PHB4 PEC (PCI Express Controller) and each PEC can have several PHBs : * PEC0 provides 1 PHB (PHB0) * PEC1 provides 2 PHBs (PHB1 and PHB2) * PEC2 provides 3 PHBs (PHB3, PHB4 and PHB5) A num_pecs class attribute represents better the logic units of the POWER9 chip. Use that instead of num_phbs which fits POWER8 chips. This will ease adding support for user created devices. Reviewed-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 2 ++ hw/ppc/pnv.c | 19 ++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index aa08d79d24de..c781525277db 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -53,6 +53,7 @@ struct PnvChip { PnvCore **cores; =20 uint32_t num_phbs; + uint32_t num_pecs; =20 MemoryRegion xscom_mmio; MemoryRegion xscom; @@ -136,6 +137,7 @@ struct PnvChipClass { uint64_t chip_cfam_id; uint64_t cores_mask; uint32_t num_phbs; + uint32_t num_pecs; =20 DeviceRealize parent_realize; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index cbc3f8ed62f7..cafe7aec9aab 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -667,7 +667,7 @@ static void pnv_chip_power9_pic_print_info(PnvChip *chi= p, Monitor *mon) pnv_xive_pic_print_info(&chip9->xive, mon); pnv_psi_pic_print_info(&chip9->psi, mon); =20 - for (i =3D 0; i < PNV9_CHIP_MAX_PEC; i++) { + for (i =3D 0; i < chip->num_pecs; i++) { PnvPhb4PecState *pec =3D &chip9->pecs[i]; for (j =3D 0; j < pec->num_stacks; j++) { pnv_phb4_pic_print_info(&pec->stacks[j].phb, mon); @@ -1344,15 +1344,13 @@ static void pnv_chip_power9_instance_init(Object *o= bj) =20 object_initialize_child(obj, "homer", &chip9->homer, TYPE_PNV9_HOMER); =20 - for (i =3D 0; i < PNV9_CHIP_MAX_PEC; i++) { + /* Number of PECs is the chip default */ + chip->num_pecs =3D pcc->num_pecs; + + for (i =3D 0; i < chip->num_pecs; i++) { object_initialize_child(obj, "pec[*]", &chip9->pecs[i], TYPE_PNV_PHB4_PEC); } - - /* - * Number of PHBs is the chip default - */ - chip->num_phbs =3D pcc->num_phbs; } =20 static void pnv_chip_quad_realize(Pnv9Chip *chip9, Error **errp) @@ -1388,7 +1386,7 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) int i, j; int phb_id =3D 0; =20 - for (i =3D 0; i < PNV9_CHIP_MAX_PEC; i++) { + for (i =3D 0; i < chip->num_pecs; i++) { PnvPhb4PecState *pec =3D &chip9->pecs[i]; PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); uint32_t pec_nest_base; @@ -1416,8 +1414,7 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr); pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr); =20 - for (j =3D 0; j < pec->num_stacks && phb_id < chip->num_phbs; - j++, phb_id++) { + for (j =3D 0; j < pec->num_stacks; j++, phb_id++) { PnvPhb4PecStack *stack =3D &pec->stacks[j]; Object *obj =3D OBJECT(&stack->phb); =20 @@ -1573,7 +1570,7 @@ static void pnv_chip_power9_class_init(ObjectClass *k= lass, void *data) k->xscom_core_base =3D pnv_chip_power9_xscom_core_base; k->xscom_pcba =3D pnv_chip_power9_xscom_pcba; dc->desc =3D "PowerNV Chip POWER9"; - k->num_phbs =3D 6; + k->num_pecs =3D PNV9_CHIP_MAX_PEC; =20 device_class_set_parent_realize(dc, pnv_chip_power9_realize, &k->parent_realize); --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402437120139.28228695138841; Mon, 13 Dec 2021 05:33:57 -0800 (PST) Received: from localhost ([::1]:34052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlSl-0002PT-6E for importer@patchew.org; Mon, 13 Dec 2021 08:33:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNw-0007WE-EI for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:56 -0500 Received: from 6.mo548.mail-out.ovh.net ([188.165.58.48]:37181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNt-0000JP-Rr for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:56 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.164]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id AA1A121584; Mon, 13 Dec 2021 13:28:51 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:50 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00328218a31-de39-4b8b-9eb8-e4014c2f40f1, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 08/19] ppc/pnv: Introduce version and device_id class atributes for PHB4 devices Date: Mon, 13 Dec 2021 14:28:19 +0100 Message-ID: <20211213132830.108372-9-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: b7fad690-67d2-4297-8509-7e9e7cbc1ea5 X-Ovh-Tracer-Id: 5373638783420042022 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=188.165.58.48; envelope-from=clg@kaod.org; helo=6.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402440133100001 It prepares ground for PHB5 which has different values. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- include/hw/pci-host/pnv_phb4.h | 2 ++ hw/pci-host/pnv_phb4_pec.c | 2 ++ hw/ppc/pnv.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 27556ae53425..b2864233641e 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -219,6 +219,8 @@ struct PnvPhb4PecClass { int compat_size; const char *stk_compat; int stk_compat_size; + uint64_t version; + uint64_t device_id; }; =20 #endif /* PCI_HOST_PNV_PHB4_H */ diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 741ddc90ed8d..9f722729ac50 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -499,6 +499,8 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) pecc->compat_size =3D sizeof(compat); pecc->stk_compat =3D stk_compat; pecc->stk_compat_size =3D sizeof(stk_compat); + pecc->version =3D PNV_PHB4_VERSION; + pecc->device_id =3D PNV_PHB4_DEVICE_ID; } =20 static const TypeInfo pnv_pec_type_info =3D { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index cafe7aec9aab..ecfe373e45e7 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1421,9 +1421,9 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) object_property_set_int(obj, "index", phb_id, &error_fatal); object_property_set_int(obj, "chip-id", chip->chip_id, &error_fatal); - object_property_set_int(obj, "version", PNV_PHB4_VERSION, + object_property_set_int(obj, "version", pecc->version, &error_fatal); - object_property_set_int(obj, "device-id", PNV_PHB4_DEVICE_ID, + object_property_set_int(obj, "device-id", pecc->device_id, &error_fatal); object_property_set_link(obj, "stack", OBJECT(stack), &error_abort); --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403523539546.378597061375; Mon, 13 Dec 2021 05:52:03 -0800 (PST) Received: from localhost ([::1]:42110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlkI-0003jp-GO for importer@patchew.org; Mon, 13 Dec 2021 08:52:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO9-0008J6-CZ for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:09 -0500 Received: from 1.mo548.mail-out.ovh.net ([178.32.121.110]:44229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO4-0000JT-6O for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:09 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.164]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id BC8E4203D3; Mon, 13 Dec 2021 13:28:51 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:51 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00328ad054b-c231-4d93-ab70-7d5ab7a0567f, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 09/19] ppc/pnv: Introduce a "chip" property under the PHB4 model Date: Mon, 13 Dec 2021 14:28:20 +0100 Message-ID: <20211213132830.108372-10-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: d0b58da5-7f03-46e5-a882-90ecc2c1402f X-Ovh-Tracer-Id: 5373638781729475366 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.32.121.110; envelope-from=clg@kaod.org; helo=1.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403524234100001 And check the PEC index using the chip class. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- include/hw/pci-host/pnv_phb4.h | 2 ++ hw/pci-host/pnv_phb4_pec.c | 7 +++++++ hw/ppc/pnv.c | 2 ++ 3 files changed, 11 insertions(+) diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index b2864233641e..8a585c9a42f7 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -205,6 +205,8 @@ struct PnvPhb4PecState { #define PHB4_PEC_MAX_STACKS 3 uint32_t num_stacks; PnvPhb4PecStack stacks[PHB4_PEC_MAX_STACKS]; + + PnvChip *chip; }; =20 =20 diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 9f722729ac50..4b32b5ae6ed4 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -382,6 +382,11 @@ static void pnv_pec_realize(DeviceState *dev, Error **= errp) =20 assert(pec->system_memory); =20 + if (pec->index >=3D PNV_CHIP_GET_CLASS(pec->chip)->num_pecs) { + error_setg(errp, "invalid PEC index: %d", pec->index); + return; + } + /* Create stacks */ for (i =3D 0; i < pec->num_stacks; i++) { PnvPhb4PecStack *stack =3D &pec->stacks[i]; @@ -462,6 +467,8 @@ static Property pnv_pec_properties[] =3D { DEFINE_PROP_UINT32("index", PnvPhb4PecState, index, 0), DEFINE_PROP_UINT32("num-stacks", PnvPhb4PecState, num_stacks, 0), DEFINE_PROP_UINT32("chip-id", PnvPhb4PecState, chip_id, 0), + DEFINE_PROP_LINK("chip", PnvPhb4PecState, chip, TYPE_PNV_CHIP, + PnvChip *), DEFINE_PROP_LINK("system-memory", PnvPhb4PecState, system_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index ecfe373e45e7..2f8d0c19aab7 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1402,6 +1402,8 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) &error_fatal); object_property_set_int(OBJECT(pec), "chip-id", chip->chip_id, &error_fatal); + object_property_set_link(OBJECT(pec), "chip", OBJECT(chip), + &error_fatal); object_property_set_link(OBJECT(pec), "system-memory", OBJECT(get_system_memory()), &error_abort= ); if (!qdev_realize(DEVICE(pec), NULL, errp)) { --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402488803409.383075453037; Mon, 13 Dec 2021 05:34:48 -0800 (PST) Received: from localhost ([::1]:36160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlTb-0003zV-S6 for importer@patchew.org; Mon, 13 Dec 2021 08:34:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNz-0007dK-JY for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:59 -0500 Received: from 10.mo548.mail-out.ovh.net ([46.105.77.235]:43917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000Je-Iv for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:59 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.52]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 5857C206ED; Mon, 13 Dec 2021 13:28:52 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:51 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003dfc8aae8-4d22-443b-9747-c3617a79dc68, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 10/19] ppc/pnv: Introduce a num_stack class attribute Date: Mon, 13 Dec 2021 14:28:21 +0100 Message-ID: <20211213132830.108372-11-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 47e45140-977c-4f8b-8f06-dedb3f9aabff X-Ovh-Tracer-Id: 5373920256538348326 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.77.235; envelope-from=clg@kaod.org; helo=10.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402489553100001 Each PEC device of the POWER9 chip has a predefined number of stacks, equivalent of a root port complex: PEC0 -> 1 stack PEC1 -> 2 stacks PEC2 -> 3 stacks Introduce a class attribute to hold these values and remove the "num-stacks" property. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- include/hw/pci-host/pnv_phb4.h | 1 + hw/pci-host/pnv_phb4_pec.c | 12 +++++++++++- hw/ppc/pnv.c | 7 ------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 8a585c9a42f7..60de3031a622 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -223,6 +223,7 @@ struct PnvPhb4PecClass { int stk_compat_size; uint64_t version; uint64_t device_id; + const uint32_t *num_stacks; }; =20 #endif /* PCI_HOST_PNV_PHB4_H */ diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 4b32b5ae6ed4..293909b5cb90 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -377,6 +377,7 @@ static void pnv_pec_instance_init(Object *obj) static void pnv_pec_realize(DeviceState *dev, Error **errp) { PnvPhb4PecState *pec =3D PNV_PHB4_PEC(dev); + PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); char name[64]; int i; =20 @@ -387,6 +388,8 @@ static void pnv_pec_realize(DeviceState *dev, Error **e= rrp) return; } =20 + pec->num_stacks =3D pecc->num_stacks[pec->index]; + /* Create stacks */ for (i =3D 0; i < pec->num_stacks; i++) { PnvPhb4PecStack *stack =3D &pec->stacks[i]; @@ -465,7 +468,6 @@ static int pnv_pec_dt_xscom(PnvXScomInterface *dev, voi= d *fdt, =20 static Property pnv_pec_properties[] =3D { DEFINE_PROP_UINT32("index", PnvPhb4PecState, index, 0), - DEFINE_PROP_UINT32("num-stacks", PnvPhb4PecState, num_stacks, 0), DEFINE_PROP_UINT32("chip-id", PnvPhb4PecState, chip_id, 0), DEFINE_PROP_LINK("chip", PnvPhb4PecState, chip, TYPE_PNV_CHIP, PnvChip *), @@ -484,6 +486,13 @@ static uint32_t pnv_pec_xscom_nest_base(PnvPhb4PecStat= e *pec) return PNV9_XSCOM_PEC_NEST_BASE + 0x400 * pec->index; } =20 +/* + * PEC0 -> 1 stack + * PEC1 -> 2 stacks + * PEC2 -> 3 stacks + */ +static const uint32_t pnv_pec_num_stacks[] =3D { 1, 2, 3 }; + static void pnv_pec_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -508,6 +517,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) pecc->stk_compat_size =3D sizeof(stk_compat); pecc->version =3D PNV_PHB4_VERSION; pecc->device_id =3D PNV_PHB4_DEVICE_ID; + pecc->num_stacks =3D pnv_pec_num_stacks; } =20 static const TypeInfo pnv_pec_type_info =3D { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 2f8d0c19aab7..87edbbe91e0f 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1393,13 +1393,6 @@ static void pnv_chip_power9_phb_realize(PnvChip *chi= p, Error **errp) uint32_t pec_pci_base; =20 object_property_set_int(OBJECT(pec), "index", i, &error_fatal); - /* - * PEC0 -> 1 stack - * PEC1 -> 2 stacks - * PEC2 -> 3 stacks - */ - object_property_set_int(OBJECT(pec), "num-stacks", i + 1, - &error_fatal); object_property_set_int(OBJECT(pec), "chip-id", chip->chip_id, &error_fatal); object_property_set_link(OBJECT(pec), "chip", OBJECT(chip), --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402459294574.4422301818616; Mon, 13 Dec 2021 05:34:19 -0800 (PST) Received: from localhost ([::1]:35042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlT6-0003AK-CY for importer@patchew.org; Mon, 13 Dec 2021 08:34:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO0-0007gA-Ew; Mon, 13 Dec 2021 08:29:00 -0500 Received: from 2.mo548.mail-out.ovh.net ([178.33.255.19]:37721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000Jf-JV; Mon, 13 Dec 2021 08:29:00 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.52]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id A5A2920A50; Mon, 13 Dec 2021 13:28:52 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:52 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003a4648ea2-9289-4b6d-9afa-84a9cba541aa, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 11/19] ppc/pnv: Compute the PHB index from the PHB4 PEC model Date: Mon, 13 Dec 2021 14:28:22 +0100 Message-ID: <20211213132830.108372-12-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: d8306a08-40a8-4a9f-a6bc-2e7d3f69aad2 X-Ovh-Tracer-Id: 5373920258204928806 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.33.255.19; envelope-from=clg@kaod.org; helo=2.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402460641100003 Use the num_stacks class attribute to compute the PHB index depending on the PEC index : * PEC0 provides 1 PHB (PHB0) * PEC1 provides 2 PHBs (PHB1 and PHB2) * PEC2 provides 3 PHBs (PHB3, PHB4 and PHB5) The routine pnv_pec_phb_offset() is a bit complex but it also prepares ground for PHB5 which has a different layout of stacks: 3 per PECs. Reviewed-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb4_pec.c | 16 ++++++++++++++++ hw/ppc/pnv.c | 4 +--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 293909b5cb90..a7dd4173d598 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -374,6 +374,19 @@ static void pnv_pec_instance_init(Object *obj) } } =20 +static int pnv_pec_phb_offset(PnvPhb4PecState *pec) +{ + PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); + int index =3D pec->index; + int offset =3D 0; + + while (index--) { + offset +=3D pecc->num_stacks[index]; + } + + return offset; +} + static void pnv_pec_realize(DeviceState *dev, Error **errp) { PnvPhb4PecState *pec =3D PNV_PHB4_PEC(dev); @@ -394,8 +407,10 @@ static void pnv_pec_realize(DeviceState *dev, Error **= errp) for (i =3D 0; i < pec->num_stacks; i++) { PnvPhb4PecStack *stack =3D &pec->stacks[i]; Object *stk_obj =3D OBJECT(stack); + int phb_id =3D pnv_pec_phb_offset(pec) + i; =20 object_property_set_int(stk_obj, "stack-no", i, &error_abort); + object_property_set_int(stk_obj, "phb-id", phb_id, &error_abort); object_property_set_link(stk_obj, "pec", OBJECT(pec), &error_abort= ); if (!qdev_realize(DEVICE(stk_obj), NULL, errp)) { return; @@ -538,6 +553,7 @@ static void pnv_pec_stk_instance_init(Object *obj) PnvPhb4PecStack *stack =3D PNV_PHB4_PEC_STACK(obj); =20 object_initialize_child(obj, "phb", &stack->phb, TYPE_PNV_PHB4); + object_property_add_alias(obj, "phb-id", OBJECT(&stack->phb), "index"); } =20 static void pnv_pec_stk_realize(DeviceState *dev, Error **errp) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 87edbbe91e0f..284fbd50dae3 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1384,7 +1384,6 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) { Pnv9Chip *chip9 =3D PNV9_CHIP(chip); int i, j; - int phb_id =3D 0; =20 for (i =3D 0; i < chip->num_pecs; i++) { PnvPhb4PecState *pec =3D &chip9->pecs[i]; @@ -1409,11 +1408,10 @@ static void pnv_chip_power9_phb_realize(PnvChip *ch= ip, Error **errp) pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr); pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr); =20 - for (j =3D 0; j < pec->num_stacks; j++, phb_id++) { + for (j =3D 0; j < pec->num_stacks; j++) { PnvPhb4PecStack *stack =3D &pec->stacks[j]; Object *obj =3D OBJECT(&stack->phb); =20 - object_property_set_int(obj, "index", phb_id, &error_fatal); object_property_set_int(obj, "chip-id", chip->chip_id, &error_fatal); object_property_set_int(obj, "version", pecc->version, --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402991467497.42344771714374; Mon, 13 Dec 2021 05:43:11 -0800 (PST) Received: from localhost ([::1]:51004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlbi-0006Qn-FJ for importer@patchew.org; Mon, 13 Dec 2021 08:43:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNy-0007YI-0c for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:58 -0500 Received: from smtpout4.mo529.mail-out.ovh.net ([217.182.185.173]:52017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNu-0000Jy-I0 for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:28:57 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.143.5]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 12CE9D19BEE5; Mon, 13 Dec 2021 14:28:53 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:52 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R0033d3ced66-25ca-45e5-a00e-5f7ed8abfd88, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 12/19] ppc/pnv: Remove "system-memory" property from PHB4 PEC Date: Mon, 13 Dec 2021 14:28:23 +0100 Message-ID: <20211213132830.108372-13-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: ef04644b-70ff-4291-af92-d351fe0241f7 X-Ovh-Tracer-Id: 5374201732249258790 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=217.182.185.173; envelope-from=clg@kaod.org; helo=smtpout4.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402992072100001 This is not useful and will be in the way for support of user created PHB4 devices. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb4_pec.c | 6 +----- hw/ppc/pnv.c | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index a7dd4173d598..dfed2af0f7df 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -124,7 +124,7 @@ static uint64_t pnv_pec_stk_nest_xscom_read(void *opaqu= e, hwaddr addr, static void pnv_pec_stk_update_map(PnvPhb4PecStack *stack) { PnvPhb4PecState *pec =3D stack->pec; - MemoryRegion *sysmem =3D pec->system_memory; + MemoryRegion *sysmem =3D get_system_memory(); uint64_t bar_en =3D stack->nest_regs[PEC_NEST_STK_BAR_EN]; uint64_t bar, mask, size; char name[64]; @@ -394,8 +394,6 @@ static void pnv_pec_realize(DeviceState *dev, Error **e= rrp) char name[64]; int i; =20 - assert(pec->system_memory); - if (pec->index >=3D PNV_CHIP_GET_CLASS(pec->chip)->num_pecs) { error_setg(errp, "invalid PEC index: %d", pec->index); return; @@ -486,8 +484,6 @@ static Property pnv_pec_properties[] =3D { DEFINE_PROP_UINT32("chip-id", PnvPhb4PecState, chip_id, 0), DEFINE_PROP_LINK("chip", PnvPhb4PecState, chip, TYPE_PNV_CHIP, PnvChip *), - DEFINE_PROP_LINK("system-memory", PnvPhb4PecState, system_memory, - TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 284fbd50dae3..c59a4a078cd0 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1396,8 +1396,6 @@ static void pnv_chip_power9_phb_realize(PnvChip *chip= , Error **errp) &error_fatal); object_property_set_link(OBJECT(pec), "chip", OBJECT(chip), &error_fatal); - object_property_set_link(OBJECT(pec), "system-memory", - OBJECT(get_system_memory()), &error_abort= ); if (!qdev_realize(DEVICE(pec), NULL, errp)) { return; } --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403627886125.61800572081768; Mon, 13 Dec 2021 05:53:47 -0800 (PST) Received: from localhost ([::1]:46276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwllz-0006kp-0Q for importer@patchew.org; Mon, 13 Dec 2021 08:53:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO2-0007pB-Hg for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:02 -0500 Received: from 9.mo548.mail-out.ovh.net ([46.105.48.137]:55961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNv-0000KF-8o for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:02 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.62]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 904AB20A8F; Mon, 13 Dec 2021 13:28:53 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:53 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003492d6eeb-7009-4398-b9b1-10fe5687df44, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 13/19] ppc/pnv: Move realize of PEC stacks under the PEC model Date: Mon, 13 Dec 2021 14:28:24 +0100 Message-ID: <20211213132830.108372-14-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: e99f0f81-a163-4585-85bf-532d9774b598 X-Ovh-Tracer-Id: 5374201730957347622 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.48.137; envelope-from=clg@kaod.org; helo=9.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403630312100001 This change will help us providing support for user created PHB4 devices. Reviewed-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb4_pec.c | 34 ++++++++++++++++++++++++++++++---- hw/ppc/pnv.c | 37 ++++--------------------------------- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index dfed2af0f7df..24a3adcae326 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -556,6 +556,10 @@ static void pnv_pec_stk_realize(DeviceState *dev, Erro= r **errp) { PnvPhb4PecStack *stack =3D PNV_PHB4_PEC_STACK(dev); PnvPhb4PecState *pec =3D stack->pec; + PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); + PnvChip *chip =3D pec->chip; + uint32_t pec_nest_base; + uint32_t pec_pci_base; char name[64]; =20 assert(pec); @@ -579,10 +583,32 @@ static void pnv_pec_stk_realize(DeviceState *dev, Err= or **errp) pnv_xscom_region_init(&stack->phb_regs_mr, OBJECT(&stack->phb), &pnv_phb4_xscom_ops, &stack->phb, name, 0x40); =20 - /* - * Let the machine/chip realize the PHB object to customize more - * easily some fields - */ + object_property_set_int(OBJECT(&stack->phb), "chip-id", pec->chip_id, + &error_fatal); + object_property_set_int(OBJECT(&stack->phb), "version", pecc->version, + &error_fatal); + object_property_set_int(OBJECT(&stack->phb), "device-id", pecc->device= _id, + &error_fatal); + object_property_set_link(OBJECT(&stack->phb), "stack", OBJECT(stack), + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&stack->phb), errp)) { + return; + } + + pec_nest_base =3D pecc->xscom_nest_base(pec); + pec_pci_base =3D pecc->xscom_pci_base(pec); + + /* Populate the XSCOM address space. */ + pnv_xscom_add_subregion(chip, + pec_nest_base + 0x40 * (stack->stack_no + 1), + &stack->nest_regs_mr); + pnv_xscom_add_subregion(chip, + pec_pci_base + 0x40 * (stack->stack_no + 1), + &stack->pci_regs_mr); + pnv_xscom_add_subregion(chip, + pec_pci_base + PNV9_XSCOM_PEC_PCI_STK0 + + 0x40 * stack->stack_no, + &stack->phb_regs_mr); } =20 static Property pnv_pec_stk_properties[] =3D { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index c59a4a078cd0..08b037f4e753 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1380,10 +1380,10 @@ static void pnv_chip_quad_realize(Pnv9Chip *chip9, = Error **errp) } } =20 -static void pnv_chip_power9_phb_realize(PnvChip *chip, Error **errp) +static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp) { Pnv9Chip *chip9 =3D PNV9_CHIP(chip); - int i, j; + int i; =20 for (i =3D 0; i < chip->num_pecs; i++) { PnvPhb4PecState *pec =3D &chip9->pecs[i]; @@ -1405,35 +1405,6 @@ static void pnv_chip_power9_phb_realize(PnvChip *chi= p, Error **errp) =20 pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr); pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr); - - for (j =3D 0; j < pec->num_stacks; j++) { - PnvPhb4PecStack *stack =3D &pec->stacks[j]; - Object *obj =3D OBJECT(&stack->phb); - - object_property_set_int(obj, "chip-id", chip->chip_id, - &error_fatal); - object_property_set_int(obj, "version", pecc->version, - &error_fatal); - object_property_set_int(obj, "device-id", pecc->device_id, - &error_fatal); - object_property_set_link(obj, "stack", OBJECT(stack), - &error_abort); - if (!sysbus_realize(SYS_BUS_DEVICE(obj), errp)) { - return; - } - - /* Populate the XSCOM address space. */ - pnv_xscom_add_subregion(chip, - pec_nest_base + 0x40 * (stack->stack_no= + 1), - &stack->nest_regs_mr); - pnv_xscom_add_subregion(chip, - pec_pci_base + 0x40 * (stack->stack_no= + 1), - &stack->pci_regs_mr); - pnv_xscom_add_subregion(chip, - pec_pci_base + PNV9_XSCOM_PEC_PCI_STK0= + - 0x40 * stack->stack_no, - &stack->phb_regs_mr); - } } } =20 @@ -1529,8 +1500,8 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) memory_region_add_subregion(get_system_memory(), PNV9_HOMER_BASE(chip), &chip9->homer.regs); =20 - /* PHBs */ - pnv_chip_power9_phb_realize(chip, &local_err); + /* PEC PHBs */ + pnv_chip_power9_pec_realize(chip, &local_err); if (local_err) { error_propagate(errp, local_err); return; --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403466681932.4827433673963; Mon, 13 Dec 2021 05:51:06 -0800 (PST) Received: from localhost ([::1]:39570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwljN-0001u6-Mw for importer@patchew.org; Mon, 13 Dec 2021 08:51:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO1-0007mg-S1 for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:01 -0500 Received: from 10.mo548.mail-out.ovh.net ([46.105.77.235]:57941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNv-0000KM-4a for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:01 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.62]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id ED89021503; Mon, 13 Dec 2021 13:28:53 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:53 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R0034ca5e4e5-5d3f-482a-9523-f63e16999128, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 14/19] ppc/pnv: Use QOM hierarchy to scan PEC PHB4 devices Date: Mon, 13 Dec 2021 14:28:25 +0100 Message-ID: <20211213132830.108372-15-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 02b644ad-c69a-41d0-889e-2924cf8153fd X-Ovh-Tracer-Id: 5374201734556388134 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.77.235; envelope-from=clg@kaod.org; helo=10.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403468229100001 When -nodefaults is supported for PHB4 devices, the pecs array under the chip will be empty. This will break the 'info pic' HMP command. Do a QOM loop on the chip children and look for PEC PHB4 devices instead. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- hw/ppc/pnv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 08b037f4e753..9de8b8353014 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -659,20 +659,26 @@ static void pnv_chip_power8_pic_print_info(PnvChip *c= hip, Monitor *mon) pnv_chip_power8_pic_print_info_child, mon); } =20 +static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaqu= e) +{ + Monitor *mon =3D opaque; + PnvPHB4 *phb4 =3D (PnvPHB4 *) object_dynamic_cast(child, TYPE_PNV_PHB4= ); + + if (phb4) { + pnv_phb4_pic_print_info(phb4, mon); + } + return 0; +} + static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon) { Pnv9Chip *chip9 =3D PNV9_CHIP(chip); - int i, j; =20 pnv_xive_pic_print_info(&chip9->xive, mon); pnv_psi_pic_print_info(&chip9->psi, mon); =20 - for (i =3D 0; i < chip->num_pecs; i++) { - PnvPhb4PecState *pec =3D &chip9->pecs[i]; - for (j =3D 0; j < pec->num_stacks; j++) { - pnv_phb4_pic_print_info(&pec->stacks[j].phb, mon); - } - } + object_child_foreach_recursive(OBJECT(chip), + pnv_chip_power9_pic_print_info_child, mon); } =20 static uint64_t pnv_chip_power8_xscom_core_base(PnvChip *chip, --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639402896913665.9555193535041; Mon, 13 Dec 2021 05:41:36 -0800 (PST) Received: from localhost ([::1]:45770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlaB-0002bq-UK for importer@patchew.org; Mon, 13 Dec 2021 08:41:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO4-0007x5-7I for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:04 -0500 Received: from 1.mo548.mail-out.ovh.net ([178.32.121.110]:37209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNv-0000Kg-Ub for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:03 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.1.214]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 790EC20B69; Mon, 13 Dec 2021 13:28:54 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:53 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R0031a50d783-459e-4ad0-866c-cb846e2cc1f7, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 15/19] ppc/pnv: Introduce support for user created PHB3 devices Date: Mon, 13 Dec 2021 14:28:26 +0100 Message-ID: <20211213132830.108372-16-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: fd038db1-5d66-4ac2-a863-f43df234f7b3 X-Ovh-Tracer-Id: 5374483206910151462 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.32.121.110; envelope-from=clg@kaod.org; helo=1.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639402898036100001 PHB3 devices and PCI devices can now be added to the powernv8 machine using : -device pnv-phb3,chip-id=3D0,index=3D1 \ -device nec-usb-xhci,bus=3Dpci.1,addr=3D0x0 The 'index' property identifies the PHB3 in the chip. In case of user created devices, a lookup on 'chip-id' is required to assign the owning chip. Reviewed-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 2 ++ hw/pci-host/pnv_phb3.c | 11 ++++++++++- hw/ppc/pnv.c | 23 ++++++++++++++++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index c781525277db..9b06a9e9948d 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -217,6 +217,8 @@ struct PnvMachineState { hwaddr fw_load_addr; }; =20 +PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id); + #define PNV_FDT_ADDR 0x01000000 #define PNV_TIMEBASE_FREQ 512000000ULL =20 diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 9c4451ca0d1c..4a022de7c1dc 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -993,6 +993,15 @@ static void pnv_phb3_realize(DeviceState *dev, Error *= *errp) PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); int i; =20 + /* User created devices */ + if (!phb->chip) { + phb->chip =3D pnv_get_chip(pnv, phb->chip_id); + if (!phb->chip) { + error_setg(errp, "invalid chip id: %d", phb->chip_id); + return; + } + } + if (phb->phb_id >=3D PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) { error_setg(errp, "invalid PHB index: %d", phb->phb_id); return; @@ -1105,7 +1114,7 @@ static void pnv_phb3_class_init(ObjectClass *klass, v= oid *data) dc->realize =3D pnv_phb3_realize; device_class_set_props(dc, pnv_phb3_properties); set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->user_creatable =3D false; + dc->user_creatable =3D true; } =20 static const TypeInfo pnv_phb3_type_info =3D { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 9de8b8353014..d134eca0ee9d 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1117,14 +1117,14 @@ static void pnv_chip_power8_instance_init(Object *o= bj) =20 object_initialize_child(obj, "homer", &chip8->homer, TYPE_PNV8_HOMER); =20 - for (i =3D 0; i < pcc->num_phbs; i++) { + if (defaults_enabled()) { + chip->num_phbs =3D pcc->num_phbs; + } + + for (i =3D 0; i < chip->num_phbs; i++) { object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_P= HB3); } =20 - /* - * Number of PHBs is the chip default - */ - chip->num_phbs =3D pcc->num_phbs; } =20 static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp) @@ -1806,6 +1806,19 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) return NULL; } =20 +PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id) +{ + int i; + + for (i =3D 0; i < pnv->num_chips; i++) { + PnvChip *chip =3D pnv->chips[i]; + if (chip->chip_id =3D=3D chip_id) { + return chip; + } + } + return NULL; +} + static int pnv_ics_resend_child(Object *child, void *opaque) { PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403383160643.312453100507; Mon, 13 Dec 2021 05:49:43 -0800 (PST) Received: from localhost ([::1]:34770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwli2-00072Z-4J for importer@patchew.org; Mon, 13 Dec 2021 08:49:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO4-0007xz-Cu for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:04 -0500 Received: from 7.mo548.mail-out.ovh.net ([46.105.33.25]:46757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNw-0000L9-8Y for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:04 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.109.138.22]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 0D301217FB; Mon, 13 Dec 2021 13:28:55 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:54 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R0032b7d66c4-2cc6-4c08-9471-516ecdeb0b40, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 16/19] ppc/pnv: Reparent user created PHB3 devices to the PnvChip Date: Mon, 13 Dec 2021 14:28:27 +0100 Message-ID: <20211213132830.108372-17-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: e3293306-5d5b-4d28-a1e0-88376f293907 X-Ovh-Tracer-Id: 5374483207635110694 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.33.25; envelope-from=clg@kaod.org; helo=7.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403384629100003 The powernv machine uses the object hierarchy to populate the device tree and each device should be parented to the chip it belongs to. This is not the case for user created devices which are parented to the container "/unattached". Make sure a PHB3 device is parented to its chip by reparenting the object if necessary. Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 1 + hw/pci-host/pnv_phb3.c | 6 ++++++ hw/ppc/pnv.c | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 9b06a9e9948d..ca27bd39f0ac 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -177,6 +177,7 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, TYPE_PNV_CHIP_POWER10) =20 PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); +void pnv_chip_parent_fixup(PnvChip *chip, Object *obj, int index); =20 #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") typedef struct PnvMachineClass PnvMachineClass; diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 4a022de7c1dc..62a184c9ddc9 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -1000,6 +1000,12 @@ static void pnv_phb3_realize(DeviceState *dev, Error= **errp) error_setg(errp, "invalid chip id: %d", phb->chip_id); return; } + + /* + * Reparent user created devices to the chip to build + * correctly the device tree. + */ + pnv_chip_parent_fixup(phb->chip, OBJECT(phb), phb->phb_id); } =20 if (phb->phb_id >=3D PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index d134eca0ee9d..ac048a0a5d24 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1806,6 +1806,23 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) return NULL; } =20 +void pnv_chip_parent_fixup(PnvChip *chip, Object *obj, int index) +{ + Object *parent =3D OBJECT(chip); + g_autofree char *default_id =3D + g_strdup_printf("%s[%d]", object_get_typename(obj), index); + + if (obj->parent =3D=3D parent) { + return; + } + + object_ref(obj); + object_unparent(obj); + object_property_add_child( + parent, DEVICE(obj)->id ? DEVICE(obj)->id : default_id, obj); + object_unref(obj); +} + PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id) { int i; --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403099895422.27640333368345; Mon, 13 Dec 2021 05:44:59 -0800 (PST) Received: from localhost ([::1]:54098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwldS-0000Hu-R3 for importer@patchew.org; Mon, 13 Dec 2021 08:44:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO6-00087Q-FV for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:06 -0500 Received: from 8.mo548.mail-out.ovh.net ([46.105.45.231]:33731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNx-0000LP-AD for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:06 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.1.141]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 8CCB32043F; Mon, 13 Dec 2021 13:28:55 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:54 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003fd60b9fb-3902-4d71-ae11-fabe0fb27068, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 17/19] ppc/pnv: Complete user created PHB3 devices Date: Mon, 13 Dec 2021 14:28:28 +0100 Message-ID: <20211213132830.108372-18-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: b91fa9d8-ec75-41d8-abcd-fdacfb691238 X-Ovh-Tracer-Id: 5374764681978415910 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=46.105.45.231; envelope-from=clg@kaod.org; helo=8.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403101302100001 PHB3s ared SysBus devices and should be allowed to be dynamically created. Reviewed-by: Daniel Henrique Barboza Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb3.c | 9 +++++++++ hw/ppc/pnv.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 62a184c9ddc9..e51ae4c969e8 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -995,6 +995,9 @@ static void pnv_phb3_realize(DeviceState *dev, Error **= errp) =20 /* User created devices */ if (!phb->chip) { + Error *local_err =3D NULL; + BusState *s; + phb->chip =3D pnv_get_chip(pnv, phb->chip_id); if (!phb->chip) { error_setg(errp, "invalid chip id: %d", phb->chip_id); @@ -1006,6 +1009,12 @@ static void pnv_phb3_realize(DeviceState *dev, Error= **errp) * correctly the device tree. */ pnv_chip_parent_fixup(phb->chip, OBJECT(phb), phb->phb_id); + + s =3D qdev_get_parent_bus(DEVICE(phb->chip)); + if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) { + error_propagate(errp, local_err); + return; + } } =20 if (phb->phb_id >=3D PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index ac048a0a5d24..9c45aae1befe 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1933,6 +1933,8 @@ static void pnv_machine_power8_class_init(ObjectClass= *oc, void *data) =20 pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB3); } =20 static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403371322603.8924684049756; Mon, 13 Dec 2021 05:49:31 -0800 (PST) Received: from localhost ([::1]:33562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlhq-0006FM-8x for importer@patchew.org; Mon, 13 Dec 2021 08:49:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO7-0008Bm-CH for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:07 -0500 Received: from 5.mo548.mail-out.ovh.net ([188.165.49.213]:46801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNy-0000MB-UG for qemu-devel@nongnu.org; Mon, 13 Dec 2021 08:29:07 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.17]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 89A8920339; Mon, 13 Dec 2021 13:28:57 +0000 (UTC) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:55 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R00336f944fc-94ac-45bc-96d5-6901a470c2a5, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 18/19] ppc/pnv: Introduce support for user created PHB4 devices Date: Mon, 13 Dec 2021 14:28:29 +0100 Message-ID: <20211213132830.108372-19-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 409071c2-6e28-4837-b1ae-341b7de27b4b X-Ovh-Tracer-Id: 5375327633280043814 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpedutdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg 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=188.165.49.213; envelope-from=clg@kaod.org; helo=5.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403372298100001 PHB4 devices and PCI devices can now be added to the powernv9 machine using: -device pnv-phb4-pec,chip-id=3D0,index=3D0 -device nec-usb-xhci,bus=3Dpci.0,addr=3D0x0 In case of user created devices, a lookup on 'chip-id' is required to assign the owning chip. To be noted, that the PEC PHB4 devices can add more than one PHB4 devices: * PEC0 provides 1 PHB (PHB0) * PEC1 provides 2 PHBs (PHB1 and PHB2) * PEC2 provides 3 PHBs (PHB3, PHB4 and PHB5) Reviewed-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat Signed-off-by: C=C3=A9dric Le Goater --- hw/pci-host/pnv_phb4_pec.c | 19 ++++++++++++++++++- hw/ppc/pnv.c | 5 +++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 24a3adcae326..4fbb8061455d 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -394,6 +394,17 @@ static void pnv_pec_realize(DeviceState *dev, Error **= errp) char name[64]; int i; =20 + /* User created devices */ + if (!pec->chip) { + PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); + + pec->chip =3D pnv_get_chip(pnv, pec->chip_id); + if (!pec->chip) { + error_setg(errp, "invalid chip id: %d", pec->chip_id); + return; + } + } + if (pec->index >=3D PNV_CHIP_GET_CLASS(pec->chip)->num_pecs) { error_setg(errp, "invalid PEC index: %d", pec->index); return; @@ -401,6 +412,12 @@ static void pnv_pec_realize(DeviceState *dev, Error **= errp) =20 pec->num_stacks =3D pecc->num_stacks[pec->index]; =20 + /* + * Reparent user created devices to the chip to build correctly + * the device tree. + */ + pnv_chip_parent_fixup(pec->chip, OBJECT(pec), pec->index); + /* Create stacks */ for (i =3D 0; i < pec->num_stacks; i++) { PnvPhb4PecStack *stack =3D &pec->stacks[i]; @@ -516,7 +533,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) =20 dc->realize =3D pnv_pec_realize; device_class_set_props(dc, pnv_pec_properties); - dc->user_creatable =3D false; + dc->user_creatable =3D true; =20 pecc->xscom_nest_base =3D pnv_pec_xscom_nest_base; pecc->xscom_pci_base =3D pnv_pec_xscom_pci_base; diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 9c45aae1befe..2b027e299d27 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1350,8 +1350,9 @@ static void pnv_chip_power9_instance_init(Object *obj) =20 object_initialize_child(obj, "homer", &chip9->homer, TYPE_PNV9_HOMER); =20 - /* Number of PECs is the chip default */ - chip->num_pecs =3D pcc->num_pecs; + if (defaults_enabled()) { + chip->num_pecs =3D pcc->num_pecs; + } =20 for (i =3D 0; i < chip->num_pecs; i++) { object_initialize_child(obj, "pec[*]", &chip9->pecs[i], --=20 2.31.1 From nobody Wed May 15 01:47:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1639403531425187.25290244817893; Mon, 13 Dec 2021 05:52:11 -0800 (PST) Received: from localhost ([::1]:42774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwlkQ-0004CT-Bl for importer@patchew.org; Mon, 13 Dec 2021 08:52:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlO7-0008D3-KW; Mon, 13 Dec 2021 08:29:07 -0500 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:57777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwlNz-0000ML-Lz; Mon, 13 Dec 2021 08:29:07 -0500 Received: from mxplan5.mail.ovh.net (unknown [10.108.20.191]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 0529FD19BEF5; Mon, 13 Dec 2021 14:28:58 +0100 (CET) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 14:28:57 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-100R003710f58b3-50ef-4207-a749-2896319278b2, B1BC92F71A951DCA4C6DA1690085DBFA0C2EFA12) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: , Subject: [PATCH v2 19/19] ppc/pnv: Move num_phbs under Pnv8Chip Date: Mon, 13 Dec 2021 14:28:30 +0100 Message-ID: <20211213132830.108372-20-clg@kaod.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211213132830.108372-1-clg@kaod.org> References: <20211213132830.108372-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: 03c7aede-9810-4171-a7ff-6475bb94dcac X-Ovh-Tracer-Id: 5375327632686680870 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgihesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeehheefgeejiedtffefteejudevjeeufeeugfdtfeeuleeuteevleeihffhgfdtleenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddttdenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopegtlhhgsehkrghougdrohhrgh 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=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frederic Barrat , Daniel Henrique Barboza , Greg Kurz , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1639403532654100003 It is not used elsewhere so that's where it belongs. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Daniel Henrique Barboza --- include/hw/ppc/pnv.h | 4 ++-- hw/ppc/pnv.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index ca27bd39f0ac..251c9854329d 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -52,7 +52,6 @@ struct PnvChip { uint64_t cores_mask; PnvCore **cores; =20 - uint32_t num_phbs; uint32_t num_pecs; =20 MemoryRegion xscom_mmio; @@ -82,6 +81,7 @@ struct Pnv8Chip { =20 #define PNV8_CHIP_PHB3_MAX 4 PnvPHB3 phbs[PNV8_CHIP_PHB3_MAX]; + uint32_t num_phbs; =20 XICSFabric *xics; }; @@ -136,8 +136,8 @@ struct PnvChipClass { /*< public >*/ uint64_t chip_cfam_id; uint64_t cores_mask; - uint32_t num_phbs; uint32_t num_pecs; + uint32_t num_phbs; =20 DeviceRealize parent_realize; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 2b027e299d27..8a3732c982e5 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1099,7 +1099,6 @@ static void pnv_chip_power10_intc_print_info(PnvChip = *chip, PowerPCCPU *cpu, =20 static void pnv_chip_power8_instance_init(Object *obj) { - PnvChip *chip =3D PNV_CHIP(obj); Pnv8Chip *chip8 =3D PNV8_CHIP(obj); PnvChipClass *pcc =3D PNV_CHIP_GET_CLASS(obj); int i; @@ -1118,10 +1117,10 @@ static void pnv_chip_power8_instance_init(Object *o= bj) object_initialize_child(obj, "homer", &chip8->homer, TYPE_PNV8_HOMER); =20 if (defaults_enabled()) { - chip->num_phbs =3D pcc->num_phbs; + chip8->num_phbs =3D pcc->num_phbs; } =20 - for (i =3D 0; i < chip->num_phbs; i++) { + for (i =3D 0; i < chip8->num_phbs; i++) { object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_P= HB3); } =20 @@ -1239,7 +1238,7 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) &chip8->homer.regs); =20 /* PHB3 controllers */ - for (i =3D 0; i < chip->num_phbs; i++) { + for (i =3D 0; i < chip8->num_phbs; i++) { PnvPHB3 *phb =3D &chip8->phbs[i]; =20 object_property_set_int(OBJECT(phb), "index", i, &error_fatal); --=20 2.31.1