All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs
@ 2021-12-22  6:38 Cédric Le Goater
  2021-12-22  6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

Hello,

There are the last cleanups preparing ground for PHBs created on the
command line and possibly libvirt support.

Thanks,

C.

Cédric Le Goater (5):
  ppc/pnv: Change the maximum of PHB3 devices for Power8NVL
  ppc/pnv: Remove PHB4 reset handler
  ppc/pnv: Remove the PHB4 "device-id" property
  ppc/pnv: Attach PHB3 root port device when defaults are enabled
  ppc/pnv: Attach PHB4 root port device when defaults are enabled

 include/hw/pci-host/pnv_phb3.h |  2 --
 include/hw/pci-host/pnv_phb4.h |  4 ----
 hw/pci-host/pnv_phb3.c         |  8 --------
 hw/pci-host/pnv_phb4.c         | 25 -------------------------
 hw/pci-host/pnv_phb4_pec.c     |  3 ---
 hw/ppc/pnv.c                   | 25 +++++++++++++++++++++++--
 6 files changed, 23 insertions(+), 44 deletions(-)

-- 
2.31.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
@ 2021-12-22  6:38 ` Cédric Le Goater
  2021-12-22 18:11   ` Daniel Henrique Barboza
  2021-12-22  6:38 ` [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler Cédric Le Goater
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

The POWER8 processors with a NVLink logic unit have 4 PHB3 devices per
chip.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/pnv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 29ee0d0f08b4..9de8b8353014 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1314,7 +1314,7 @@ static void pnv_chip_power8nvl_class_init(ObjectClass *klass, void *data)
 
     k->chip_cfam_id = 0x120d304980000000ull;  /* P8 Naples DD1.0 */
     k->cores_mask = POWER8_CORE_MASK;
-    k->num_phbs = 3;
+    k->num_phbs = 4;
     k->core_pir = pnv_chip_core_pir_p8;
     k->intc_create = pnv_chip_power8_intc_create;
     k->intc_reset = pnv_chip_power8_intc_reset;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
  2021-12-22  6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
@ 2021-12-22  6:38 ` Cédric Le Goater
  2021-12-22 18:12   ` Daniel Henrique Barboza
  2021-12-22  6:38 ` [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property Cédric Le Goater
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

The PHB4 reset handler was preparing ground for PHB5 to set
appropriately the device id. We don't need it for the PHB4 since the
device id is already set in the root port complex. PH5 will introduce
its own.

"device-id" property is now useless. It should be removed.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/pci-host/pnv_phb4.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 40b793201a34..4caf03310fab 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1229,18 +1229,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
     phb->qirqs = qemu_allocate_irqs(xive_source_set_irq, xsrc, xsrc->nr_irqs);
 }
 
