diff mbox series

[2/3] ppc/pnv: Fixes for user-created pnv-phb5 devices

Message ID 20220310155101.294568-3-fbarrat@linux.ibm.com
State Accepted, archived
Headers show
Series Fix user-created PHB devices on POWER10 | expand

Commit Message

Frederic Barrat March 10, 2022, 3:51 p.m. UTC
Two small fixes to fix user-created devices for POWER10:
- always create the PECs (PCI Express Controller) for the system. The
PECs host the PHBs and we try to find the matching PEC when creating a
PHB, so it must exist. It also matches what we do on POWER9
- the machine class must allow dynamically allocated system bus

Fixes: 623575e16cd5 ("ppc/pnv: Add model for POWER10 PHB5 PCIe Host bridge")
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/ppc/pnv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Cédric Le Goater March 10, 2022, 4:16 p.m. UTC | #1
On 3/10/22 16:51, Frederic Barrat wrote:
> Two small fixes to fix user-created devices for POWER10:
> - always create the PECs (PCI Express Controller) for the system. The
> PECs host the PHBs and we try to find the matching PEC when creating a
> PHB, so it must exist. It also matches what we do on POWER9
> - the machine class must allow dynamically allocated system bus
> 
> Fixes: 623575e16cd5 ("ppc/pnv: Add model for POWER10 PHB5 PCIe Host bridge")
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
>   hw/ppc/pnv.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)



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

Queued for 7.0.

Thanks,

C.


> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 0ac86e104f..df58403a3a 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1600,9 +1600,7 @@ static void pnv_chip_power10_instance_init(Object *obj)
>       object_initialize_child(obj, "occ",  &chip10->occ, TYPE_PNV10_OCC);
>       object_initialize_child(obj, "homer", &chip10->homer, TYPE_PNV10_HOMER);
>   
> -    if (defaults_enabled()) {
> -        chip->num_pecs = pcc->num_pecs;
> -    }
> +    chip->num_pecs = pcc->num_pecs;
>   
>       for (i = 0; i < chip->num_pecs; i++) {
>           object_initialize_child(obj, "pec[*]", &chip10->pecs[i],
> @@ -2171,6 +2169,8 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
>       pmc->dt_power_mgt = pnv_dt_power_mgt;
>   
>       xfc->match_nvt = pnv10_xive_match_nvt;
> +
> +    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB5);
>   }
>   
>   static bool pnv_machine_get_hb(Object *obj, Error **errp)
diff mbox series

Patch

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 0ac86e104f..df58403a3a 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1600,9 +1600,7 @@  static void pnv_chip_power10_instance_init(Object *obj)
     object_initialize_child(obj, "occ",  &chip10->occ, TYPE_PNV10_OCC);
     object_initialize_child(obj, "homer", &chip10->homer, TYPE_PNV10_HOMER);
 
-    if (defaults_enabled()) {
-        chip->num_pecs = pcc->num_pecs;
-    }
+    chip->num_pecs = pcc->num_pecs;
 
     for (i = 0; i < chip->num_pecs; i++) {
         object_initialize_child(obj, "pec[*]", &chip10->pecs[i],
@@ -2171,6 +2169,8 @@  static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
     pmc->dt_power_mgt = pnv_dt_power_mgt;
 
     xfc->match_nvt = pnv10_xive_match_nvt;
+
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB5);
 }
 
 static bool pnv_machine_get_hb(Object *obj, Error **errp)