qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 06/14] ppc/pnv: Complete user created PHB3 devices


From: Frederic Barrat
Subject: Re: [PATCH 06/14] ppc/pnv: Complete user created PHB3 devices
Date: Tue, 7 Dec 2021 10:53:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0



On 02/12/2021 15:42, Cédric Le Goater wrote:
PHB3s ared SysBus devices and should be allowed to be dynamically
created.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

This one is a bit of black magic for me. I don't see an equivalent for P9 though. Not needed there? I'll have another comment about P8/P9 later.

  Fred


  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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]