-static void pnv_phb4_reset(DeviceState *dev)
-{
-    PnvPHB4 *phb = PNV_PHB4(dev);
-    PCIDevice *root_dev = PCI_DEVICE(&phb->root);
-
-    /*
-     * Configure PCI device id at reset using a property.
-     */
-    pci_config_set_vendor_id(root_dev->config, PCI_VENDOR_ID_IBM);
-    pci_config_set_device_id(root_dev->config, phb->device_id);
-}
-
 static const char *pnv_phb4_root_bus_path(PCIHostState *host_bridge,
                                           PCIBus *rootbus)
 {
@@ -1290,7 +1278,6 @@ static void pnv_phb4_class_init(ObjectClass *klass, void *data)
     device_class_set_props(dc, pnv_phb4_properties);
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
     dc->user_creatable  = false;
-    dc->reset           = pnv_phb4_reset;
 
     xfc->notify         = pnv_phb4_xive_notify;
 }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
  2021-12-22  6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
  2021-12-22  6:38 ` [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler Cédric Le Goater
@ 2021-12-22  6:38 ` Cédric Le Goater
  2021-12-22 18:12   ` Daniel Henrique Barboza
  2021-12-22  6:38 ` [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled Cédric Le Goater
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

It's unused.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/pci-host/pnv_phb4.h | 2 --
 hw/pci-host/pnv_phb4.c         | 1 -
 hw/pci-host/pnv_phb4_pec.c     | 3 ---
 3 files changed, 6 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 60de3031a622..4a19338db35e 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -84,7 +84,6 @@ struct PnvPHB4 {
     uint32_t phb_id;
 
     uint64_t version;
-    uint16_t device_id;
 
     char bus_path[8];
 
@@ -222,7 +221,6 @@ struct PnvPhb4PecClass {
     const char *stk_compat;
     int stk_compat_size;
     uint64_t version;
-    uint64_t device_id;
     const uint32_t *num_stacks;
 };
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 4caf03310fab..3b50a22b97cd 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1261,7 +1261,6 @@ static Property pnv_phb4_properties[] = {
         DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
         DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
         DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
-        DEFINE_PROP_UINT16("device-id", PnvPHB4, device_id, 0),
         DEFINE_PROP_LINK("stack", PnvPHB4, stack, TYPE_PNV_PHB4_PEC_STACK,
                          PnvPhb4PecStack *),
         DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 24a3adcae326..f3e4fa0c8297 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -527,7 +527,6 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data)
     pecc->stk_compat = stk_compat;
     pecc->stk_compat_size = sizeof(stk_compat);
     pecc->version = PNV_PHB4_VERSION;
-    pecc->device_id = PNV_PHB4_DEVICE_ID;
     pecc->num_stacks = pnv_pec_num_stacks;
 }
 
@@ -587,8 +586,6 @@ static void pnv_pec_stk_realize(DeviceState *dev, Error **errp)
                             &error_fatal);
     object_property_set_int(OBJECT(&stack->phb), "version", pecc->version,
                             &error_fatal);
