Power11 support for QEMU
v3 cover Power11 support for QEMU
Overview
============
Add support for Power11 pseries and powernv machine types, to emulate VMs running on Power11.
As Power11 core is same as Power10, hence much of the code has been reused from Power10.
Power11 was added in Linux in:
commit c2ed087ed35c ("powerpc: Add Power11 architected and raw mode")
Git Tree for Testing
====================
QEMU: https://github.com/adi-g15-ibm/qemu/tree/p11-v3
Has been tested with following cases:
* '-M pseries' / '-M pseries -cpu Power11'
* '-M powernv' / '-M powernv10' / '-M powernv11'
* '-smp' option tested
* with compat mode: 'max-cpu-compat=power10' and 'max-cpu-compat=power9'
* with/without device 'virtio-scsi-pci'
* with/without -kernel and -drive with qcow_file
skiboot with Power11 support: https://github.com/maheshsal/skiboot/tree/upstream_power11
Linux with Power11 support: https://github.com/torvalds/linux, since v6.9-rc1
Note: This patch series does not add tests as of now, and will be done as soon as skiboot support for Power11 gets merged, and op-build adds a release for Power11
Changelog
=========
v3:
+ patch #1: version power11 as power11_v2.0
+ patch #2: split target hw/pseries code into patch #2
+ patch #3,#4: fix regression due to Power10 and Power11 having same PCR
+ patch #5: create pnv_chip_power11_dt_populate and split pnv_chip_power10_common_realize as per review
+ patch #6-#11: no change
- remove commit to make Power11 as default
v2:
+ split powernv patch into homer,lpc,occ,psi,sbe
+ reduce code duplication by reusing power10 code
+ make power11 as default
+ rebase on qemu upstream/master
+ add more information in commit descriptions
+ update docs
+ update skiboot.lid
Aditya Gupta (11):
ppc: Add Power11 DD2.0 processor
ppc/pseries: Add Power11 cpu type
target/ppc: Introduce 'PowerPCCPUClass::logical_pvr' target/ppc: Fix regression due to Power10 and Power11 having same PCR ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine ppc/pnv: Add HOMER for POWER11
ppc/pnv: Add a LPC controller for POWER11
ppc/pnv: Add OCC for Power11
ppc/pnv: Add a PSI bridge model for Power11
ppc/pnv: Add SBE model for Power11
ppc/pnv: Update skiboot.lid to support Power11
docs/system/ppc/powernv.rst | 9 +-- docs/system/ppc/pseries.rst | 6 +- hw/ppc/pnv.c | 119 ++++++++++++++++++++++++++++++++++-- hw/ppc/pnv_core.c | 11 ++++ hw/ppc/pnv_homer.c | 8 +++ hw/ppc/pnv_lpc.c | 14 +++++ hw/ppc/pnv_occ.c | 14 +++++ hw/ppc/pnv_psi.c | 24 ++++++++ hw/ppc/pnv_sbe.c | 15 +++++ hw/ppc/spapr_cpu_core.c | 1 + include/hw/ppc/pnv.h | 5 ++ include/hw/ppc/pnv_chip.h | 7 +++ include/hw/ppc/pnv_core.h | 1 + include/hw/ppc/pnv_homer.h | 3 + include/hw/ppc/pnv_lpc.h | 4 ++ include/hw/ppc/pnv_occ.h | 2 + include/hw/ppc/pnv_psi.h | 2 + include/hw/ppc/pnv_sbe.h | 2 + pc-bios/skiboot.lid | Bin 2527328 -> 2527328 bytes target/ppc/compat.c | 11 ++++ target/ppc/cpu-models.c | 3 + target/ppc/cpu-models.h | 3 + target/ppc/cpu.h | 1 + target/ppc/cpu_init.c | 107 ++++++++++++++++++++++++++++++++ 24 files changed, 361 insertions(+), 11 deletions(-)
Signature · 1 line
2.45.1
PATCH v3 1/11 ppc: Add Power11 DD2.0 processor
Add CPU target code to add support for new Power11 Processor.
Power11 core is same as Power10, hence reuse functions defined for Power10.
--- target/ppc/compat.c | 7 +++ target/ppc/cpu-models.c | 3 ++ target/ppc/cpu-models.h | 3 ++ target/ppc/cpu_init.c | 102 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+)
target/ppc/compat.c +7 -0
@@ -100,6 +100,13 @@ static const CompatInfo compat_table[] = { .pcr_level = PCR_COMPAT_3_10, .max_vthreads = 8, }, + {/* POWER11, ISA3.10 */ + .name = "power11", + .pvr = CPU_POWERPC_LOGICAL_3_10_PLUS, + .pcr = PCR_COMPAT_3_10, + .pcr_level = PCR_COMPAT_3_10, + .max_vthreads = 8, + }, };static const CompatInfo *compat_by_pvr (uint32_t pvr)
target/ppc/cpu-models.c +3 -0
@@ -734,6 +734,8 @@ "POWER9 v2.2") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER10, "POWER10 v2.0") + POWERPC_DEF("power11_v2.0", CPU_POWERPC_POWER11_DD20, POWER11, + "POWER11_v2.0")#endif /* defined (TARGET_PPC64) */ /***************************************************************************/
@@ -909,6 +911,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = { { "power8nvl", "power8nvl_v1.0" }, { "power9", "power9_v2.2" }, { "power10", "power10_v2.0" }, + { "power11", "power11_v2.0" }, #endif /* Generic PowerPCs */
target/ppc/cpu-models.h +3 -0
@@ -354,6 +354,8 @@ enum {CPU_POWERPC_POWER10_BASE =0x00800000 ,CPU_POWERPC_POWER10_DD1 =0x00801100 ,CPU_POWERPC_POWER10_DD20 =0x00801200 , +CPU_POWERPC_POWER11_BASE =0x00820000 , +CPU_POWERPC_POWER11_DD20 =0x00821200 , CPU_POWERPC_970_v22 =0x00390202 , CPU_POWERPC_970FX_v10 =0x00391100 , CPU_POWERPC_970FX_v20 = 0x003C0200,
@@ -391,6 +393,7 @@ enum {CPU_POWERPC_LOGICAL_2_07 =0x0F000004 ,CPU_POWERPC_LOGICAL_3_00 =0x0F000005 ,CPU_POWERPC_LOGICAL_3_10 =0x0F000006 , + CPU_POWERPC_LOGICAL_3_10_PLUS = 0x0F000007, };/* System version register (used on MPC 8xxx) */
target/ppc/cpu_init.c +102 -0
108 lines not on this page · raw message
Signature · 1 line
2.45.1
PATCH v3 2/11 ppc/pseries: Add Power11 cpu type
In reply to Aditya GuptaAdd sPAPR CPU Core definition for Power11
--- docs/system/ppc/pseries.rst | 6 +++--- hw/ppc/spapr_cpu_core.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
docs/system/ppc/pseries.rst +3 -3
@@ -15,9 +15,9 @@ Supported devices ================= * Multi processor support for many Power processors generations: POWER7, - POWER7+, POWER8, POWER8NVL, POWER9, and Power10. Support for POWER5+ exists, - but its state is unknown. - * Interrupt Controller, XICS (POWER8) and XIVE (POWER9 and Power10) + POWER7+, POWER8, POWER8NVL, POWER9, Power10 and Power11. Support for POWER5+ + exists, but its state is unknown. + * Interrupt Controller, XICS (POWER8) and XIVE (POWER9, Power10, Power11) * vPHB PCIe Host bridge. * vscsi and vnet devices, compatible with the same devices available on a PowerVM hypervisor with VIOS managing LPARs.
hw/ppc/spapr_cpu_core.c +1 -0
@@ -401,6 +401,7 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.2" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v2.0" ), +DEFINE_SPAPR_CPU_CORE_TYPE ("power11_v2.0" ), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"), #endif
Signature · 1 line
2.45.1
PATCH v3 3/11 target/ppc: Introduce 'PowerPCCPUClass::logical_pvr'
In reply to Aditya GuptaIntroduce 'PnvChipClass::logical_pvr' to know corresponding logical PVR of a PowerPC CPU.
This helps to have a one-to-one mapping between PVR and logical PVR for a CPU, and used in a later commit to handle cases where PCR of two generations of Power chip is same, which causes regressions with compat-mode.
--- target/ppc/cpu.h | 1 + target/ppc/cpu_init.c | 5 +++++ 2 files changed, 6 insertions(+)
target/ppc/cpu.h +1 -0
@@ -1504,6 +1504,7 @@ struct PowerPCCPUClass {void (*parent_parse_features)(const char *type,char *str,Error **errp);uint32_t pvr; +uint32_t logical_pvr;/* * If @best is false, match if pcc is in the family of pvr * Else match only if pcc is the best match for pvr in this family.
target/ppc/cpu_init.c +5 -0
@@ -6151,6 +6151,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER7" ; dc->desc ="POWER7" ; + pcc->logical_pvr =CPU_POWERPC_LOGICAL_2_06_PLUS ; pcc->pvr_match = ppc_pvr_match_power7; pcc->pcr_mask =PCR_VEC_DIS |PCR_VSX_DIS |PCR_COMPAT_2_05 ; pcc->pcr_supported =PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ;
@@ -6314,6 +6315,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER8" ; dc->desc ="POWER8" ; + pcc->logical_pvr =CPU_POWERPC_LOGICAL_2_07 ; pcc->pvr_match = ppc_pvr_match_power8; pcc->pcr_mask =PCR_TM_DIS |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ; pcc->pcr_supported =PCR_COMPAT_2_07 |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ;
@@ -6507,6 +6509,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER9" ; dc->desc ="POWER9" ; + pcc->logical_pvr =CPU_POWERPC_LOGICAL_3_00 ; pcc->pvr_match = ppc_pvr_match_power9; pcc->pcr_mask =PCR_COMPAT_2_05 |PCR_COMPAT_2_06 |PCR_COMPAT_2_07 ; pcc->pcr_supported = PCR_COMPAT_3_00 | PCR_COMPAT_2_07 | PCR_COMPAT_2_06 |
@@ -6687,6 +6690,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER10" ; dc->desc ="POWER10" ; + pcc->logical_pvr =CPU_POWERPC_LOGICAL_3_10 ; pcc->pvr_match = ppc_pvr_match_power10; pcc->pcr_mask =PCR_COMPAT_2_05 |PCR_COMPAT_2_06 |PCR_COMPAT_2_07 |PCR_COMPAT_3_00 ;
@@ -6790,6 +6794,7 @@ POWERPC_FAMILY(POWER11)(ObjectClass *oc, void *data) dc->fw_name ="PowerPC,POWER11" ; dc->desc ="POWER11" ; + pcc->logical_pvr =CPU_POWERPC_LOGICAL_3_10_PLUS ; pcc->pvr_match = ppc_pvr_match_power11; pcc->pcr_mask =PCR_COMPAT_2_05 |PCR_COMPAT_2_06 |PCR_COMPAT_2_07 |PCR_COMPAT_3_00 ;
Signature · 1 line
2.45.1
PATCH v3 4/11 target/ppc: Fix regression due to Power10 and Power11 having same PCR
In reply to Aditya GuptaPower11 has the same PCR (Processor Compatibility Register) value, as Power10.
Due to this, QEMU considers Power11 as a valid compat-mode for Power10,
ie. earlier it was possible to run QEMU with '-M pseries,max-compat-mode=power11 --cpu power10'
Same PCR also introduced a regression where -M pseries --cpu power10 boots as Power11 (ie. logical PVR is of Power11, even though PVR is Power10). The regression was due to 'do_client_architecture_support' checking for valid compat modes and finding Power11 to be a valid compat mode for Power10 (it happens even without passing 'max-compat-mode' explicitly).
Fix compat-mode issue and regression, by ensuring a future Power processor (with a higher logical_pvr value, eg. P11) cannot be valid compat-mode for an older Power processor (eg. P10)
---
Multiple alternative approaches were tried to fix this:
1. New PCR for Power11: No
2. 'Hacky fix': chose (n-1) entry in compat table in case of Power10.
Commit: https://github.com/adi-g15-ibm/qemu/commit/c79bd667791883d4fb5e643979ae9c86a97bdf66
Pros: Doesn't require adding a new field
Cons: Hacky fix, will need change if Power12 comes with same PCR as
Power10 (unlikely)
3. Setting current Processor's .logical_pvr as the max_compat to be checked during CAS (Client Architecture Support).
Commit: https://github.com/adi-g15-ibm/qemu/commit/30e430be71c6f3296017177298e54532570c2c87
This causes CAS to not consider Power11 if cpu is Power10
---
--- target/ppc/compat.c | 4 ++++ 1 file changed, 4 insertions(+)
target/ppc/compat.c +4 -0
@@ -139,6 +139,10 @@ static bool pcc_compat(PowerPCCPUClass *pcc, uint32_t compat_pvr,/* Outside specified range */ return false; } +if (compat->pvr > pcc->logical_pvr) { +/* Older CPU cannot support a newer processor's compat mode */ +return false; + }if (!(pcc->pcr_supported & compat->pcr_level)) {/* Not supported by this CPU */ return false;
Signature · 1 line
2.45.1
PATCH v3 5/11 ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine
In reply to Aditya GuptaPower11 core is same as Power10, use the existing functionalities to introduce a Power11 chip and machine, with Power10 chip as parent of Power11 chip, thus going through similar class_init paths
--- docs/system/ppc/powernv.rst | 9 +-- hw/ppc/pnv.c | 119 ++++++++++++++++++++++++++++++++++-- hw/ppc/pnv_core.c | 11 ++++ include/hw/ppc/pnv.h | 5 ++ include/hw/ppc/pnv_chip.h | 7 +++ include/hw/ppc/pnv_core.h | 1 + 6 files changed, 144 insertions(+), 8 deletions(-)
docs/system/ppc/powernv.rst +5 -4
@@ -1,5 +1,5 @@ -PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``) -================================================================== +PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``, ``powernv11``) +================================================================================ PowerNV (as Non-Virtualized) is the "bare metal" platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can
@@ -15,11 +15,12 @@ beyond the scope of what QEMU addresses today. Supported devices ----------------- - * Multi processor support for POWER8, POWER8NVL and POWER9. + * Multi processor support for POWER8, POWER8NVL, POWER9, Power10 and Power11. * XSCOM, serial communication sideband bus to configure chiplets. * Simple LPC Controller. * Processor Service Interface (PSI) Controller. - * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10). + * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10 & + Power11). * POWER8 PHB3 PCIe Host bridge and POWER9 PHB4 PCIe Host bridge. * Simple OCC is an on-chip micro-controller used for power management tasks. * iBT device to handle BMC communication, with the internal BMC simulator
hw/ppc/pnv.c +115 -4
186 lines not on this page · raw message
hw/ppc/pnv_core.c +11 -0
@@ -372,6 +372,11 @@ static void pnv_core_power10_class_init(ObjectClass *oc, void *data) pcc->xscom_size =PNV10_XSCOM_EC_SIZE ; } +static void pnv_core_power11_class_init (ObjectClass *oc,void *data) +{ +pnv_core_power10_class_init (oc, data); +} +static void pnv_core_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);
@@ -403,6 +408,7 @@ static const TypeInfo pnv_core_infos[] = {DEFINE_PNV_CORE_TYPE (power8,"power8nvl_v1.0" ),DEFINE_PNV_CORE_TYPE (power9,"power9_v2.2" ),DEFINE_PNV_CORE_TYPE (power10,"power10_v2.0" ), +DEFINE_PNV_CORE_TYPE (power11,"power11_v2.0" ), };DEFINE_TYPES (pnv_core_infos)
@@ -634,6 +640,11 @@ static const TypeInfo pnv_quad_infos[] = { .name = PNV_QUAD_TYPE_NAME("power10"), .class_init = pnv_quad_power10_class_init, }, + { + .parent = PNV_QUAD_TYPE_NAME("power10"), + .name = PNV_QUAD_TYPE_NAME("power11"), + .class_init = pnv_quad_power10_class_init, + }, };DEFINE_TYPES (pnv_quad_infos);
include/hw/ppc/pnv.h +5 -0
@@ -33,6 +33,7 @@ typedef struct PnvChip PnvChip;typedef struct Pnv8Chip Pnv8Chip ;typedef struct Pnv9Chip Pnv9Chip ;typedef struct Pnv10Chip Pnv10Chip ; +typedef struct Pnv10Chip Pnv11Chip ;#define PNV_CHIP_TYPE_SUFFIX "-" TYPE_PNV_CHIP#define PNV_CHIP_TYPE_NAME (cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX
@@ -57,6 +58,10 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER9,DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER10 , TYPE_PNV_CHIP_POWER10) +#define TYPE_PNV_CHIP_POWER11 PNV_CHIP_TYPE_NAME("power11_v2.0") +DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER11 , + TYPE_PNV_CHIP_POWER11) +PnvCore *pnv_chip_find_core (PnvChip *chip,uint32_t core_id);PowerPCCPU *pnv_chip_find_cpu (PnvChip *chip,uint32_t pir);
include/hw/ppc/pnv_chip.h +7 -0
@@ -132,6 +132,13 @@ struct Pnv10Chip {#define PNV10_PIR2FUSEDCORE (pir) (((pir) >> 3) & 0xf)#define PNV10_PIR2CHIP (pir) (((pir) >> 8) & 0x7f) +#define TYPE_PNV11_CHIP "pnv11-chip" +DECLARE_INSTANCE_CHECKER (Pnv11Chip,PNV11_CHIP , +TYPE_PNV11_CHIP ) + +/* Power11 core is same as Power10 */ +typedef struct Pnv10Chip Pnv11Chip ; +struct PnvChipClass {/*< private >*/ SysBusDeviceClass parent_class;
include/hw/ppc/pnv_core.h +1 -0
@@ -76,6 +76,7 @@ struct PnvQuadClass {#define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD#define PNV_QUAD_TYPE_NAME (cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX +#define PNV_QUAD_TYPE_NAME_DYN (cpu) g_strconcat(cpu, PNV_QUAD_TYPE_SUFFIX, NULL)OBJECT_DECLARE_TYPE (PnvQuad, PnvQuadClass,PNV_QUAD )
Signature · 1 line
2.45.1
Re: [PATCH v3 05/11] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine
Quoted 329 lines · Aditya Gupta
Power11 core is same as Power10, use the existing functionalities to introduce a Power11 chip and machine, with Power10 chip as parent of Power11 chip, thus going through similar
class_initpathsCc Cédric Le Goater <[email protected]>Cc Frédéric Barrat <[email protected]>Cc Mahesh J Salgaonkar <[email protected]>Cc Madhavan Srinivasan <[email protected]>Cc Nicholas Piggin <[email protected]>Signed-off-by Aditya Gupta <[email protected]>--- docs/system/ppc/powernv.rst | 9 +-- hw/ppc/pnv.c | 119 ++++++++++++++++++++++++++++++++++-- hw/ppc/pnv_core.c | 11 ++++ include/hw/ppc/pnv.h | 5 ++ include/hw/ppc/pnv_chip.h | 7 +++ include/hw/ppc/pnv_core.h | 1 + 6 files changed, 144 insertions(+), 8 deletions(-)docs/system/ppc/powernv.rst +5
-4@@ -1,5 +1,5 @@ -PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``) -================================================================== +PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``, ``powernv11``) +================================================================================ PowerNV (as Non-Virtualized) is the "bare metal" platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can@@ -15,11 +15,12 @@ beyond the scope of what QEMU addresses today. Supported devices ----------------- - * Multi processor support for POWER8, POWER8NVL and POWER9. + * Multi processor support for POWER8, POWER8NVL, POWER9, Power10 and Power11. * XSCOM, serial communication sideband bus to configure chiplets. * Simple LPC Controller. * Processor Service Interface (PSI) Controller. - * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10). + * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10 & + Power11). * POWER8 PHB3 PCIe Host bridge and POWER9 PHB4 PCIe Host bridge. * Simple OCC is an on-chip micro-controller used for power management tasks. * iBT device to handle BMC communication, with the internal BMC simulatorhw/ppc/pnv.c +115
-4@@ -456,6 +456,33 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV10_LPCM_BASE (chip),PNV10_LPCM_SIZE ); } +static void pnv_chip_power11_dt_populate (PnvChip *chip,void *fdt) +{ +static const char compat[] ="ibm,power11-xscom\0ibm,xscom" ; +int i; + +pnv_dt_xscom (chip, fdt,0 , +cpu_to_be64 (PNV10_XSCOM_BASE (chip)), +cpu_to_be64 (PNV10_XSCOM_SIZE ), + compat,sizeof (compat)); + +for (i =0 ; i < chip->nr_cores; i++) { +PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); + +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_31,sizeof (pa_features_31)))); + } + +if (chip->ram_size) { +pnv_dt_memory (fdt, chip->chip_id, chip->ram_start, chip->ram_size); + } + +pnv_dt_lpc (chip, fdt,0 ,PNV10_LPCM_BASE (chip),PNV10_LPCM_SIZE ); +} +static void pnv_dt_rtc (ISADevice *d,void *fdt,int lpc_off) {uint32_t io_base = d->ioport_id;@@ -1288,6 +1315,8 @@ static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,#define POWER10_CORE_MASK (0xffffffffffffffull) +#define POWER11_CORE_MASK (0xffffffffffffffull) +static void pnv_chip_power8_instance_init (Object *obj) {Pnv8Chip *chip8 =PNV8_CHIP (obj);@@ -1831,7 +1860,8 @@ static void pnv_chip_power10_instance_init(Object *obj) } } -static void pnv_chip_power10_quad_realize (Pnv10Chip *chip10,Error **errp) +static void pnv_chip_power10_quad_realize (Pnv10Chip *chip10,Error **errp, +const char *cpu_model) {PnvChip *chip =PNV_CHIP (chip10);int i;@@ -1843,7 +1873,7 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)PnvQuad *eq = &chip10->quads[i];pnv_chip_quad_realize_one (chip, eq, chip->cores[i *4 ], -PNV_QUAD_TYPE_NAME ("power10" )); +PNV_QUAD_TYPE_NAME_DYN (cpu_model));pnv_xscom_add_subregion (chip,PNV10_XSCOM_EQ_BASE (eq->quad_id), &eq->xscom_regs);@@ -1881,7 +1911,8 @@ static void pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp) } } -static void pnv_chip_power10_realize (DeviceState *dev,Error **errp) +static void pnv_chip_power10_common_realize (DeviceState *dev,Error **errp, +const char *cpu_model) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev);PnvChip *chip =PNV_CHIP (dev);@@ -1898,7 +1929,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)return ; } -pnv_chip_power10_quad_realize (chip10, &local_err); +pnv_chip_power10_quad_realize (chip10, &local_err, cpu_model);if (local_err) {error_propagate (errp, local_err);return ;@@ -2046,6 +2077,16 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp) } +static void pnv_chip_power10_realize (DeviceState *dev,Error **errp) +{ +pnv_chip_power10_common_realize (dev, errp,"power10" ); +} + +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) +{ +pnv_chip_power10_common_realize (dev, errp,"power11" ); +} +static void pnv_rainier_i2c_init (PnvMachineState *pnv) {int i;@@ -2111,6 +2152,34 @@ static void pnv_chip_power10_class_init(ObjectClass *klass, void *data) &k->parent_realize); } +static void pnv_chip_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PnvChipClass *k =PNV_CHIP_CLASS (klass); + +static const int i2c_ports_per_engine[PNV10_CHIP_MAX_I2C ] = {14 ,14 ,2 ,16 }; + + k->chip_cfam_id =0x220da04980000000ull ;/* P11 DD2.0 (with NX) */ + k->cores_mask =POWER11_CORE_MASK ; + k->chip_pir = pnv_chip_pir_p10; + k->intc_create = pnv_chip_power10_intc_create; + k->intc_reset = pnv_chip_power10_intc_reset; + k->intc_destroy = pnv_chip_power10_intc_destroy; + k->intc_print_info = pnv_chip_power10_intc_print_info; + k->isa_create = pnv_chip_power10_isa_create; + k->dt_populate = pnv_chip_power11_dt_populate; + k->pic_print_info = pnv_chip_power10_pic_print_info; + k->xscom_core_base = pnv_chip_power10_xscom_core_base; + k->xscom_pcba = pnv_chip_power10_xscom_pcba; + dc->desc ="PowerNV Chip POWER11" ; + k->num_pecs =PNV10_CHIP_MAX_PEC ; + k->i2c_num_engines =PNV10_CHIP_MAX_I2C ; + k->i2c_ports_per_engine = i2c_ports_per_engine; + +device_class_set_parent_realize (dc, pnv_chip_power11_realize, + &k->parent_realize); +} +static void pnv_chip_core_sanitize (PnvChip *chip,Error **errp) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (chip);@@ -2505,6 +2574,22 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) pmc->i2c_init = pnv_rainier_i2c_init; } +static void pnv_machine_power11_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc); +static const char compat[] ="qemu,powernv11\0ibm,powernv" ; + +/* do power10_class_init as p11 core is same as p10 */ +pnv_machine_p10_common_class_init (oc, data); + + mc->desc ="IBM PowerNV (Non-Virtualized) POWER11" ; + mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power11_v2.0" ); + + pmc->compat = compat; + pmc->compat_size =sizeof (compat); +} +static bool pnv_machine_get_hb (Object *obj,Error **errp) {PnvMachineState *pnv =PNV_MACHINE (obj);@@ -2608,7 +2693,23 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) .parent = TYPE_PNV10_CHIP, \ } +#define DEFINE_PNV11_CHIP_TYPE (type, class_initfn) \ + { \ + .name = type, \ + .class_init = class_initfn, \ + .parent = TYPE_PNV11_CHIP, \ + } +static const TypeInfo types[] = { + { + .name =MACHINE_TYPE_NAME ("powernv11" ), + .parent =TYPE_PNV_MACHINE , + .class_init = pnv_machine_power11_class_init, + .interfaces = (InterfaceInfo []) { + {TYPE_XIVE_FABRIC }, + { }, + }, + }, { .name =MACHINE_TYPE_NAME ("powernv10-rainier" ), .parent =MACHINE_TYPE_NAME ("powernv10" ),@@ -2663,6 +2764,16 @@ static const TypeInfo types[] = { .abstract = true, }, +/* +* P11 chip and variants +*/ + { + .name = TYPE_PNV11_CHIP, + .parent = TYPE_PNV10_CHIP, + .instance_size =sizeof (Pnv11Chip), + }, + DEFINE_PNV11_CHIP_TYPE(TYPE_PNV_CHIP_POWER11, pnv_chip_power11_class_init), +/* * P10 chip and variants */ hw/ppc/pnv_core.c +11
-0@@ -372,6 +372,11 @@ static void pnv_core_power10_class_init(ObjectClass *oc, void *data) pcc->xscom_size =PNV10_XSCOM_EC_SIZE ; } +static void pnv_core_power11_class_init (ObjectClass *oc,void *data) +{ +pnv_core_power10_class_init (oc, data); +} +static void pnv_core_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);@@ -403,6 +408,7 @@ static const TypeInfo pnv_core_infos[] = {DEFINE_PNV_CORE_TYPE (power8,"power8nvl_v1.0" ),DEFINE_PNV_CORE_TYPE (power9,"power9_v2.2" ),DEFINE_PNV_CORE_TYPE (power10,"power10_v2.0" ), +DEFINE_PNV_CORE_TYPE (power11,"power11_v2.0" ), };DEFINE_TYPES (pnv_core_infos)@@ -634,6 +640,11 @@ static const TypeInfo pnv_quad_infos[] = { .name = PNV_QUAD_TYPE_NAME("power10"), .class_init = pnv_quad_power10_class_init, }, + { + .parent = PNV_QUAD_TYPE_NAME("power10"), + .name = PNV_QUAD_TYPE_NAME("power11"), + .class_init = pnv_quad_power10_class_init, + }, };DEFINE_TYPES (pnv_quad_infos);include/hw/ppc/pnv.h +5
-0@@ -33,6 +33,7 @@ typedef struct PnvChip PnvChip;typedef struct Pnv8Chip Pnv8Chip ;typedef struct Pnv9Chip Pnv9Chip ;typedef struct Pnv10Chip Pnv10Chip ; +typedef struct Pnv10Chip Pnv11Chip ;#define PNV_CHIP_TYPE_SUFFIX "-" TYPE_PNV_CHIP#define PNV_CHIP_TYPE_NAME (cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX@@ -57,6 +58,10 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER9,DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER10 , TYPE_PNV_CHIP_POWER10) +#define TYPE_PNV_CHIP_POWER11 PNV_CHIP_TYPE_NAME("power11_v2.0") +DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER11 , + TYPE_PNV_CHIP_POWER11) +PnvCore *pnv_chip_find_core (PnvChip *chip,uint32_t core_id);PowerPCCPU *pnv_chip_find_cpu (PnvChip *chip,uint32_t pir);include/hw/ppc/pnv_chip.h +7
-0@@ -132,6 +132,13 @@ struct Pnv10Chip {#define PNV10_PIR2FUSEDCORE (pir) (((pir) >> 3) & 0xf)#define PNV10_PIR2CHIP (pir) (((pir) >> 8) & 0x7f) +#define TYPE_PNV11_CHIP "pnv11-chip" +DECLARE_INSTANCE_CHECKER (Pnv11Chip,PNV11_CHIP , +TYPE_PNV11_CHIP ) + +/* Power11 core is same as Power10 */ +typedef struct Pnv10Chip Pnv11Chip ; +struct PnvChipClass {/*< private >*/ SysBusDeviceClass parent_class;include/hw/ppc/pnv_core.h +0
-0
include/hw/ppc/pnv_core.h struct PnvQuadClass { · line 79
Quoted 4 lines
include/hw/ppc/pnv_core.h +1
-0@@ -76,6 +76,7 @@ struct PnvQuadClass {#define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD#define PNV_QUAD_TYPE_NAME (cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX +#define PNV_QUAD_TYPE_NAME_DYN (cpu) g_strconcat(cpu, PNV_QUAD_TYPE_SUFFIX, NULL)
This is a leak. Please fix in pnv_chip_power10_quad_realize() using a g_autofree variable maybe.
The rest looks good.
Thanks,
C.
Quoted 3 lines
include/hw/ppc/pnv_core.h +0
-0OBJECT_DECLARE_TYPE (PnvQuad, PnvQuadClass,PNV_QUAD )
Re: [PATCH v3 05/11] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine
Quoted 305 lines · Cédric Le Goater
Quoted 304 lines · Aditya Gupta
Power11 core is same as Power10, use the existing functionalities to introduce a Power11 chip and machine, with Power10 chip as parent of Power11 chip, thus going through similar
class_initpathsCc Cédric Le Goater <[email protected]>Cc Frédéric Barrat <[email protected]>Cc Mahesh J Salgaonkar <[email protected]>Cc Madhavan Srinivasan <[email protected]>Cc Nicholas Piggin <[email protected]>Signed-off-by Aditya Gupta <[email protected]>--- docs/system/ppc/powernv.rst | 9 +-- hw/ppc/pnv.c | 119 ++++++++++++++++++++++++++++++++++-- hw/ppc/pnv_core.c | 11 ++++ include/hw/ppc/pnv.h | 5 ++ include/hw/ppc/pnv_chip.h | 7 +++ include/hw/ppc/pnv_core.h | 1 + 6 files changed, 144 insertions(+), 8 deletions(-)docs/system/ppc/powernv.rst +5
-4@@ -1,5 +1,5 @@ -PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``) -================================================================== +PowerNV family boards (``powernv8``, ``powernv9``, ``powernv10``, ``powernv11``) +================================================================================ PowerNV (as Non-Virtualized) is the "bare metal" platform using the OPAL firmware. It runs Linux on IBM and OpenPOWER systems and it can@@ -15,11 +15,12 @@ beyond the scope of what QEMU addresses today. Supported devices ----------------- - * Multi processor support for POWER8, POWER8NVL and POWER9. + * Multi processor support for POWER8, POWER8NVL, POWER9, Power10 and Power11. * XSCOM, serial communication sideband bus to configure chiplets. * Simple LPC Controller. * Processor Service Interface (PSI) Controller. - * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10). + * Interrupt Controller, XICS (POWER8) and XIVE (POWER9) and XIVE2 (Power10 & + Power11). * POWER8 PHB3 PCIe Host bridge and POWER9 PHB4 PCIe Host bridge. * Simple OCC is an on-chip micro-controller used for power management tasks. * iBT device to handle BMC communication, with the internal BMC simulatorhw/ppc/pnv.c +115
-4@@ -456,6 +456,33 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV10_LPCM_BASE (chip),PNV10_LPCM_SIZE ); } +static void pnv_chip_power11_dt_populate (PnvChip *chip,void *fdt) +{ +static const char compat[] ="ibm,power11-xscom\0ibm,xscom" ; +int i; + +pnv_dt_xscom (chip, fdt,0 , +cpu_to_be64 (PNV10_XSCOM_BASE (chip)), +cpu_to_be64 (PNV10_XSCOM_SIZE ), + compat,sizeof (compat)); + +for (i =0 ; i < chip->nr_cores; i++) { +PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); + +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_31,sizeof (pa_features_31)))); + } + +if (chip->ram_size) { +pnv_dt_memory (fdt, chip->chip_id, chip->ram_start, chip->ram_size); + } + +pnv_dt_lpc (chip, fdt,0 ,PNV10_LPCM_BASE (chip),PNV10_LPCM_SIZE ); +} +static void pnv_dt_rtc (ISADevice *d,void *fdt,int lpc_off) {uint32_t io_base = d->ioport_id;@@ -1288,6 +1315,8 @@ static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,#define POWER10_CORE_MASK (0xffffffffffffffull) +#define POWER11_CORE_MASK (0xffffffffffffffull) +static void pnv_chip_power8_instance_init (Object *obj) {Pnv8Chip *chip8 =PNV8_CHIP (obj);@@ -1831,7 +1860,8 @@ static void pnv_chip_power10_instance_init(Object *obj) } } -static void pnv_chip_power10_quad_realize (Pnv10Chip *chip10,Error **errp) +static void pnv_chip_power10_quad_realize (Pnv10Chip *chip10,Error **errp, +const char *cpu_model) {PnvChip *chip =PNV_CHIP (chip10);int i;@@ -1843,7 +1873,7 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)PnvQuad *eq = &chip10->quads[i];pnv_chip_quad_realize_one (chip, eq, chip->cores[i *4 ], -PNV_QUAD_TYPE_NAME ("power10" )); +PNV_QUAD_TYPE_NAME_DYN (cpu_model));pnv_xscom_add_subregion (chip,PNV10_XSCOM_EQ_BASE (eq->quad_id), &eq->xscom_regs);@@ -1881,7 +1911,8 @@ static void pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp) } } -static void pnv_chip_power10_realize (DeviceState *dev,Error **errp) +static void pnv_chip_power10_common_realize (DeviceState *dev,Error **errp, +const char *cpu_model) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev);PnvChip *chip =PNV_CHIP (dev);@@ -1898,7 +1929,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)return ; } -pnv_chip_power10_quad_realize (chip10, &local_err); +pnv_chip_power10_quad_realize (chip10, &local_err, cpu_model);if (local_err) {error_propagate (errp, local_err);return ;@@ -2046,6 +2077,16 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp) } +static void pnv_chip_power10_realize (DeviceState *dev,Error **errp) +{ +pnv_chip_power10_common_realize (dev, errp,"power10" ); +} + +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) +{ +pnv_chip_power10_common_realize (dev, errp,"power11" ); +} +static void pnv_rainier_i2c_init (PnvMachineState *pnv) {int i;@@ -2111,6 +2152,34 @@ static void pnv_chip_power10_class_init(ObjectClass *klass, void *data) &k->parent_realize); } +static void pnv_chip_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PnvChipClass *k =PNV_CHIP_CLASS (klass); + +static const int i2c_ports_per_engine[PNV10_CHIP_MAX_I2C ] = {14 ,14 ,2 ,16 }; + + k->chip_cfam_id =0x220da04980000000ull ;/* P11 DD2.0 (with NX) */ + k->cores_mask =POWER11_CORE_MASK ; + k->chip_pir = pnv_chip_pir_p10; + k->intc_create = pnv_chip_power10_intc_create; + k->intc_reset = pnv_chip_power10_intc_reset; + k->intc_destroy = pnv_chip_power10_intc_destroy; + k->intc_print_info = pnv_chip_power10_intc_print_info; + k->isa_create = pnv_chip_power10_isa_create; + k->dt_populate = pnv_chip_power11_dt_populate; + k->pic_print_info = pnv_chip_power10_pic_print_info; + k->xscom_core_base = pnv_chip_power10_xscom_core_base; + k->xscom_pcba = pnv_chip_power10_xscom_pcba; + dc->desc ="PowerNV Chip POWER11" ; + k->num_pecs =PNV10_CHIP_MAX_PEC ; + k->i2c_num_engines =PNV10_CHIP_MAX_I2C ; + k->i2c_ports_per_engine = i2c_ports_per_engine; + +device_class_set_parent_realize (dc, pnv_chip_power11_realize, + &k->parent_realize); +} +static void pnv_chip_core_sanitize (PnvChip *chip,Error **errp) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (chip);@@ -2505,6 +2574,22 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) pmc->i2c_init = pnv_rainier_i2c_init; } +static void pnv_machine_power11_class_init (ObjectClass *oc,void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc); +static const char compat[] ="qemu,powernv11\0ibm,powernv" ; + +/* do power10_class_init as p11 core is same as p10 */ +pnv_machine_p10_common_class_init (oc, data); + + mc->desc ="IBM PowerNV (Non-Virtualized) POWER11" ; + mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power11_v2.0" ); + + pmc->compat = compat; + pmc->compat_size =sizeof (compat); +} +static bool pnv_machine_get_hb (Object *obj,Error **errp) {PnvMachineState *pnv =PNV_MACHINE (obj);@@ -2608,7 +2693,23 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) .parent = TYPE_PNV10_CHIP, \ } +#define DEFINE_PNV11_CHIP_TYPE (type, class_initfn) \ + { \ + .name = type, \ + .class_init = class_initfn, \ + .parent = TYPE_PNV11_CHIP, \ + } +static const TypeInfo types[] = { + { + .name =MACHINE_TYPE_NAME ("powernv11" ), + .parent =TYPE_PNV_MACHINE , + .class_init = pnv_machine_power11_class_init, + .interfaces = (InterfaceInfo []) { + {TYPE_XIVE_FABRIC }, + { }, + }, + }, { .name =MACHINE_TYPE_NAME ("powernv10-rainier" ), .parent =MACHINE_TYPE_NAME ("powernv10" ),@@ -2663,6 +2764,16 @@ static const TypeInfo types[] = { .abstract = true, }, +/* +* P11 chip and variants +*/ + { + .name = TYPE_PNV11_CHIP, + .parent = TYPE_PNV10_CHIP, + .instance_size =sizeof (Pnv11Chip), + }, + DEFINE_PNV11_CHIP_TYPE(TYPE_PNV_CHIP_POWER11, pnv_chip_power11_class_init), +/* * P10 chip and variants */ hw/ppc/pnv_core.c +11
-0@@ -372,6 +372,11 @@ static void pnv_core_power10_class_init(ObjectClass *oc, void *data) pcc->xscom_size =PNV10_XSCOM_EC_SIZE ; } +static void pnv_core_power11_class_init (ObjectClass *oc,void *data) +{ +pnv_core_power10_class_init (oc, data); +} +static void pnv_core_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);@@ -403,6 +408,7 @@ static const TypeInfo pnv_core_infos[] = {DEFINE_PNV_CORE_TYPE (power8,"power8nvl_v1.0" ),DEFINE_PNV_CORE_TYPE (power9,"power9_v2.2" ),DEFINE_PNV_CORE_TYPE (power10,"power10_v2.0" ), +DEFINE_PNV_CORE_TYPE (power11,"power11_v2.0" ), };DEFINE_TYPES (pnv_core_infos)@@ -634,6 +640,11 @@ static const TypeInfo pnv_quad_infos[] = { .name = PNV_QUAD_TYPE_NAME("power10"), .class_init = pnv_quad_power10_class_init, }, + { + .parent = PNV_QUAD_TYPE_NAME("power10"), + .name = PNV_QUAD_TYPE_NAME("power11"), + .class_init = pnv_quad_power10_class_init, + }, };DEFINE_TYPES (pnv_quad_infos);include/hw/ppc/pnv.h +5
-0@@ -33,6 +33,7 @@ typedef struct PnvChip PnvChip;typedef struct Pnv8Chip Pnv8Chip ;typedef struct Pnv9Chip Pnv9Chip ;typedef struct Pnv10Chip Pnv10Chip ; +typedef struct Pnv10Chip Pnv11Chip ;#define PNV_CHIP_TYPE_SUFFIX "-" TYPE_PNV_CHIP#define PNV_CHIP_TYPE_NAME (cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX@@ -57,6 +58,10 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER9,DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER10 , TYPE_PNV_CHIP_POWER10) +#define TYPE_PNV_CHIP_POWER11 PNV_CHIP_TYPE_NAME("power11_v2.0") +DECLARE_INSTANCE_CHECKER (PnvChip,PNV_CHIP_POWER11 , + TYPE_PNV_CHIP_POWER11) +PnvCore *pnv_chip_find_core (PnvChip *chip,uint32_t core_id);PowerPCCPU *pnv_chip_find_cpu (PnvChip *chip,uint32_t pir);include/hw/ppc/pnv_chip.h +7
-0@@ -132,6 +132,13 @@ struct Pnv10Chip {#define PNV10_PIR2FUSEDCORE (pir) (((pir) >> 3) & 0xf)#define PNV10_PIR2CHIP (pir) (((pir) >> 8) & 0x7f) +#define TYPE_PNV11_CHIP "pnv11-chip" +DECLARE_INSTANCE_CHECKER (Pnv11Chip,PNV11_CHIP , +TYPE_PNV11_CHIP ) + +/* Power11 core is same as Power10 */ +typedef struct Pnv10Chip Pnv11Chip ; +struct PnvChipClass {/*< private >*/ SysBusDeviceClass parent_class;include/hw/ppc/pnv_core.h +0
-1--- a/include/hw/ppc/pnv_core.h
Quoted 8 lines
include/hw/ppc/pnv_core.h struct PnvQuadClass { · line 78
Quoted 5 lines
+++
b/include/hw/ppc/pnv_core.hinclude/hw/ppc/pnv_core.h +1
-0@@ -76,6 +76,7 @@ struct PnvQuadClass {#define PNV_QUAD_TYPE_SUFFIX "-" TYPE_PNV_QUAD#define PNV_QUAD_TYPE_NAME (cpu_model) cpu_model PNV_QUAD_TYPE_SUFFIX +#define PNV_QUAD_TYPE_NAME_DYN (cpu) g_strconcat(cpu, PNV_QUAD_TYPE_SUFFIX, NULL)This is a leak. Please fix in
pnv_chip_power10_quad_realize()using ag_autofreevariable maybe.
Sure, thanks Cedric.
Will post a v4 soon with this fixed.
Thanks,
Aditya Gupta
Quoted 11 lines
The rest looks good.
Thanks,
C.
Quoted 1 line
include/hw/ppc/pnv_core.h +0
-0OBJECT_DECLARE_TYPE (PnvQuad, PnvQuadClass,PNV_QUAD )
PATCH v3 6/11 ppc/pnv: Add HOMER for POWER11
In reply to Aditya GuptaPower11 core is same as Power10, declare PNV11_HOMER as a child class of PNV10_HOMER, so it goes through same class init
--- hw/ppc/pnv_homer.c | 8 ++++++++ include/hw/ppc/pnv_homer.h | 3 +++ 2 files changed, 11 insertions(+)
hw/ppc/pnv_homer.c +8 -0
@@ -394,6 +394,13 @@ static const TypeInfo pnv_homer_power10_type_info = { .parent = TYPE_PNV_HOMER, .instance_size = sizeof(PnvHomer), .class_init = pnv_homer_power10_class_init, + .class_base_init = pnv_homer_power10_class_init, +}; + +static const TypeInfo pnv_homer_power11_type_info = { + .name =TYPE_PNV11_HOMER , + .parent =TYPE_PNV10_HOMER , + .instance_size =sizeof (PnvHomer), };static void pnv_homer_realize (DeviceState *dev,Error **errp)
@@ -442,6 +449,7 @@ static void pnv_homer_register_types(void)type_register_static (&pnv_homer_power8_type_info);type_register_static (&pnv_homer_power9_type_info);type_register_static (&pnv_homer_power10_type_info); +type_register_static (&pnv_homer_power11_type_info); }type_init (pnv_homer_register_types);
include/hw/ppc/pnv_homer.h +3 -0
@@ -35,6 +35,9 @@ DECLARE_INSTANCE_CHECKER(PnvHomer, PNV9_HOMER,#define TYPE_PNV10_HOMER TYPE_PNV_HOMER "-POWER10"DECLARE_INSTANCE_CHECKER (PnvHomer,PNV10_HOMER , TYPE_PNV10_HOMER) +#define TYPE_PNV11_HOMER TYPE_PNV_HOMER "-POWER11" +DECLARE_INSTANCE_CHECKER (PnvHomer,PNV11_HOMER , + TYPE_PNV11_HOMER)struct PnvHomer {DeviceState parent;
Signature · 1 line
2.45.1
PATCH v3 7/11 ppc/pnv: Add a LPC controller for POWER11
In reply to Aditya GuptaPower11 core is same as Power10 core, declare PNV11_LPC as a child class of PNV10_LPC, so it goes through same class init
--- hw/ppc/pnv_lpc.c | 14 ++++++++++++++ include/hw/ppc/pnv_lpc.h | 4 ++++ 2 files changed, 18 insertions(+)
hw/ppc/pnv_lpc.c +14 -0
@@ -698,6 +698,19 @@ static const TypeInfo pnv_lpc_power10_info = { .class_init = pnv_lpc_power10_class_init, }; +static void pnv_lpc_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="PowerNV LPC Controller POWER11" ; +} + +static const TypeInfo pnv_lpc_power11_info = { + .name =TYPE_PNV11_LPC , + .parent =TYPE_PNV10_LPC , + .class_init = pnv_lpc_power11_class_init, +}; +static void pnv_lpc_realize (DeviceState *dev,Error **errp) {PnvLpcController *lpc =PNV_LPC (dev);
@@ -771,6 +784,7 @@ static void pnv_lpc_register_types(void)type_register_static (&pnv_lpc_power8_info);type_register_static (&pnv_lpc_power9_info);type_register_static (&pnv_lpc_power10_info); +type_register_static (&pnv_lpc_power11_info); }type_init (pnv_lpc_register_types)
include/hw/ppc/pnv_lpc.h +4 -0
@@ -41,6 +41,10 @@ DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV9_LPC,DECLARE_INSTANCE_CHECKER (PnvLpcController,PNV10_LPC , TYPE_PNV10_LPC) +#define TYPE_PNV11_LPC TYPE_PNV_LPC "-POWER11" +DECLARE_INSTANCE_CHECKER (PnvLpcController,PNV11_LPC , + TYPE_PNV11_LPC) +struct PnvLpcController {DeviceState parent;
Signature · 1 line
2.45.1
PATCH v3 8/11 ppc/pnv: Add OCC for Power11
In reply to Aditya GuptaPower11 core is same as Power10, reuse PNV10_OCC initialisation, by declaring PNV11_OCC as child class of PNV10_OCC
--- hw/ppc/pnv_occ.c | 14 ++++++++++++++ include/hw/ppc/pnv_occ.h | 2 ++ 2 files changed, 16 insertions(+)
hw/ppc/pnv_occ.c +14 -0
@@ -262,6 +262,19 @@ static const TypeInfo pnv_occ_power10_type_info = { .class_init = pnv_occ_power10_class_init, }; +static void pnv_occ_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="PowerNV OCC Controller (POWER11)" ; +} + +static const TypeInfo pnv_occ_power11_type_info = { + .name =TYPE_PNV11_OCC , + .parent =TYPE_PNV10_OCC , + .class_init = pnv_occ_power11_class_init, +}; +static void pnv_occ_realize (DeviceState *dev,Error **errp) {PnvOCC *occ =PNV_OCC (dev);
@@ -305,6 +318,7 @@ static void pnv_occ_register_types(void)type_register_static (&pnv_occ_power8_type_info);type_register_static (&pnv_occ_power9_type_info);type_register_static (&pnv_occ_power10_type_info); +type_register_static (&pnv_occ_power11_type_info); }type_init (pnv_occ_register_types);
include/hw/ppc/pnv_occ.h +2 -0
@@ -34,6 +34,8 @@ DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC, TYPE_PNV9_OCC) #define TYPE_PNV10_OCC TYPE_PNV_OCC "-POWER10" DECLARE_INSTANCE_CHECKER(PnvOCC, PNV10_OCC, TYPE_PNV10_OCC) +#define TYPE_PNV11_OCC TYPE_PNV_OCC "-POWER11" +DECLARE_INSTANCE_CHECKER(PnvOCC, PNV11_OCC, TYPE_PNV11_OCC)#define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000#define PNV_OCC_SENSOR_DATA_BLOCK_SIZE 0x00025800
Signature · 1 line
2.45.1
PATCH v3 9/11 ppc/pnv: Add a PSI bridge model for Power11
In reply to Aditya GuptaPower11 core is same as Power10, reuse PNV10_PSI initialisation, by declaring 'PNV11_PSI' as child class of 'PNV10_PSI'
--- hw/ppc/pnv_psi.c | 24 ++++++++++++++++++++++++ include/hw/ppc/pnv_psi.h | 2 ++ 2 files changed, 26 insertions(+)
hw/ppc/pnv_psi.c +24 -0
@@ -939,6 +939,29 @@ static const TypeInfo pnv_psi_power10_info = { .name = TYPE_PNV10_PSI, .parent = TYPE_PNV9_PSI, .class_init = pnv_psi_power10_class_init, + .class_base_init = pnv_psi_power10_class_init, +}; + +static void pnv_psi_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +PnvPsiClass *ppc =PNV_PSI_CLASS (klass); +static const char compat[] ="ibm,power11-psihb-x\0ibm,psihb-x" ; + + dc->desc ="PowerNV PSI Controller POWER11" ; + +/* +* ppc->xscom_pbca and ppc->xscom_size will be set up by +* pnv_psi_power10_class_init +*/ + ppc->compat = compat; + ppc->compat_size =sizeof (compat); +} + +static const TypeInfo pnv_psi_power11_info = { + .name =TYPE_PNV11_PSI , + .parent =TYPE_PNV10_PSI , + .class_init = pnv_psi_power11_class_init, };static void pnv_psi_class_init (ObjectClass *klass,void *data)
@@ -973,6 +996,7 @@ static void pnv_psi_register_types(void)type_register_static (&pnv_psi_power8_info);type_register_static (&pnv_psi_power9_info);type_register_static (&pnv_psi_power10_info); +type_register_static (&pnv_psi_power11_info); }type_init (pnv_psi_register_types);
include/hw/ppc/pnv_psi.h +2 -0
@@ -70,6 +70,8 @@ struct Pnv9Psi {#define TYPE_PNV10_PSI TYPE_PNV_PSI "-POWER10" +#define TYPE_PNV11_PSI TYPE_PNV_PSI "-POWER11" +struct PnvPsiClass {SysBusDeviceClass parent_class;
Signature · 1 line
2.45.1
PATCH v3 10/11 ppc/pnv: Add SBE model for Power11
In reply to Aditya GuptaPower11 core is same as Power10, reuse PNV10_SBER initialisation, by declaring PNV11_PSI as child class of PNV10_PSI
--- hw/ppc/pnv_sbe.c | 15 +++++++++++++++ include/hw/ppc/pnv_sbe.h | 2 ++ 2 files changed, 17 insertions(+)
hw/ppc/pnv_sbe.c +15 -0
@@ -366,6 +366,20 @@ static const TypeInfo pnv_sbe_power10_type_info = { .name = TYPE_PNV10_SBE, .parent = TYPE_PNV9_SBE, .class_init = pnv_sbe_power10_class_init, + .class_base_init = pnv_sbe_power10_class_init, +}; + +static void pnv_sbe_power11_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="PowerNV SBE Controller (POWER11)" ; +} + +static const TypeInfo pnv_sbe_power11_type_info = { + .name =TYPE_PNV11_SBE , + .parent =TYPE_PNV10_SBE , + .class_init = pnv_sbe_power11_class_init, };static void pnv_sbe_realize (DeviceState *dev,Error **errp)
@@ -409,6 +423,7 @@ static void pnv_sbe_register_types(void)type_register_static (&pnv_sbe_type_info);type_register_static (&pnv_sbe_power9_type_info);type_register_static (&pnv_sbe_power10_type_info); +type_register_static (&pnv_sbe_power11_type_info); }type_init (pnv_sbe_register_types);
include/hw/ppc/pnv_sbe.h +2 -0
@@ -29,6 +29,8 @@ OBJECT_DECLARE_TYPE(PnvSBE, PnvSBEClass, PNV_SBE) DECLARE_INSTANCE_CHECKER(PnvSBE, PNV9_SBE, TYPE_PNV9_SBE)#define TYPE_PNV10_SBE TYPE_PNV_SBE "-POWER10" DECLARE_INSTANCE_CHECKER(PnvSBE, PNV10_SBE, TYPE_PNV10_SBE) +#define TYPE_PNV11_SBE TYPE_PNV_SBE "-POWER11" +DECLARE_INSTANCE_CHECKER(PnvSBE, PNV11_SBE, TYPE_PNV11_SBE)struct PnvSBE {DeviceState xd;
Signature · 1 line
2.45.1
PATCH v3 11/11 ppc/pnv: Update skiboot.lid to support Power11
In reply to Aditya GuptaSkiboot/OPAL patches are in discussion upstream [1], with corresponding commits in github repository [2].
Update skiboot.lid, with binary built from 'upstream_power11' branch of skiboot repository with Power11 enablement patches [2].
---
This patch can be skipped for now, if need to wait for patches to be merged in open-power/skiboot. Have updated the skiboot.lid to aid in testing this patch series.
---
[1]: https://lists.ozlabs.org/pipermail/skiboot/2024-April/018963.html
[2]: https://github.com/maheshsal/skiboot.
--- pc-bios/skiboot.lid | Bin 2527328 -> 2527328 bytes 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/skiboot.lid binary +0 -0
Signature · 1 line
2.45.1