On 12/7/21 10:53, Frederic Barrat wrote:
>
>
> 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.
Yes. QEMU internals related to sysbus. I am not an expert either.
> I don't see an equivalent for P9 though. Not needed there?
No because the phb4-pec devices are simple devices. Not tied to sysbus.
Thanks,
C.
> 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)
>>