ppc/pnv: Final refinements on PHB4s
cover ppc/pnv: Final refinements on PHB4s
Hello,
These are the last little tweaks on PHB4 to prepare ground for PHB5.
Thanks,
C.
Cédric Le Goater (3):
ppc/pnv: Move root port allocation under pnv_pec_default_phb_realize() ppc/pnv: Add a 'rp_model' class attribute for the PHB4 PEC ppc/pnv: Remove PHB4 version property
include/hw/pci-host/pnv_phb4.h | 1 + hw/pci-host/pnv_phb4.c | 16 +--------------- hw/pci-host/pnv_phb4_pec.c | 9 ++++++--- 3 files changed, 8 insertions(+), 18 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/3 ppc/pnv: Move root port allocation under pnv_pec_default_phb_realize()
The root port device is currently created and attached to the PHB early in pnv_phb4_realize(). Do it under pnv_pec_default_phb_realize() after the PHB is fully realized. It's cleaner and avoids an extra test on defaults_enabled().
--- hw/pci-host/pnv_phb4.c | 7 ------- hw/pci-host/pnv_phb4_pec.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-)
hw/pci-host/pnv_phb4.c +0 -7
@@ -22,7 +22,6 @@#include "hw/irq.h" #include "hw/qdev-properties.h" #include "qom/object.h" -#include "sysemu/sysemu.h" #include "trace.h" #define phb_error (phb, fmt, ...) \
@@ -1639,12 +1638,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 if running with defaults */ -if (defaults_enabled ()) { -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), -TYPE_PNV_PHB4_ROOT_PORT ); - } -/* Setup XIVE Source */ if (phb->big_phb) { nr_irqs = PNV_PHB4_MAX_INTs;
hw/pci-host/pnv_phb4_pec.c +3 -0
@@ -132,6 +132,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,if (!sysbus_realize (SYS_BUS_DEVICE (phb), errp)) {return ; } + +/* Add a single Root port if running with defaults */ +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb),TYPE_PNV_PHB4_ROOT_PORT ); }static void pnv_pec_realize (DeviceState *dev,Error **errp)
Signature · 1 line
2.31.1
Re: [PATCH 1/3] ppc/pnv: Move root port allocation under pnv_pec_default_phb_realize()
Quoted 7 lines · Cédric Le Goater
The root port device is currently created and attached to the PHB early in
pnv_phb4_realize(). Do it underpnv_pec_default_phb_realize()after the PHB is fully realized. It's cleaner and avoids an extra test ondefaults_enabled().Signed-off-by Cédric Le Goater <[email protected]>---
Quoted 43 lines
hw/pci-host/pnv_phb4.c | 7 ------- hw/pci-host/pnv_phb4_pec.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-)hw/pci-host/pnv_phb4.c +0
-7@@ -22,7 +22,6 @@#include "hw/irq.h" #include "hw/qdev-properties.h" #include "qom/object.h" -#include "sysemu/sysemu.h" #include "trace.h" #define phb_error (phb, fmt, ...) \@@ -1639,12 +1638,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 if running with defaults */ -if (defaults_enabled ()) { -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), -TYPE_PNV_PHB4_ROOT_PORT ); - } -/* Setup XIVE Source */ if (phb->big_phb) { nr_irqs = PNV_PHB4_MAX_INTs;hw/pci-host/pnv_phb4_pec.c +3
-0@@ -132,6 +132,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,if (!sysbus_realize (SYS_BUS_DEVICE (phb), errp)) {return ; } + +/* Add a single Root port if running with defaults */ +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb),TYPE_PNV_PHB4_ROOT_PORT ); }static void pnv_pec_realize (DeviceState *dev,Error **errp)
PATCH 2/3 ppc/pnv: Add a 'rp_model' class attribute for the PHB4 PEC
In reply to Cédric Le GoaterPHB5 will introduce its own root port model. Prepare ground for it.
--- include/hw/pci-host/pnv_phb4.h | 1 + hw/pci-host/pnv_phb4_pec.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
include/hw/pci-host/pnv_phb4.h +1 -0
@@ -203,6 +203,7 @@ struct PnvPhb4PecClass {int stk_compat_size;uint64_t version;const uint32_t *num_phbs; + const char *rp_model; };#endif /* PCI_HOST_PNV_PHB4_H */
hw/pci-host/pnv_phb4_pec.c +4 -1
@@ -134,7 +134,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, }/* Add a single Root port if running with defaults */ -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb),TYPE_PNV_PHB4_ROOT_PORT ); +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), +PNV_PHB4_PEC_GET_CLASS (pec)->rp_model); + }static void pnv_pec_realize (DeviceState *dev,Error **errp)
@@ -267,6 +269,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data) pecc->stk_compat_size =sizeof (stk_compat); pecc->version =PNV_PHB4_VERSION ; pecc->num_phbs = pnv_pec_num_phbs; + pecc->rp_model =TYPE_PNV_PHB4_ROOT_PORT ; }static const TypeInfo pnv_pec_type_info = {
Signature · 1 line
2.31.1
Re: [PATCH 2/3] ppc/pnv: Add a 'rp_model' class attribute for the PHB4 PEC
Quoted 4 lines · Cédric Le Goater
PHB5 will introduce its own root port model. Prepare ground for it.
Signed-off-by Cédric Le Goater <[email protected]>---
Quoted 39 lines
include/hw/pci-host/pnv_phb4.h | 1 + hw/pci-host/pnv_phb4_pec.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)include/hw/pci-host/pnv_phb4.h +1
-0@@ -203,6 +203,7 @@ struct PnvPhb4PecClass {int stk_compat_size;uint64_t version;const uint32_t *num_phbs; + const char *rp_model; };#endif /* PCI_HOST_PNV_PHB4_H */ hw/pci-host/pnv_phb4_pec.c +4
-1@@ -134,7 +134,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, }/* Add a single Root port if running with defaults */ -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb),TYPE_PNV_PHB4_ROOT_PORT ); +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), +PNV_PHB4_PEC_GET_CLASS (pec)->rp_model); + }static void pnv_pec_realize (DeviceState *dev,Error **errp)@@ -267,6 +269,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data) pecc->stk_compat_size =sizeof (stk_compat); pecc->version =PNV_PHB4_VERSION ; pecc->num_phbs = pnv_pec_num_phbs; + pecc->rp_model =TYPE_PNV_PHB4_ROOT_PORT ; }static const TypeInfo pnv_pec_type_info = {
PATCH 3/3 ppc/pnv: Remove PHB4 version property
In reply to Cédric Le Goaterand grab the PHB version from the PEC class directly when needed.
--- hw/pci-host/pnv_phb4.c | 9 +-------- hw/pci-host/pnv_phb4_pec.c | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-)
hw/pci-host/pnv_phb4.c +1 -8
@@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size)switch (off) {case PHB_VERSION : -return phb->version; +return PNV_PHB4_PEC_GET_CLASS (phb->pec)->version;/* Read-only */ case PHB_PHB4_GEN_CAP :
@@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)if (!phb->pec) {PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());PnvChip *chip =pnv_get_chip (pnv, phb->chip_id); -PnvPhb4PecClass *pecc;BusState *s;if (!chip) {
@@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)return ; } -/* All other phb properties are already set */ - pecc =PNV_PHB4_PEC_GET_CLASS (phb->pec); -object_property_set_int (OBJECT (phb),"version" , pecc->version, - &error_fatal); -/* * Reparent user created devices to the chip to build * correctly the device tree.
@@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)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_LINK ("pec" , PnvPHB4, pec,TYPE_PNV_PHB4_PEC , PnvPhb4PecState *),DEFINE_PROP_END_OF_LIST (),
hw/pci-host/pnv_phb4_pec.c +0 -3
@@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, Error **errp) {PnvPHB4 *phb =PNV_PHB4 (qdev_new (TYPE_PNV_PHB4 )); -PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (pec);int phb_id =pnv_phb4_pec_get_phb_id (pec, stack_no); object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
@@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, &error_fatal);object_property_set_int (OBJECT (phb),"index" , phb_id, &error_fatal); -object_property_set_int (OBJECT (phb),"version" , pecc->version, - &error_fatal);if (!sysbus_realize (SYS_BUS_DEVICE (phb), errp)) {return ;
Signature · 1 line
2.31.1
Re: [PATCH 3/3] ppc/pnv: Remove PHB4 version property
Quoted 1 line · Cédric Le Goater
and grab the PHB version from the PEC class directly when needed.
I guess we want a capital "A" when starting the commit msg
Quoted 3 lines
Signed-off-by Cédric Le Goater <[email protected]>---
This change also makes pnv-phb4s a little closer with pnv-phb3s, given that we don't have a "Version" attribute exposed in the QOM for pnv-phb3s as well.
Quoted 66 lines
hw/pci-host/pnv_phb4.c | 9 +-------- hw/pci-host/pnv_phb4_pec.c | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-)hw/pci-host/pnv_phb4.c +1
-8@@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size)switch (off) {case PHB_VERSION : -return phb->version; +return PNV_PHB4_PEC_GET_CLASS (phb->pec)->version;/* Read-only */ case PHB_PHB4_GEN_CAP :@@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)if (!phb->pec) {PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());PnvChip *chip =pnv_get_chip (pnv, phb->chip_id); -PnvPhb4PecClass *pecc;BusState *s;if (!chip) {@@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)return ; } -/* All other phb properties are already set */ - pecc =PNV_PHB4_PEC_GET_CLASS (phb->pec); -object_property_set_int (OBJECT (phb),"version" , pecc->version, - &error_fatal); -/* * Reparent user created devices to the chip to build * correctly the device tree. @@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno)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_LINK ("pec" , PnvPHB4, pec,TYPE_PNV_PHB4_PEC , PnvPhb4PecState *),DEFINE_PROP_END_OF_LIST (),hw/pci-host/pnv_phb4_pec.c +0
-3@@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, Error **errp) {PnvPHB4 *phb =PNV_PHB4 (qdev_new (TYPE_PNV_PHB4 )); -PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (pec);int phb_id =pnv_phb4_pec_get_phb_id (pec, stack_no); object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),@@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, &error_fatal);object_property_set_int (OBJECT (phb),"index" , phb_id, &error_fatal); -object_property_set_int (OBJECT (phb),"version" , pecc->version, - &error_fatal);if (!sysbus_realize (SYS_BUS_DEVICE (phb), errp)) {return ;
Re: [PATCH 3/3] ppc/pnv: Remove PHB4 version property
Quoted 6 lines · Daniel Henrique Barboza
Quoted 1 line · Cédric Le Goater
and grab the PHB version from the PEC class directly when needed.
I guess we want a capital "A" when starting the commit msg
I just removed the 'and'.
Thanks,
C.
Quoted 72 lines
Quoted 4 lines
Signed-off-by Cédric Le Goater <[email protected]>---
This change also makes pnv-phb4s a little closer with pnv-phb3s, given that we don't have a "Version" attribute exposed in the QOM for pnv-phb3s as well.
Reviewed-by Daniel Henrique Barboza <[email protected]>Quoted 60 lines
hw/pci-host/pnv_phb4.c | 9 +--------
hw/pci-host/pnv_phb4_pec.c| 3 ---2 files changed, 1 insertion(+), 11 deletions(-)hw/pci-host/pnv_phb4.c +0
-0@@ -672,7 +672,7 @@ static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size) switch (off) {case
PHB_VERSION:
- returnphb->version;
+ return PNV_PHB4_PEC_GET_CLASS(phb->pec)->version; /* Read-only */
casePHB_PHB4_GEN_CAP:hw/pci-host/pnv_phb4.c +0
-7@@ -1575,7 +1575,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) if (!phb->pec) { PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); PnvChip *chip = pnv_get_chip(pnv, phb->chip_id); - PnvPhb4PecClass *pecc; BusState *s; if (!chip) {@@ -1589,11 +1588,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) return; } - /* All other phb properties are already set */ - pecc = PNV_PHB4_PEC_GET_CLASS(phb->pec); - object_property_set_int(OBJECT(phb), "version", pecc->version, - &error_fatal); - /** Reparent user created devices to the chip to build * correctly the device tree. @@ -1688,7 +1682,6 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno) 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_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC, PnvPhb4PecState *), DEFINE_PROP_END_OF_LIST(),hw/pci-host/pnv_phb4_pec.c +0
-3@@ -117,7 +117,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, Error **errp) { PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4)); - PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec); int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no); object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),@@ -126,8 +125,6 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, &error_fatal); object_property_set_int(OBJECT(phb), "index", phb_id, &error_fatal); - object_property_set_int(OBJECT(phb), "version", pecc->version, - &error_fatal); if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { return;
Cédric Le Goater
AppliedQuoted 4 lines · Cédric Le Goater
Hello,
These are the last little tweaks on PHB4 to prepare ground for PHB5.
Quoted 8 lines
Thanks,
C.
Cédric Le Goater (3):
ppc/pnv: Move root port allocation underpnv_pec_default_phb_realize()ppc/pnv: Add a 'rp_model' class attribute for the PHB4 PEC ppc/pnv: Remove PHB4 version property
Applied to ppc-7.0
Thanks,
C.