ppc/pnv: fix default PHB4 QOM hierarchy
PATCH 1/1 ppc/pnv: fix default PHB4 QOM hierarchy
Commit 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s") changed phb4_pec code to create the default PHB4 objects in pnv_pec_default_phb_realize(). In this process the stacks[] PEC array was removed and each PHB4 object is tied together with its PEC via the phb->pec pointer.
This change also broke the previous QOM hierarchy - the PHB4 objects are being created and not being parented to their respective chips. This can be verified by 'info pic' in a powernv9 domain with default settings. pnv_chip_power9_pic_print_info() will fail to find the PHBs because object_child_foreach_recursive() won't find any.
The solution is to set the parent chip and the parent bus, in the same way done for user created PHB4 devices, for all PHB4 devices.
--- hw/pci-host/pnv_phb4.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-)
hw/pci-host/pnv_phb4.c +16 -20
@@ -1568,40 +1568,36 @@ static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB4 *phb,static void pnv_phb4_realize (DeviceState *dev,Error **errp) {PnvPHB4 *phb =PNV_PHB4 (dev); +PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ()); +PnvChip *chip =pnv_get_chip (pnv, phb->chip_id);PCIHostState *pci =PCI_HOST_BRIDGE (dev);XiveSource *xsrc = &phb->xsrc; +BusState *s;Error *local_err =NULL ;int nr_irqs;char name[32 ]; -/* User created PHB */ -if (!phb->pec) { -PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ()); -PnvChip *chip =pnv_get_chip (pnv, phb->chip_id); -BusState *s; - -if (!chip) { -error_setg (errp,"invalid chip id: %d" , phb->chip_id); -return ; - } +if (!chip) { +error_setg (errp,"invalid chip id: %d" , phb->chip_id); +return ; + } +/* User created PHBs need to be assigned to a PEC */ +if (!phb->pec) { phb->pec =pnv_phb4_get_pec (chip, phb, &local_err);if (local_err) {error_propagate (errp, local_err);return ; } + } -/* -* Reparent user created devices to the chip to build -* correctly the device tree. -*/ -pnv_chip_parent_fixup (chip,OBJECT (phb), phb->phb_id); +/* Reparent the PHB to the chip to build the device tree */ +pnv_chip_parent_fixup (chip,OBJECT (phb), phb->phb_id); - s =qdev_get_parent_bus (DEVICE (chip)); -if (!qdev_set_parent_bus (DEVICE (phb), s, &local_err)) { -error_propagate (errp, local_err); -return ; - } + s =qdev_get_parent_bus (DEVICE (chip)); +if (!qdev_set_parent_bus (DEVICE (phb), s, &local_err)) { +error_propagate (errp, local_err); +return ; }/* Set the "big_phb" flag */
Signature · 1 line
2.34.1
Quoted 12 lines · Daniel Henrique Barboza
Commit
3f4c369ea63e("ppc/pnv: make PECs create and realize PHB4s") changedphb4_peccode to create the default PHB4 objects inpnv_pec_default_phb_realize(). In this process the stacks[] PEC array was removed and each PHB4 object is tied together with its PEC via thephb->pecpointer.This change also broke the previous QOM hierarchy - the PHB4 objects are being created and not being parented to their respective chips. This can be verified by 'info pic' in a powernv9 domain with default settings.
pnv_chip_power9_pic_print_info()will fail to find the PHBs becauseobject_child_foreach_recursive()won't find any.
Quoted 5 lines
The solution is to set the parent chip and the parent bus, in the same way done for user created PHB4 devices, for all PHB4 devices.
Fixes 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")Signed-off-by Daniel Henrique Barboza <[email protected]>
What about the pnv-phb3/4-root-port devices ? Should we attached them also to the QOM hierarchy ?
Thanks,
C.
Quoted 65 lines
--- hw/pci-host/pnv_phb4.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-)hw/pci-host/pnv_phb4.c +16
-20@@ -1568,40 +1568,36 @@ static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB4 *phb,static void pnv_phb4_realize (DeviceState *dev,Error **errp) {PnvPHB4 *phb =PNV_PHB4 (dev); +PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ()); +PnvChip *chip =pnv_get_chip (pnv, phb->chip_id);PCIHostState *pci =PCI_HOST_BRIDGE (dev);XiveSource *xsrc = &phb->xsrc; +BusState *s;Error *local_err =NULL ;int nr_irqs;char name[32 ]; -/* User created PHB */ -if (!phb->pec) { -PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ()); -PnvChip *chip =pnv_get_chip (pnv, phb->chip_id); -BusState *s; - -if (!chip) { -error_setg (errp,"invalid chip id: %d" , phb->chip_id); -return ; - } +if (!chip) { +error_setg (errp,"invalid chip id: %d" , phb->chip_id); +return ; + } +/* User created PHBs need to be assigned to a PEC */ +if (!phb->pec) { phb->pec =pnv_phb4_get_pec (chip, phb, &local_err);if (local_err) {error_propagate (errp, local_err);return ; } + } -/* -* Reparent user created devices to the chip to build -* correctly the device tree. -*/ -pnv_chip_parent_fixup (chip,OBJECT (phb), phb->phb_id); +/* Reparent the PHB to the chip to build the device tree */ +pnv_chip_parent_fixup (chip,OBJECT (phb), phb->phb_id); - s =qdev_get_parent_bus (DEVICE (chip)); -if (!qdev_set_parent_bus (DEVICE (phb), s, &local_err)) { -error_propagate (errp, local_err); -return ; - } + s =qdev_get_parent_bus (DEVICE (chip)); +if (!qdev_set_parent_bus (DEVICE (phb), s, &local_err)) { +error_propagate (errp, local_err); +return ; }/* Set the "big_phb" flag */
Quoted 16 lines · Cédric Le Goater
Quoted 15 lines · Daniel Henrique Barboza
Commit
3f4c369ea63e("ppc/pnv: make PECs create and realize PHB4s") changedphb4_peccode to create the default PHB4 objects inpnv_pec_default_phb_realize(). In this process the stacks[] PEC array was removed and each PHB4 object is tied together with its PEC via thephb->pecpointer.This change also broke the previous QOM hierarchy - the PHB4 objects are being created and not being parented to their respective chips. This can be verified by 'info pic' in a powernv9 domain with default settings.
pnv_chip_power9_pic_print_info()will fail to find the PHBs becauseobject_child_foreach_recursive()won't find any.The solution is to set the parent chip and the parent bus, in the same way done for user created PHB4 devices, for all PHB4 devices.
Quoted 6 lines
Quoted 2 lines
Fixes 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")Signed-off-by Daniel Henrique Barboza <[email protected]>What about the pnv-phb3/4-root-port devices ? Should we attached them also to the QOM hierarchy ?
I guess it wouldn't hurt. I'll see what I can do.
Thanks,
Daniel
Quoted 66 lines
Thanks,
C.
Quoted 60 lines
---
hw/pci-host/pnv_phb4.c| 36 ++++++++++++++++--------------------1 file changed, 16 insertions(+), 20 deletions(-)hw/pci-host/pnv_phb4.c +16
-20@@ -1568,40 +1568,36 @@ static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB4 *phb, static void pnv_phb4_realize(DeviceState *dev, Error **errp) { PnvPHB4 *phb = PNV_PHB4(dev); + PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); + PnvChip *chip = pnv_get_chip(pnv, phb->chip_id); PCIHostState *pci = PCI_HOST_BRIDGE(dev); XiveSource *xsrc = &phb->xsrc; + BusState *s; Error *local_err = NULL; int nr_irqs; char name[32]; - /* User created PHB */ - if (!phb->pec) { - PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); - PnvChip *chip = pnv_get_chip(pnv, phb->chip_id); - BusState *s; - - if (!chip) { - error_setg(errp, "invalid chip id: %d", phb->chip_id); - return; - } + if (!chip) { + error_setg(errp, "invalid chip id: %d", phb->chip_id); + return; + } + /* User created PHBs need to be assigned to a PEC */ + if (!phb->pec) { phb->pec = pnv_phb4_get_pec(chip, phb, &local_err); if (local_err) { error_propagate(errp, local_err); return; } + } - /* - * Reparent user created devices to the chip to build - * correctly the device tree. - */ - pnv_chip_parent_fixup(chip, OBJECT(phb), phb->phb_id); + /* Reparent the PHB to the chip to build the device tree */ + pnv_chip_parent_fixup(chip, OBJECT(phb), phb->phb_id); - s = qdev_get_parent_bus(DEVICE(chip)); - if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) { - error_propagate(errp, local_err); - return; - } + s = qdev_get_parent_bus(DEVICE(chip)); + if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) { + error_propagate(errp, local_err); + return; } /* Set the "big_phb" flag */
Quoted 23 lines · Daniel Henrique Barboza
Quoted 20 lines · Cédric Le Goater
Quoted 17 lines · Daniel Henrique Barboza
Commit
3f4c369ea63e("ppc/pnv: make PECs create and realize PHB4s") changedphb4_peccode to create the default PHB4 objects inpnv_pec_default_phb_realize(). In this process the stacks[] PEC array was removed and each PHB4 object is tied together with its PEC via thephb->pecpointer.This change also broke the previous QOM hierarchy - the PHB4 objects are being created and not being parented to their respective chips. This can be verified by 'info pic' in a powernv9 domain with default settings.
pnv_chip_power9_pic_print_info()will fail to find the PHBs becauseobject_child_foreach_recursive()won't find any.The solution is to set the parent chip and the parent bus, in the same way done for user created PHB4 devices, for all PHB4 devices.
Fixes 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")Signed-off-by Daniel Henrique Barboza <[email protected]>
Quoted 5 lines
Quoted 2 lines
What about the pnv-phb3/4-root-port devices ? Should we attached them also to the QOM hierarchy ?
I guess it wouldn't hurt. I'll see what I can do.
I took it as it is for ppc-7.0. Changes can come after. Nothing critical.
Thanks,
C.