qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 11/11] ppc/pnv: move PHB4 parent fixup to phb4_realize()


From: Daniel Henrique Barboza
Subject: [PATCH 11/11] ppc/pnv: move PHB4 parent fixup to phb4_realize()
Date: Mon, 13 Jun 2022 12:44:56 -0300

After the code cleanups done in the past, default PHB4 code is already
fairly close to user created PHB4s. What we need to do to make it equal
is move the QOM and bus parenting changes from
pnv_pec_default_phb_realize() to pnv_phb4_realize().

Using the same logic for both cases (aside from PEC assigning) will make
our lives easier when re-enabling user created PHB4s.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.ibm.com>
---
 hw/pci-host/pnv_phb4.c     | 12 ++++++++++++
 hw/pci-host/pnv_phb4_pec.c |  1 -
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index bfec8b9f6d..fd6fac21ac 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1553,6 +1553,18 @@ static void pnv_phb4_realize(DeviceState *dev, Error 
**errp)
     int nr_irqs;
     char name[32];
 
+    /*
+     * We need the PEC to parent the PHB to allow the DT
+     * to build correctly (via pnv_xscom_dt()).
+     */
+    pnv_parent_qom_fixup(OBJECT(phb->pec), OBJECT(phb), phb->phb_id);
+
+    /*
+     * pnv-phb4 buses are child of the main-system-bus, same as
+     * the chip.
+     */
+    pnv_parent_bus_fixup(DEVICE(phb->pec->chip), dev);
+
     /* Set the "big_phb" flag */
     phb->big_phb = phb->phb_id == 0 || phb->phb_id == 3;
 
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index c9aaf1c28e..eb47b50737 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -119,7 +119,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState 
*pec,
     PnvPHB4 *phb = PNV_PHB4(qdev_new(pecc->phb_type));
     int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
 
-    object_property_add_child(OBJECT(pec), "phb[*]", OBJECT(phb));
     object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
                              &error_abort);
     object_property_set_int(OBJECT(phb), "chip-id", pec->chip_id,
-- 
2.36.1




reply via email to

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