-    object_property_set_int(OBJECT(&stack->phb), "device-id", pecc->device_id,
-                            &error_fatal);
     object_property_set_link(OBJECT(&stack->phb), "stack", OBJECT(stack),
                              &error_abort);
     if (!sysbus_realize(SYS_BUS_DEVICE(&stack->phb), errp)) {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
                   ` (2 preceding siblings ...)
  2021-12-22  6:38 ` [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property Cédric Le Goater
@ 2021-12-22  6:38 ` Cédric Le Goater
  2021-12-22 18:13   ` Daniel Henrique Barboza
  2021-12-22  6:38 ` [PATCH 5/5] ppc/pnv: Attach PHB4 " Cédric Le Goater
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

This cleanups the PHB3 model a bit more since the root port is an
independent device and it will ease our task when adding user created
PHB3s.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/pci-host/pnv_phb3.h |  2 --
 hw/pci-host/pnv_phb3.c         |  8 --------
 hw/ppc/pnv.c                   | 14 ++++++++++++++
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index e9c13e6bd821..2e423c3890bc 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -155,8 +155,6 @@ struct PnvPHB3 {
 
     PnvPBCQState pbcq;
 
-    PnvPHB3RootPort root;
-
     QLIST_HEAD(, PnvPhb3DMASpace) dma_spaces;
 
     PnvChip *chip;
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 9c4451ca0d1c..39f03bd256d0 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -980,10 +980,6 @@ static void pnv_phb3_instance_init(Object *obj)
     /* Power Bus Common Queue */
     object_initialize_child(obj, "pbcq", &phb->pbcq, TYPE_PNV_PBCQ);
 
-    /* Root Port */
-    object_initialize_child(obj, "root", &phb->root, TYPE_PNV_PHB3_ROOT_PORT);
-    qdev_prop_set_int32(DEVICE(&phb->root), "addr", PCI_DEVFN(0, 0));
-    qdev_prop_set_bit(DEVICE(&phb->root), "multifunction", false);
 }
 
 static void pnv_phb3_realize(DeviceState *dev, Error **errp)
@@ -1051,10 +1047,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
 
     pci_setup_iommu(pci->bus, pnv_phb3_dma_iommu, phb);
 
-    /* Add a single Root port */
-    qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
-    qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
-    qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
 }
 
 void pnv_phb3_update_regions(PnvPHB3 *phb)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 9de8b8353014..6edfd6876fd0 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1156,6 +1156,17 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
     }
 }
 
+/* Attach a root port device */
+static void pnv_phb_attach_root_port(PCIHostState *pci, int id,
+                                     const char *name)
+{
+    PCIDevice *root = pci_new(PCI_DEVFN(0, 0), name);
+
+    qdev_prop_set_uint8(&root->qdev, "chassis", id);
+    qdev_prop_set_uint16(&root->qdev, "slot", id);
+    pci_realize_and_unref(root, pci->bus, &error_fatal);
+}
+
 static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
 {
     PnvChipClass *pcc = PNV_CHIP_GET_CLASS(dev);
@@ -1250,6 +1261,9 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
         if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
             return;
         }
+
+        pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), phb->phb_id,
+                                 TYPE_PNV_PHB3_ROOT_PORT);
     }
 }
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] ppc/pnv: Attach PHB4 root port device when defaults are enabled
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
                   ` (3 preceding siblings ...)
  2021-12-22  6:38 ` [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled Cédric Le Goater
@ 2021-12-22  6:38 ` Cédric Le Goater
  2021-12-22 18:13   ` Daniel Henrique Barboza
  2021-12-22 18:16 ` [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Daniel Henrique Barboza
  2022-01-04  7:43 ` Cédric Le Goater
  6 siblings, 1 reply; 13+ messages in thread
From: Cédric Le Goater @ 2021-12-22  6:38 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza, Cédric Le Goater

This cleanups the PHB4 model a bit more since the root port is an
independent device and it will ease our task when adding user created
PHB4s.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/pci-host/pnv_phb4.h |  2 --
 hw/pci-host/pnv_phb4.c         | 11 -----------
 hw/ppc/pnv.c                   |  9 ++++++++-
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 4a19338db35e..ea63df967678 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -78,8 +78,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4)
 struct PnvPHB4 {
     PCIExpressHost parent_obj;
 
-    PnvPHB4RootPort root;
-
     uint32_t chip_id;
     uint32_t phb_id;
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 3b50a22b97cd..3b4758c42e26 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1158,12 +1158,6 @@ static void pnv_phb4_instance_init(Object *obj)
 
     /* XIVE interrupt source object */
     object_initialize_child(obj, "source", &phb->xsrc, TYPE_XIVE_SOURCE);
-
-    /* Root Port */
-    object_initialize_child(obj, "root", &phb->root, TYPE_PNV_PHB4_ROOT_PORT);
-
-    qdev_prop_set_int32(DEVICE(&phb->root), "addr", PCI_DEVFN(0, 0));
-    qdev_prop_set_bit(DEVICE(&phb->root), "multifunction", false);
 }
 
 static void pnv_phb4_realize(DeviceState *dev, Error **errp)
@@ -1207,11 +1201,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
     pci_setup_iommu(pci->bus, pnv_phb4_dma_iommu, phb);
     pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE;
 
-    /* Add a single Root port */
-    qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
-    qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
-    qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
-
     /* Setup XIVE Source */
     if (phb->big_phb) {
         nr_irqs = PNV_PHB4_MAX_INTs;
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 6edfd6876fd0..7a397698e984 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1403,7 +1403,7 @@ static void pnv_chip_quad_realize(Pnv9Chip *chip9, Error **errp)
 static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
 {
     Pnv9Chip *chip9 = PNV9_CHIP(chip);
-    int i;
+    int i, j;
 
     for (i = 0; i < chip->num_pecs; i++) {
         PnvPhb4PecState *pec = &chip9->pecs[i];
@@ -1425,6 +1425,13 @@ static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
 
         pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
         pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
+
+        for (j = 0; j < pec->num_stacks; j++) {
+            PnvPHB4 *phb = &pec->stacks[j].phb;
+
+            pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), phb->phb_id,
+                                     TYPE_PNV_PHB4_ROOT_PORT);
+        }
     }
 }
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL
  2021-12-22  6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
@ 2021-12-22 18:11   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:11 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> The POWER8 processors with a NVLink logic unit have 4 PHB3 devices per
> chip.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/ppc/pnv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 29ee0d0f08b4..9de8b8353014 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1314,7 +1314,7 @@ static void pnv_chip_power8nvl_class_init(ObjectClass *klass, void *data)
>   
>       k->chip_cfam_id = 0x120d304980000000ull;  /* P8 Naples DD1.0 */
>       k->cores_mask = POWER8_CORE_MASK;
> -    k->num_phbs = 3;
> +    k->num_phbs = 4;
>       k->core_pir = pnv_chip_core_pir_p8;
>       k->intc_create = pnv_chip_power8_intc_create;
>       k->intc_reset = pnv_chip_power8_intc_reset;
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler
  2021-12-22  6:38 ` [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler Cédric Le Goater
@ 2021-12-22 18:12   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:12 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> The PHB4 reset handler was preparing ground for PHB5 to set
> appropriately the device id. We don't need it for the PHB4 since the
> device id is already set in the root port complex. PH5 will introduce
> its own.
> 
> "device-id" property is now useless. It should be removed.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/pci-host/pnv_phb4.c | 13 -------------
>   1 file changed, 13 deletions(-)
> 
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 40b793201a34..4caf03310fab 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -1229,18 +1229,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>       phb->qirqs = qemu_allocate_irqs(xive_source_set_irq, xsrc, xsrc->nr_irqs);
>   }
>   
> -static void pnv_phb4_reset(DeviceState *dev)
> -{
> -    PnvPHB4 *phb = PNV_PHB4(dev);
> -    PCIDevice *root_dev = PCI_DEVICE(&phb->root);
> -
> -    /*
> -     * Configure PCI device id at reset using a property.
> -     */
> -    pci_config_set_vendor_id(root_dev->config, PCI_VENDOR_ID_IBM);
> -    pci_config_set_device_id(root_dev->config, phb->device_id);
> -}
> -
>   static const char *pnv_phb4_root_bus_path(PCIHostState *host_bridge,
>                                             PCIBus *rootbus)
>   {
> @@ -1290,7 +1278,6 @@ static void pnv_phb4_class_init(ObjectClass *klass, void *data)
>       device_class_set_props(dc, pnv_phb4_properties);
>       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>       dc->user_creatable  = false;
> -    dc->reset           = pnv_phb4_reset;
>   
>       xfc->notify         = pnv_phb4_xive_notify;
>   }
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property
  2021-12-22  6:38 ` [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property Cédric Le Goater
@ 2021-12-22 18:12   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:12 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> It's unused.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   include/hw/pci-host/pnv_phb4.h | 2 --
>   hw/pci-host/pnv_phb4.c         | 1 -
>   hw/pci-host/pnv_phb4_pec.c     | 3 ---
>   3 files changed, 6 deletions(-)
> 
> diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
> index 60de3031a622..4a19338db35e 100644
> --- a/include/hw/pci-host/pnv_phb4.h
> +++ b/include/hw/pci-host/pnv_phb4.h
> @@ -84,7 +84,6 @@ struct PnvPHB4 {
>       uint32_t phb_id;
>   
>       uint64_t version;
> -    uint16_t device_id;
>   
>       char bus_path[8];
>   
> @@ -222,7 +221,6 @@ struct PnvPhb4PecClass {
>       const char *stk_compat;
>       int stk_compat_size;
>       uint64_t version;
> -    uint64_t device_id;
>       const uint32_t *num_stacks;
>   };
>   
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 4caf03310fab..3b50a22b97cd 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -1261,7 +1261,6 @@ static Property pnv_phb4_properties[] = {
>           DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
>           DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
>           DEFINE_PROP_UINT64("version", PnvPHB4, version, 0),
> -        DEFINE_PROP_UINT16("device-id", PnvPHB4, device_id, 0),
>           DEFINE_PROP_LINK("stack", PnvPHB4, stack, TYPE_PNV_PHB4_PEC_STACK,
>                            PnvPhb4PecStack *),
>           DEFINE_PROP_END_OF_LIST(),
> diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
> index 24a3adcae326..f3e4fa0c8297 100644
> --- a/hw/pci-host/pnv_phb4_pec.c
> +++ b/hw/pci-host/pnv_phb4_pec.c
> @@ -527,7 +527,6 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data)
>       pecc->stk_compat = stk_compat;
>       pecc->stk_compat_size = sizeof(stk_compat);
>       pecc->version = PNV_PHB4_VERSION;
> -    pecc->device_id = PNV_PHB4_DEVICE_ID;
>       pecc->num_stacks = pnv_pec_num_stacks;
>   }
>   
> @@ -587,8 +586,6 @@ static void pnv_pec_stk_realize(DeviceState *dev, Error **errp)
>                               &error_fatal);
>       object_property_set_int(OBJECT(&stack->phb), "version", pecc->version,
>                               &error_fatal);
> -    object_property_set_int(OBJECT(&stack->phb), "device-id", pecc->device_id,
> -                            &error_fatal);
>       object_property_set_link(OBJECT(&stack->phb), "stack", OBJECT(stack),
>                                &error_abort);
>       if (!sysbus_realize(SYS_BUS_DEVICE(&stack->phb), errp)) {
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled
  2021-12-22  6:38 ` [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled Cédric Le Goater
@ 2021-12-22 18:13   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:13 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> This cleanups the PHB3 model a bit more since the root port is an
> independent device and it will ease our task when adding user created
> PHB3s.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   include/hw/pci-host/pnv_phb3.h |  2 --
>   hw/pci-host/pnv_phb3.c         |  8 --------
>   hw/ppc/pnv.c                   | 14 ++++++++++++++
>   3 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
> index e9c13e6bd821..2e423c3890bc 100644
> --- a/include/hw/pci-host/pnv_phb3.h
> +++ b/include/hw/pci-host/pnv_phb3.h
> @@ -155,8 +155,6 @@ struct PnvPHB3 {
>   
>       PnvPBCQState pbcq;
>   
> -    PnvPHB3RootPort root;
> -
>       QLIST_HEAD(, PnvPhb3DMASpace) dma_spaces;
>   
>       PnvChip *chip;
> diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
> index 9c4451ca0d1c..39f03bd256d0 100644
> --- a/hw/pci-host/pnv_phb3.c
> +++ b/hw/pci-host/pnv_phb3.c
> @@ -980,10 +980,6 @@ static void pnv_phb3_instance_init(Object *obj)
>       /* Power Bus Common Queue */
>       object_initialize_child(obj, "pbcq", &phb->pbcq, TYPE_PNV_PBCQ);
>   
> -    /* Root Port */
> -    object_initialize_child(obj, "root", &phb->root, TYPE_PNV_PHB3_ROOT_PORT);
> -    qdev_prop_set_int32(DEVICE(&phb->root), "addr", PCI_DEVFN(0, 0));
> -    qdev_prop_set_bit(DEVICE(&phb->root), "multifunction", false);
>   }
>   
>   static void pnv_phb3_realize(DeviceState *dev, Error **errp)
> @@ -1051,10 +1047,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
>   
>       pci_setup_iommu(pci->bus, pnv_phb3_dma_iommu, phb);
>   
> -    /* Add a single Root port */
> -    qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
> -    qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
> -    qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
>   }
>   
>   void pnv_phb3_update_regions(PnvPHB3 *phb)
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 9de8b8353014..6edfd6876fd0 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1156,6 +1156,17 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
>       }
>   }
>   
> +/* Attach a root port device */
> +static void pnv_phb_attach_root_port(PCIHostState *pci, int id,
> +                                     const char *name)
> +{
> +    PCIDevice *root = pci_new(PCI_DEVFN(0, 0), name);
> +
> +    qdev_prop_set_uint8(&root->qdev, "chassis", id);
> +    qdev_prop_set_uint16(&root->qdev, "slot", id);
> +    pci_realize_and_unref(root, pci->bus, &error_fatal);
> +}
> +
>   static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
>   {
>       PnvChipClass *pcc = PNV_CHIP_GET_CLASS(dev);
> @@ -1250,6 +1261,9 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
>           if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) {
>               return;
>           }
> +
> +        pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), phb->phb_id,
> +                                 TYPE_PNV_PHB3_ROOT_PORT);
>       }
>   }
>   
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/5] ppc/pnv: Attach PHB4 root port device when defaults are enabled
  2021-12-22  6:38 ` [PATCH 5/5] ppc/pnv: Attach PHB4 " Cédric Le Goater
@ 2021-12-22 18:13   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:13 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> This cleanups the PHB4 model a bit more since the root port is an
> independent device and it will ease our task when adding user created
> PHB4s.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   include/hw/pci-host/pnv_phb4.h |  2 --
>   hw/pci-host/pnv_phb4.c         | 11 -----------
>   hw/ppc/pnv.c                   |  9 ++++++++-
>   3 files changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
> index 4a19338db35e..ea63df967678 100644
> --- a/include/hw/pci-host/pnv_phb4.h
> +++ b/include/hw/pci-host/pnv_phb4.h
> @@ -78,8 +78,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4)
>   struct PnvPHB4 {
>       PCIExpressHost parent_obj;
>   
> -    PnvPHB4RootPort root;
> -
>       uint32_t chip_id;
>       uint32_t phb_id;
>   
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index 3b50a22b97cd..3b4758c42e26 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -1158,12 +1158,6 @@ static void pnv_phb4_instance_init(Object *obj)
>   
>       /* XIVE interrupt source object */
>       object_initialize_child(obj, "source", &phb->xsrc, TYPE_XIVE_SOURCE);
> -
> -    /* Root Port */
> -    object_initialize_child(obj, "root", &phb->root, TYPE_PNV_PHB4_ROOT_PORT);
> -
> -    qdev_prop_set_int32(DEVICE(&phb->root), "addr", PCI_DEVFN(0, 0));
> -    qdev_prop_set_bit(DEVICE(&phb->root), "multifunction", false);
>   }
>   
>   static void pnv_phb4_realize(DeviceState *dev, Error **errp)
> @@ -1207,11 +1201,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
>       pci_setup_iommu(pci->bus, pnv_phb4_dma_iommu, phb);
>       pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE;
>   
> -    /* Add a single Root port */
> -    qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
> -    qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
> -    qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
> -
>       /* Setup XIVE Source */
>       if (phb->big_phb) {
>           nr_irqs = PNV_PHB4_MAX_INTs;
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 6edfd6876fd0..7a397698e984 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1403,7 +1403,7 @@ static void pnv_chip_quad_realize(Pnv9Chip *chip9, Error **errp)
>   static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
>   {
>       Pnv9Chip *chip9 = PNV9_CHIP(chip);
> -    int i;
> +    int i, j;
>   
>       for (i = 0; i < chip->num_pecs; i++) {
>           PnvPhb4PecState *pec = &chip9->pecs[i];
> @@ -1425,6 +1425,13 @@ static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
>   
>           pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
>           pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
> +
> +        for (j = 0; j < pec->num_stacks; j++) {
> +            PnvPHB4 *phb = &pec->stacks[j].phb;
> +
> +            pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), phb->phb_id,
> +                                     TYPE_PNV_PHB4_ROOT_PORT);
> +        }
>       }
>   }
>   
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
                   ` (4 preceding siblings ...)
  2021-12-22  6:38 ` [PATCH 5/5] ppc/pnv: Attach PHB4 " Cédric Le Goater
@ 2021-12-22 18:16 ` Daniel Henrique Barboza
  2022-01-04  7:43 ` Cédric Le Goater
  6 siblings, 0 replies; 13+ messages in thread
From: Daniel Henrique Barboza @ 2021-12-22 18:16 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-ppc, qemu-devel



On 12/22/21 03:38, Cédric Le Goater wrote:
> Hello,
> 
> There are the last cleanups preparing ground for PHBs created on the
> command line and possibly libvirt support.


As a note to whoever wants to give this series a go: I'm working in more fixes and
cleanups on top of these patches. I'm planning to post what I have in the next few
days.


Thanks,


Daniel



> 
> Thanks,
> 
> C.
> 
> Cédric Le Goater (5):
>    ppc/pnv: Change the maximum of PHB3 devices for Power8NVL
>    ppc/pnv: Remove PHB4 reset handler
>    ppc/pnv: Remove the PHB4 "device-id" property
>    ppc/pnv: Attach PHB3 root port device when defaults are enabled
>    ppc/pnv: Attach PHB4 root port device when defaults are enabled
> 
>   include/hw/pci-host/pnv_phb3.h |  2 --
>   include/hw/pci-host/pnv_phb4.h |  4 ----
>   hw/pci-host/pnv_phb3.c         |  8 --------
>   hw/pci-host/pnv_phb4.c         | 25 -------------------------
>   hw/pci-host/pnv_phb4_pec.c     |  3 ---
>   hw/ppc/pnv.c                   | 25 +++++++++++++++++++++++--
>   6 files changed, 23 insertions(+), 44 deletions(-)
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs
  2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
                   ` (5 preceding siblings ...)
  2021-12-22 18:16 ` [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Daniel Henrique Barboza
@ 2022-01-04  7:43 ` Cédric Le Goater
  6 siblings, 0 replies; 13+ messages in thread
