* [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy
@ 2022-02-18 20:28 Daniel Henrique Barboza
2022-02-26 13:49 ` Cédric Le Goater
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Henrique Barboza @ 2022-02-18 20:28 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel Henrique Barboza, qemu-ppc, clg, david
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.
Fixes: 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/pci-host/pnv_phb4.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index e91249ef64..846e7d0c3e 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -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 */
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy
2022-02-18 20:28 [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy Daniel Henrique Barboza
@ 2022-02-26 13:49 ` Cédric Le Goater
2022-02-28 13:51 ` Daniel Henrique Barboza
0 siblings, 1 reply; 4+ messages in thread
From: Cédric Le Goater @ 2022-02-26 13:49 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel; +Cc: qemu-ppc, david
On 2/18/22 21:28, Daniel Henrique Barboza wrote:
> 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.
>
> Fixes: 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
What about the pnv-phb3/4-root-port devices ? Should we attached
them also to the QOM hierarchy ?
Thanks,
C.
> ---
> hw/pci-host/pnv_phb4.c | 36 ++++++++++++++++--------------------
> 1 file changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index e91249ef64..846e7d0c3e 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -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 */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy
2022-02-26 13:49 ` Cédric Le Goater
@ 2022-02-28 13:51 ` Daniel Henrique Barboza
2022-03-01 8:28 ` Cédric Le Goater
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Henrique Barboza @ 2022-02-28 13:51 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel; +Cc: qemu-ppc, david
On 2/26/22 10:49, Cédric Le Goater wrote:
> On 2/18/22 21:28, Daniel Henrique Barboza wrote:
>> 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.
>>
>> Fixes: 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")
>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>
>
> 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
>
> Thanks,
>
> C.
>
>> ---
>> hw/pci-host/pnv_phb4.c | 36 ++++++++++++++++--------------------
>> 1 file changed, 16 insertions(+), 20 deletions(-)
>>
>> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
>> index e91249ef64..846e7d0c3e 100644
>> --- a/hw/pci-host/pnv_phb4.c
>> +++ b/hw/pci-host/pnv_phb4.c
>> @@ -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 */
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy
2022-02-28 13:51 ` Daniel Henrique Barboza
@ 2022-03-01 8:28 ` Cédric Le Goater
0 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2022-03-01 8:28 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel; +Cc: qemu-ppc, david
On 2/28/22 14:51, Daniel Henrique Barboza wrote:
>
>
> On 2/26/22 10:49, Cédric Le Goater wrote:
>> On 2/18/22 21:28, Daniel Henrique Barboza wrote:
>>> 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.
>>>
>>> Fixes: 3f4c369ea63e ("ppc/pnv: make PECs create and realize PHB4s")
>>> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
>>
>>
>> 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-01 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18 20:28 [PATCH] ppc/pnv: fix default PHB4 QOM hierarchy Daniel Henrique Barboza
2022-02-26 13:49 ` Cédric Le Goater
2022-02-28 13:51 ` Daniel Henrique Barboza
2022-03-01 8:28 ` Cédric Le Goater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).