[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/20] ppc/pnv: Introduce a pnv-phb5 device to match root port
From: |
Cédric Le Goater |
Subject: |
[PULL 18/20] ppc/pnv: Introduce a pnv-phb5 device to match root port |
Date: |
Tue, 15 Mar 2022 07:37:34 +0100 |
From: Frederic Barrat <fbarrat@linux.ibm.com>
We already have the pnv-phb3 and pnv-phb4 devices for POWER8 and
POWER9 respectively. POWER10 uses version 5 of the PHB. It is very
close to the PHB4 from POWER9, at least in our model and we could
almost keep using the PHB4 model. However the matching root port
pnv-phb5-root-port is specific to POWER10 so to avoid confusion as
well as making it easy to introduce differences later, we create a
pnv-phb5 class, which is mostly an alias for pnv-phb4 for now.
With this patch, the command line for a user-created PHB on powernv10
becomes:
-machine powernv10 -nodefaults -device pnv-phb5 -device pnv-phb5-root-port
Fixes: 623575e16cd5 ("ppc/pnv: Add model for POWER10 PHB5 PCIe Host bridge")
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220310155101.294568-2-fbarrat@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/hw/pci-host/pnv_phb4.h | 5 +++++
hw/pci-host/pnv_phb4.c | 7 +++++++
hw/pci-host/pnv_phb4_pec.c | 9 +++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index fbcf5bfb5585..b02ecdceaa4c 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -203,6 +203,7 @@ struct PnvPhb4PecClass {
const char *stk_compat;
int stk_compat_size;
uint64_t version;
+ const char *phb_type;
const uint32_t *num_phbs;
const char *rp_model;
};
@@ -211,6 +212,10 @@ struct PnvPhb4PecClass {
* POWER10 definitions
*/
+#define TYPE_PNV_PHB5 "pnv-phb5"
+#define PNV_PHB5(obj) \
+ OBJECT_CHECK(PnvPhb4, (obj), TYPE_PNV_PHB5)
+
#define PNV_PHB5_VERSION 0x000000a500000001ull
#define PNV_PHB5_DEVICE_ID 0x0652
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index b5b384e9ee4f..d1a911f988b7 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1783,6 +1783,12 @@ static const TypeInfo pnv_phb4_type_info = {
}
};
+static const TypeInfo pnv_phb5_type_info = {
+ .name = TYPE_PNV_PHB5,
+ .parent = TYPE_PNV_PHB4,
+ .instance_size = sizeof(PnvPHB4),
+};
+
static void pnv_phb4_root_bus_class_init(ObjectClass *klass, void *data)
{
BusClass *k = BUS_CLASS(klass);
@@ -1907,6 +1913,7 @@ static void pnv_phb4_register_types(void)
type_register_static(&pnv_phb5_root_port_info);
type_register_static(&pnv_phb4_root_port_info);
type_register_static(&pnv_phb4_type_info);
+ type_register_static(&pnv_phb5_type_info);
type_register_static(&pnv_phb4_iommu_memory_region_info);
}
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 0ab36e9c8f3c..a0dfa77c8432 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -116,7 +116,8 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState
*pec,
int stack_no,
Error **errp)
{
- PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4));
+ PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
+ PnvPHB4 *phb = PNV_PHB4(qdev_new(pecc->phb_type));
int phb_id = pnv_phb4_pec_get_phb_id(pec, stack_no);
object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
@@ -131,9 +132,7 @@ 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),
- PNV_PHB4_PEC_GET_CLASS(pec)->rp_model);
-
+ pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), pecc->rp_model);
}
static void pnv_pec_realize(DeviceState *dev, Error **errp)
@@ -265,6 +264,7 @@ 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->phb_type = TYPE_PNV_PHB4;
pecc->num_phbs = pnv_pec_num_phbs;
pecc->rp_model = TYPE_PNV_PHB4_ROOT_PORT;
}
@@ -317,6 +317,7 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass,
void *data)
pecc->stk_compat = stk_compat;
pecc->stk_compat_size = sizeof(stk_compat);
pecc->version = PNV_PHB5_VERSION;
+ pecc->phb_type = TYPE_PNV_PHB5;
pecc->num_phbs = pnv_phb5_pec_num_stacks;
pecc->rp_model = TYPE_PNV_PHB5_ROOT_PORT;
}
--
2.34.1
- [PULL 17/20] ppc/xive2: Make type Xive2EndSource not user creatable, (continued)
- [PULL 17/20] ppc/xive2: Make type Xive2EndSource not user creatable, Cédric Le Goater, 2022/03/15
- [PULL 13/20] avocado/ppc_prep_40p.py: check TCG accel in all tests, Cédric Le Goater, 2022/03/15
- [PULL 20/20] ppc/pnv: Remove user-created PHB{3,4,5} devices, Cédric Le Goater, 2022/03/15
- [PULL 06/20] avocado/boot_linux_console.py: check TCG accel in test_ppc_g3beige(), Cédric Le Goater, 2022/03/15
- [PULL 14/20] avocado/ppc_virtex_ml507.py: check TCG accel in test_ppc_virtex_ml507(), Cédric Le Goater, 2022/03/15
- [PULL 03/20] avocado/boot_linux_console.py: check for tcg in test_ppc_powernv8/9, Cédric Le Goater, 2022/03/15
- [PULL 11/20] avocado/ppc_bamboo.py: check TCG accel in test_ppc_bamboo(), Cédric Le Goater, 2022/03/15
- [PULL 02/20] qtest/meson.build: check CONFIG_TCG for boot-serial-test in qtests_ppc, Cédric Le Goater, 2022/03/15
- [PULL 10/20] avocado/ppc_74xx.py: check TCG accel for all tests, Cédric Le Goater, 2022/03/15
- [PULL 09/20] avocado/ppc_405.py: check TCG accel in test_ppc_ref405ep(), Cédric Le Goater, 2022/03/15
- [PULL 18/20] ppc/pnv: Introduce a pnv-phb5 device to match root port,
Cédric Le Goater <=
- [PULL 12/20] avocado/ppc_mpc8544ds.py: check TCG accel in test_ppc_mpc8544ds(), Cédric Le Goater, 2022/03/15
- [PULL 08/20] avocado/ppc_405.py: remove test_ppc_taihu(), Cédric Le Goater, 2022/03/15
- [PULL 15/20] target/ppc: fix ISI fault cause for Radix MMU, Cédric Le Goater, 2022/03/15
- [PULL 05/20] avocado/replay_kernel.py: make tcg-icount check in run_vm(), Cédric Le Goater, 2022/03/15
- [PULL 19/20] ppc/pnv: Always create the PHB5 PEC devices, Cédric Le Goater, 2022/03/15
- [PULL 07/20] avocado/boot_linux_console.py: check TCG accel in test_ppc_mac99(), Cédric Le Goater, 2022/03/15
- [PULL 16/20] target/ppc: fix xxspltw for big endian hosts, Cédric Le Goater, 2022/03/15
- [PULL 04/20] avocado/boot_linux_console.py: check tcg accel in test_ppc64_e500, Cédric Le Goater, 2022/03/15
- Re: [PULL 00/20] ppc fixes for 7.0, Peter Maydell, 2022/03/15