[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/14] ppc/pnv: Complete user created PHB3 devices
From: |
Cédric Le Goater |
Subject: |
[PATCH 06/14] ppc/pnv: Complete user created PHB3 devices |
Date: |
Thu, 2 Dec 2021 15:42:27 +0100 |
PHB3s ared SysBus devices and should be allowed to be dynamically
created.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
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 e91f658b0060..b61f9c369f64 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -1000,6 +1000,9 @@ static void pnv_phb3_realize(DeviceState *dev, Error
**errp)
/* User created devices */
if (!phb->chip) {
+ Error *local_err = NULL;
+ BusState *s;
+
phb->chip = pnv_get_chip(pnv, phb->chip_id);
if (!phb->chip) {
error_setg(errp, "invalid chip id: %d", phb->chip_id);
@@ -1011,6 +1014,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 = qdev_get_parent_bus(DEVICE(phb->chip));
+ if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) {
+ error_propagate(errp, local_err);
+ return;
+ }
}
/* LSI sources */
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 9a458655efd9..45d8ecbf2bf7 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1927,6 +1927,8 @@ static void pnv_machine_power8_class_init(ObjectClass
*oc, void *data)
pmc->compat = compat;
pmc->compat_size = sizeof(compat);
+
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB3);
}
static void pnv_machine_power9_class_init(ObjectClass *oc, void *data)
--
2.31.1
- Re: [PATCH 04/14] ppc/pnv: Introduce support for user created PHB3 devices, (continued)
[PATCH 09/14] ppc/pnv: Introduce a "chip" property under the PHB4 model, Cédric Le Goater, 2021/12/02
[PATCH 06/14] ppc/pnv: Complete user created PHB3 devices,
Cédric Le Goater <=
[PATCH 08/14] ppc/pnv: Introduce version and device_id class atributes for PHB4 devices, Cédric Le Goater, 2021/12/02
[PATCH 10/14] ppc/pnv: Introduce a num_stack class attribute, Cédric Le Goater, 2021/12/02