From: Cédric Le Goater @ 2022-01-04  7:43 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Daniel Henrique Barboza

On 12/22/21 07:38, Cédric Le Goater wrote:
> Hello,
> 
> There are the last cleanups preparing ground for PHBs created on the
> command line and possibly libvirt support.
> 
> Thanks,
> 
> C.
> 
> Cédric Le Goater (5):
>    ppc/pnv: Change the maximum of PHB3 devices for Power8NVL
>    ppc/pnv: Remove PHB4 reset handler
>    ppc/pnv: Remove the PHB4 "device-id" property
>    ppc/pnv: Attach PHB3 root port device when defaults are enabled
>    ppc/pnv: Attach PHB4 root port device when defaults are enabled


Applied patches 1-3 in ppc-next.

Thanks,

C.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-01-04  8:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  6:38 [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Cédric Le Goater
2021-12-22  6:38 ` [PATCH 1/5] ppc/pnv: Change the maximum of PHB3 devices for Power8NVL Cédric Le Goater
2021-12-22 18:11   ` Daniel Henrique Barboza
2021-12-22  6:38 ` [PATCH 2/5] ppc/pnv: Remove PHB4 reset handler Cédric Le Goater
2021-12-22 18:12   ` Daniel Henrique Barboza
2021-12-22  6:38 ` [PATCH 3/5] ppc/pnv: Remove the PHB4 "device-id" property Cédric Le Goater
2021-12-22 18:12   ` Daniel Henrique Barboza
2021-12-22  6:38 ` [PATCH 4/5] ppc/pnv: Attach PHB3 root port device when defaults are enabled Cédric Le Goater
2021-12-22 18:13   ` Daniel Henrique Barboza
2021-12-22  6:38 ` [PATCH 5/5] ppc/pnv: Attach PHB4 " Cédric Le Goater
2021-12-22 18:13   ` Daniel Henrique Barboza
2021-12-22 18:16 ` [PATCH 0/5] ppc/pnv: Preliminary cleanups before user created PHBs Daniel Henrique Barboza
2022-01-04  7:43 ` Cédric Le Goater

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.