Skip to contentSkip to conversation

Power11 support for QEMU [PowerNV]

PATCH Superseded Aditya Gupta 3 participants 27 messages Mar 8, 2025 – Mar 25, 2025 PowerPC

v5 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v5 cover Power11 support for QEMU [PowerNV]

Overview
============

Add support for Power11 powernv machine type, to emulate PowerNV VMs running on Power11.

As Power11 core is same as Power10, hence much of the code has been reused from Power10. And Power10 PNV Chip has been declared as parent of Power11 PNV Chip so that any existing/new functionality can also be reused for Power11.

This parent/child hierarchy causes an issue in .instance_init, as parent's instance_init is also called for the child object. Skip initialising child objects in P10's instance init if we have a P11 chip, this prevents initialising same objects twice by p10 and p11 instance inits.

Power11 PSeries already added in QEMU in:
commit 273db89bcaf4 ("ppc/pseries: Add Power11 cpu type")

Git Tree for Testing
====================

QEMU: https://github.com/adi-g15-ibm/qemu/tree/p11-powernv-v5

Has been tested with following cases:
* '-M powernv' / '-M powernv10' / '-M powernv11'
* '-smp' option tested

skiboot with Power11 support: https://github.com/open-power/skiboot, since commit 785a5e3

Linux with Power11 support: https://github.com/torvalds/linux, since v6.9-rc1

Note: Functional test not added now, will add as soon as op-build releases new kernel image with Power11 support

Changelog
=========
v5:
+ add chiptod
+ add instance_init for P11 to use P11 models
+ move patch introducing Pnv11Chip to the last
+ update skiboot.lid to skiboot's upstream/master

v4:
+ patch #5: fix memory leak in pnv_chip_power10_quad_realize
- no change in other patches

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 (8):
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: Add ChipTOD model for Power11 ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine ppc/pnv: Update skiboot to support Power11

 docs/system/ppc/powernv.rst            |   9 +-
 hw/ppc/pnv.c                           | 177 ++++++++++++++++++++++++-
 hw/ppc/pnv_chiptod.c                   |  37 ++++++
 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 +++
 include/hw/ppc/pnv.h                   |   5 +
 include/hw/ppc/pnv_chip.h              |   7 +
 include/hw/ppc/pnv_chiptod.h           |   2 +
 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 -> 2527424 bytes
 19 files changed, 321 insertions(+), 10 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH v5 1/8 ppc/pnv: Add HOMER for POWER11

Power11 core is same as Power10, declare PNV11_HOMER as a child class of PNV10_HOMER, so it goes through same class init

Cc 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]>
---
 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
index a1d83c8149d3..f314e823f11a 100644
@@ -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)
@@ -441,6 +448,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
index b1c5d498dc55..8f1cc8135937 100644
@@ -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.48.1
#2 lore raw

PATCH v5 2/8 ppc/pnv: Add a LPC controller for POWER11

In reply to Aditya Gupta

Power11 core is same as Power10 core, declare PNV11_LPC as a child class of PNV10_LPC, so it goes through same class init

Cc 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]>
---
 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
index 0480a60f3f79..1623785b8be9 100644
@@ -779,6 +779,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);
@@ -857,6 +870,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
index 174add4c53be..c3f621fe8ce1 100644
@@ -42,6 +42,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.48.1
#3 lore raw

PATCH v5 3/8 ppc/pnv: Add OCC for Power11

In reply to Aditya Gupta

Power11 core is same as Power10, reuse PNV10_OCC initialisation, by declaring PNV11_OCC as child class of PNV10_OCC

Cc 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]>
---
 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
index 48123ceae176..4f510419045e 100644
@@ -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
index df321244e3b1..7b5e28f13b4f 100644
@@ -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.48.1
#4 lore raw

PATCH v5 4/8 ppc/pnv: Add a PSI bridge model for Power11

In reply to Aditya Gupta

Power11 core is same as Power10, reuse PNV10_PSI initialisation, by declaring 'PNV11_PSI' as child class of 'PNV10_PSI'

Cc 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]>
---
 hw/ppc/pnv_psi.c         | 24 ++++++++++++++++++++++++
 include/hw/ppc/pnv_psi.h |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)
hw/ppc/pnv_psi.c +24 -0
index 1fe11dde501b..d2bc2bdd2c8b 100644
@@ -937,6 +937,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)
@@ -971,6 +994,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 +1 -1
index cf7f95a6b1f5..1182ed47d280 100644
@@ -69,7 +69,7 @@ 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.48.1
#5 lore raw

PATCH v5 5/8 ppc/pnv: Add SBE model for Power11

In reply to Aditya Gupta

Power11 core is same as Power10, reuse PNV10_SBE initialisation, by declaring PNV11_SBE as child class of PNV10_SBE

Cc 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]>
---
 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
index 74cee4eea7ad..a655cc7f8c9e 100644
@@ -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
index b6b378ad14c7..09073a1256d6 100644
@@ -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.48.1
#6 lore raw

PATCH v5 6/8 ppc/pnv: Add ChipTOD model for Power11

In reply to Aditya Gupta

Power11 core is same as Power10. Introduce Power11 ChipTod, which relies on the common PnvChipTOD, similar to Power10's ChipTOD.

Cc 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]>
---
 hw/ppc/pnv_chiptod.c         | 37 ++++++++++++++++++++++++++++++++++++
 include/hw/ppc/pnv_chiptod.h |  2 ++
 2 files changed, 39 insertions(+)
hw/ppc/pnv_chiptod.c +37 -0
index c8987ae67a2a..b5e1a2c24647 100644
@@ -520,6 +520,42 @@ static const TypeInfo pnv_chiptod_power10_type_info = {
     }
 };
 
+static int pnv_chiptod_power11_dt_xscom(PnvXScomInterface *dev, void *fdt,
+                             int xscom_offset)
+{
+    const char compat[] = "ibm,power-chiptod\0ibm,power11-chiptod";
+
+    return pnv_chiptod_dt_xscom(dev, fdt, xscom_offset, compat, sizeof(compat));
+}
+
+static void pnv_chiptod_power11_class_init(ObjectClass *klass, void *data)
+{
+    PnvChipTODClass *pctc = PNV_CHIPTOD_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PnvXScomInterfaceClass *xdc = PNV_XSCOM_INTERFACE_CLASS(klass);
+
+    dc->desc = "PowerNV ChipTOD Controller (POWER11)";
+    device_class_set_props(dc, pnv_chiptod_properties);
+
+    xdc->dt_xscom = pnv_chiptod_power11_dt_xscom;
+
+    pctc->broadcast_ttype = chiptod_power10_broadcast_ttype;
+    pctc->tx_ttype_target = chiptod_power10_tx_ttype_target;
+
+    pctc->xscom_size = PNV_XSCOM_CHIPTOD_SIZE;
+}
+
+static const TypeInfo pnv_chiptod_power11_type_info = {
+    .name          = TYPE_PNV11_CHIPTOD,
+    .parent        = TYPE_PNV_CHIPTOD,
+    .instance_size = sizeof(PnvChipTOD),
+    .class_init    = pnv_chiptod_power11_class_init,
+    .interfaces    = (InterfaceInfo[]) {
+        { TYPE_PNV_XSCOM_INTERFACE },
+        { }
+    }
+};
+
 static void pnv_chiptod_reset(void *dev)
 {
     PnvChipTOD *chiptod = PNV_CHIPTOD(dev);
@@ -579,6 +615,7 @@ static void pnv_chiptod_register_types(void)
     type_register_static(&pnv_chiptod_type_info);
     type_register_static(&pnv_chiptod_power9_type_info);
     type_register_static(&pnv_chiptod_power10_type_info);
+    type_register_static(&pnv_chiptod_power11_type_info);
 }
 
 type_init(pnv_chiptod_register_types);
include/hw/ppc/pnv_chiptod.h +2 -0
index fde569bcbfa9..466b06560a28 100644
@@ -17,6 +17,8 @@ OBJECT_DECLARE_TYPE(PnvChipTOD, PnvChipTODClass, PNV_CHIPTOD)
 DECLARE_INSTANCE_CHECKER(PnvChipTOD, PNV9_CHIPTOD, TYPE_PNV9_CHIPTOD)
 #define TYPE_PNV10_CHIPTOD TYPE_PNV_CHIPTOD "-POWER10"
 DECLARE_INSTANCE_CHECKER(PnvChipTOD, PNV10_CHIPTOD, TYPE_PNV10_CHIPTOD)
+#define TYPE_PNV11_CHIPTOD TYPE_PNV_CHIPTOD "-POWER11"
+DECLARE_INSTANCE_CHECKER(PnvChipTOD, PNV11_CHIPTOD, TYPE_PNV11_CHIPTOD)
 
 enum tod_state {
     tod_error = 0,
Signature · 1 line
2.48.1
#7 lore raw

PATCH v5 7/8 ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

In reply to Aditya Gupta

Power11 core is same as Power10. Introduce a Power11 chip and machine, with Power10 chip as parent of Power11 chip.

Due to Power10 chip being declared as Power11 chip, all functions can cast 'Pnv11Chip' as 'Pnv10Chip' thus allowing it to reuse Power10's functionality, such as in PHB. Homer code

PowerNV11 declares a separate class_init and instance_init to be able to declare correct CFAM, and initialise Power11 specific child objects such as Homer, OCC etc. Other functionalities will use the Power10's codepath in Power11 for most cases.

Cc 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]>
---
 docs/system/ppc/powernv.rst |   9 +-
 hw/ppc/pnv.c                | 177 +++++++++++++++++++++++++++++++++++-
 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, 201 insertions(+), 9 deletions(-)
docs/system/ppc/powernv.rst +5 -4
index de7a807ac762..366da9bc371c 100644
@@ -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 +172 -5

273 lines not on this page · raw message

hw/ppc/pnv_core.c +11 -0
index 99d9644ee38e..12916b15aa3b 100644
@@ -469,6 +469,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);
@@ -500,6 +505,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)
@@ -748,6 +754,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
index fcb6699150c8..ac960aa0fda9 100644
@@ -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
index 24ce37a9c8e4..6bd930f8b439 100644
@@ -141,6 +141,13 @@ struct Pnv10Chip {
 #define PNV10_PIR2CHIP(pir)      (((pir) >> 8) & 0x7f)
 #define PNV10_PIR2THREAD(pir)    (((pir) & 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
index d8afb4f95f92..febe940a9af5 100644
@@ -104,6 +104,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.48.1
#8 lore raw

Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

Quoted 18 lines · Aditya Gupta

Power11 core is same as Power10. Introduce a Power11 chip and machine, with Power10 chip as parent of Power11 chip.

Due to Power10 chip being declared as Power11 chip, all functions can cast 'Pnv11Chip' as 'Pnv10Chip' thus allowing it to reuse Power10's functionality, such as in PHB. Homer code

PowerNV11 declares a separate class_init and instance_init to be able to declare correct CFAM, and initialise Power11 specific child objects such as Homer, OCC etc. Other functionalities will use the Power10's codepath in Power11 for most cases.

Cc 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]>
Quoted 4 lines
---
  docs/system/ppc/powernv.rst |   9 +-
  hw/ppc/pnv.c                | 177 +++++++++++++++++++++++++++++++++++-
  hw/ppc/pnv_core.c           |  11 +++

I would introduce the pnv_core changes in their own patch.

Quoted 95 lines
  include/hw/ppc/pnv.h        |   5 +
  include/hw/ppc/pnv_chip.h   |   7 ++
  include/hw/ppc/pnv_core.h   |   1 +
  6 files changed, 201 insertions(+), 9 deletions(-)
docs/system/ppc/powernv.rst +5 -4
index de7a807ac762..366da9bc371c 100644
@@ -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 +34 -0
index 87607508c768..1c4dc4ed1764 100644
@@ -22,6 +22,7 @@
  #include "qemu/units.h"
  #include "qemu/cutils.h"
  #include "qapi/error.h"
+#include "qom/object.h"
  #include "system/qtest.h"
  #include "system/system.h"
  #include "system/numa.h"
@@ -486,6 +487,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;
@@ -1435,6 +1463,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);
@@ -1966,6 +1996,20 @@ static void pnv_chip_power10_instance_init(Object *obj)
      PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
      int i;
 
+    /*
+     * Power11 declares Power10 as it's parent class, to be able to reuse
+     * most of the Power10 code.
+     * But this causes Power10 and Power11's both instance init to be

hw/ppc/pnv.c static void pnv_chip_power10_instance_init(Object *obj) · line 2012

Quoted 10 lines
hw/ppc/pnv.c +10 -0
+     * called for PowerNV11 chip
+     *
+     * Skip initialising Power10 specific child objects, if the chip is
+     * Power11 chip, in which case power11's instance init will initialise
+     * the child objects
+     */
+    if (!strcmp(object_get_typename(obj), TYPE_PNV_CHIP_POWER11)) {
+        return;
+    }
+

This is a hack ! Please duplicate the code like done for other chips.

hw/ppc/pnv.c static void pnv_chip_power10_instance_init(Object *obj) · line 2045

Quoted 10 lines
hw/ppc/pnv.c +2 -1
      object_initialize_child(obj, "adu",  &chip10->adu, TYPE_PNV_ADU);
      object_initialize_child(obj, "xive", &chip10->xive, TYPE_PNV_XIVE2);
      object_property_add_alias(obj, "xive-fabric", OBJECT(&chip10->xive),
@@ -1997,7 +2041,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)

this belongs to another patch modifying P10 first.

Quoted 16 lines
hw/ppc/pnv.c +2 -1
  {
      PnvChip *chip = PNV_CHIP(chip10);
      int i;
@@ -2007,9 +2052,10 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
 
      for (i = 0; i < chip10->nr_quads; i++) {
          PnvQuad *eq = &chip10->quads[i];
+        g_autofree char *type_name = PNV_QUAD_TYPE_NAME_DYN(cpu_model);
 
          pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
-                                  PNV_QUAD_TYPE_NAME("power10"));
+                                  type_name);
 
          pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                  &eq->xscom_regs);

hw/ppc/pnv.c static void pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp) · line 2097

Quoted 6 lines
hw/ppc/pnv.c +2 -1
@@ -2047,7 +2093,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)

this belongs to another patch modifying P10 first.

Quoted 103 lines
hw/ppc/pnv.c +77 -1
  {
      PnvChipClass *pcc = PNV_CHIP_GET_CLASS(dev);
      PnvChip *chip = PNV_CHIP(dev);
@@ -2073,7 +2120,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)
      pnv_xscom_add_subregion(chip, PNV10_XSCOM_ADU_BASE,
                              &chip10->adu.xscom_regs);
 
-    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;
@@ -2235,6 +2282,54 @@ 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_instance_init(Object *obj)
+{
+    PnvChip *chip = PNV_CHIP(obj);
+    Pnv11Chip *chip11 = PNV11_CHIP(obj);
+    PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
+    int i;
+
+    object_initialize_child(obj, "adu",  &chip11->adu, TYPE_PNV_ADU);
+    object_initialize_child(obj, "xive", &chip11->xive, TYPE_PNV_XIVE2);
+    object_property_add_alias(obj, "xive-fabric", OBJECT(&chip11->xive),
+                              "xive-fabric");
+    object_initialize_child(obj, "psi", &chip11->psi, TYPE_PNV11_PSI);
+    object_initialize_child(obj, "lpc", &chip11->lpc, TYPE_PNV11_LPC);
+    object_initialize_child(obj, "chiptod", &chip11->chiptod,
+                            TYPE_PNV11_CHIPTOD);
+    object_initialize_child(obj, "occ",  &chip11->occ, TYPE_PNV11_OCC);
+    object_initialize_child(obj, "sbe",  &chip11->sbe, TYPE_PNV11_SBE);
+    object_initialize_child(obj, "homer", &chip11->homer, TYPE_PNV11_HOMER);
+    object_initialize_child(obj, "n1-chiplet", &chip11->n1_chiplet,
+                            TYPE_PNV_N1_CHIPLET);
+
+    chip->num_pecs = pcc->num_pecs;
+
+    for (i = 0; i < chip->num_pecs; i++) {
+        object_initialize_child(obj, "pec[*]", &chip11->pecs[i],
+                                TYPE_PNV_PHB5_PEC);
+    }
+
+    for (i = 0; i < pcc->i2c_num_engines; i++) {
+        object_initialize_child(obj, "i2c[*]", &chip11->i2c[i], TYPE_PNV_I2C);
+    }
+
+    for (i = 0; i < PNV10_CHIP_MAX_PIB_SPIC; i++) {
+        object_initialize_child(obj, "pib_spic[*]", &chip11->pib_spic[i],
+                                TYPE_PNV_SPI);
+    }
+}
+
+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;
@@ -2300,6 +2395,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->get_pir_tir = pnv_get_pir_tir_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(PnvMachineState *pnv, PnvChip *chip,
                                     Error **errp)
  {

hw/ppc/pnv.c static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data) · line 2760

Quoted 4 lines
hw/ppc/pnv.c +0 -1
@@ -2757,7 +2880,6 @@ static void pnv_machine_p10_common_class_init(ObjectClass *oc, void *data)
          { TYPE_PNV_PHB_ROOT_PORT, "version", "5" },
      };
 
-    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

This belongs to another patch.

hw/ppc/pnv.c static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) · line 2905

Quoted 8 lines
hw/ppc/pnv.c +1 -0
      compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
 
      mc->alias = "powernv";
@@ -2780,6 +2902,7 @@ static void pnv_machine_power10_class_init(ObjectClass *oc, void *data)
 
      pnv_machine_p10_common_class_init(oc, data);
      mc->desc = "IBM PowerNV (Non-Virtualized) POWER10";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

ditto

hw/ppc/pnv.c static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) · line 2932

Quoted 8 lines
hw/ppc/pnv.c +1 -0
      /*
       * This is the parent of POWER10 Rainier class, so properies go here
@@ -2806,9 +2929,26 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data)
 
      pnv_machine_p10_common_class_init(oc, data);
      mc->desc = "IBM PowerNV (Non-Virtualized) POWER10 Rainier";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

ditto

Quoted 47 lines
hw/ppc/pnv.c +32 -0
      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 void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)
  {
      CPUPPCState *env = cpu_env(cs);
@@ -2914,7 +3054,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"),

hw/ppc/pnv.c static const TypeInfo types[] = { · line 3133

Quoted 9 lines
hw/ppc/pnv.c +6 -0
@@ -2969,6 +3125,17 @@ static const TypeInfo types[] = {
          .abstract      = true,
      },
 
+    /*
+     * P11 chip and variants
+     */
+    {
+        .name          = TYPE_PNV11_CHIP,
+        .parent        = TYPE_PNV10_CHIP,

why is the parent not TYPE_PNV_CHIP like the other chips ?

This is a hack which can be easily avoided with more work :)

Quoted 33 lines
hw/ppc/pnv.c +5 -0
+        .instance_init = pnv_chip_power11_instance_init,
+        .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 +6 -0
index 99d9644ee38e..12916b15aa3b 100644
@@ -469,6 +469,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);
@@ -500,6 +505,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)

hw/ppc/pnv_core.c static const TypeInfo pnv_quad_infos[] = { · line 758

Quoted 5 lines
hw/ppc/pnv_core.c +2 -0
@@ -748,6 +754,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"),

why not TYPE_PNV_QUAD ?

Thanks,

C.

Quoted 59 lines
hw/ppc/pnv_core.c +3 -0
+        .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
index fcb6699150c8..ac960aa0fda9 100644
@@ -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
index 24ce37a9c8e4..6bd930f8b439 100644
@@ -141,6 +141,13 @@ struct Pnv10Chip {
  #define PNV10_PIR2CHIP(pir)      (((pir) >> 8) & 0x7f)
  #define PNV10_PIR2THREAD(pir)    (((pir) & 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
index d8afb4f95f92..febe940a9af5 100644
@@ -104,6 +104,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)
 
#9 lore raw

Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

Hi Cédric,

Thanks for the reviews.

Quoted 9 lines · Cédric Le Goater
Quoted 6 lines · Aditya Gupta

<...snip...>

  docs/system/ppc/powernv.rst |   9 +-
  hw/ppc/pnv.c                | 177 +++++++++++++++++++++++++++++++++++- hw/ppc/pnv_core.c           |  11 +++

I would introduce the pnv_core changes in their own patch.

Sure, will do that in v6.

Quoted 21 lines
Quoted 21 lines

  include/hw/ppc/pnv.h        |   5 +
  include/hw/ppc/pnv_chip.h   |   7 ++
  include/hw/ppc/pnv_core.h   |   1 +

  6 files changed, 201 insertions(+), 9 deletions(-)
docs/system/ppc/powernv.rst +2 -0
index de7a807ac762..366da9bc371c 100644
 
<...snip...>
 
+    /*
+     * Power11 declares Power10 as it's parent class, to be able to 

reuse
+     * most of the Power10 code.
+     * But this causes Power10 and Power11's both instance init to be +     * called for PowerNV11 chip
+     *
+     * Skip initialising Power10 specific child objects, if the chip is +     * Power11 chip, in which case power11's instance init will initialise

Quoted 9 lines
Quoted 6 lines

+     * the child objects
+     */
+    if (!strcmp(object_get_typename(obj), TYPE_PNV_CHIP_POWER11)) { +        return;
+    }
+

This is a hack !  Please duplicate the code like done for other chips.

Agreed it's hacky. Okay, I will duplicate the code.

Quoted 16 lines

docs/system/ppc/powernv.rst static void · line 2047

Quoted 12 lines

      object_initialize_child(obj, "adu", &chip10->adu, TYPE_PNV_ADU); object_initialize_child(obj, "xive", &chip10->xive, TYPE_PNV_XIVE2); object_property_add_alias(obj, "xive-fabric", OBJECT(&chip10->xive),

docs/system/ppc/powernv.rst +2 -0
@@ -1997,7 +2041,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)

this belongs to another patch modifying P10 first.

Okay, will put changes modifying p10 functions in diff patch.

Quoted 15 lines
Quoted 15 lines
docs/system/ppc/powernv.rst +0 -0
   {

      PnvChip *chip = PNV_CHIP(chip10);
      int i;

docs/system/ppc/powernv.rst +2 -1
@@ -2007,9 +2052,10 @@ static void 
 pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)
         for (i = 0; i < chip10->nr_quads; i++) {
           PnvQuad *eq = &chip10->quads[i];
+        g_autofree char *type_name = PNV_QUAD_TYPE_NAME_DYN(cpu_model);
             pnv_chip_quad_realize_one(chip, eq, chip->cores[i * 4],
- PNV_QUAD_TYPE_NAME("power10"));
+                                  type_name);
             pnv_xscom_add_subregion(chip, PNV10_XSCOM_EQ_BASE(eq->quad_id),
                                   &eq->xscom_regs);
@@ -2047,7 +2093,8 @@ static void 
 pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp)
Quoted 8 lines

docs/system/ppc/powernv.rst static void · line 2099

Quoted 6 lines
docs/system/ppc/powernv.rst +2 -0
       }
   }
   -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)

this belongs to another patch modifying P10 first.

Sure

Quoted 11 lines

docs/system/ppc/powernv.rst static void · line 2883

Quoted 8 lines

  <...snip...>

docs/system/ppc/powernv.rst +0 -0
@@ -2757,7 +2880,6 @@ static void 
 pnv_machine_p10_common_class_init(ObjectClass *oc, void *data)
           { TYPE_PNV_PHB_ROOT_PORT, "version", "5" },
       };
   -    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

This belongs to another patch.

Sure, will move it another patch.

Quoted 9 lines

docs/system/ppc/powernv.rst static void · line 2905

Quoted 7 lines
docs/system/ppc/powernv.rst +1 -0
 compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
         mc->alias = "powernv";
@@ -2780,6 +2902,7 @@ static void 
 pnv_machine_power10_class_init(ObjectClass *oc, void *data)
         pnv_machine_p10_common_class_init(oc, data);
       mc->desc = "IBM PowerNV (Non-Virtualized) POWER10";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

ditto

Sure

Quoted 9 lines

docs/system/ppc/powernv.rst static void · line 2932

Quoted 7 lines
docs/system/ppc/powernv.rst +1 -0
         /*
        * This is the parent of POWER10 Rainier class, so properies go here
@@ -2806,9 +2929,26 @@ static void 
 pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data)
         pnv_machine_p10_common_class_init(oc, data);
       mc->desc = "IBM PowerNV (Non-Virtualized) POWER10 Rainier";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power10_v2.0");

ditto

Okay will move to different patch

Quoted 15 lines

docs/system/ppc/powernv.rst static const TypeInfo types[] = { · line 3132

Quoted 12 lines

<...snip...>

docs/system/ppc/powernv.rst +6 -0
@@ -2969,6 +3125,17 @@ static const TypeInfo types[] = {
           .abstract      = true,
       },
+    /*
+     * P11 chip and variants
+     */
+    {
+        .name          = TYPE_PNV11_CHIP,
+        .parent        = TYPE_PNV10_CHIP,

why is the parent not TYPE_PNV_CHIP like the other chips ?

Quoted 1 line

This is a hack which can be easily avoided with more work :)

I kept it that way so that for most things p11 could simply fall back to p10 functions.

Many of these functions cast the chip object to PNV10_CHIP, and since QEMU allows casting to parent class, I made PNV10_CHIP the parent of PNV11_CHIP.

Duplicating the code, or something allowing this cast the ways I think. Will duplicate.

Quoted 33 lines
Quoted 33 lines
docs/system/ppc/powernv.rst +5 -0
+        .instance_init = pnv_chip_power11_instance_init,
+        .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 +4 -0
index 99d9644ee38e..12916b15aa3b 100644
@@ -469,6 +469,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);

hw/ppc/pnv_core.c +1 -0
@@ -500,6 +505,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)
Quoted 9 lines

hw/ppc/pnv_core.c static const TypeInfo pnv_quad_infos[] = { · line 758

Quoted 6 lines
hw/ppc/pnv_core.c +2 -0
@@ -748,6 +754,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"),

why not TYPE_PNV_QUAD ?

I wanted it to use Power10 quad's '_class_init' & '_realize'. Will make it's parent PNV_QUAD, and create separate class_init and realize for Power11 then.

Thanks,

- Aditya Gupta

Quoted 5 lines

Thanks,

C.

#10 lore raw

Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

In reply to Cédric Le Goater

Hi Cedric,

Quoted 39 lines · Cédric Le Goater
Quoted 17 lines · Aditya Gupta

<...snip...>

  static void pnv_chip_power8_instance_init(Object *obj) {
      Pnv8Chip *chip8 = PNV8_CHIP(obj);

hw/ppc/pnv.c +0 -0
@@ -1966,6 +1996,20 @@ static void 
 pnv_chip_power10_instance_init(Object *obj)
       PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
       int i;

  +    /*
+     * Power11 declares Power10 as it's parent class, to be able to reuse
+     * most of the Power10 code.
+     * But this causes Power10 and Power11's both instance init to be +     * called for PowerNV11 chip
+     *
+     * Skip initialising Power10 specific child objects, if the chip is

Quoted 8 lines

+     * Power11 chip, in which case power11's instance init will initialise
+     * the child objects
+     */
+    if (!strcmp(object_get_typename(obj), TYPE_PNV_CHIP_POWER11)) { +        return;
+    }
+

This is a hack !  Please duplicate the code like done for other chips.

Quoted 8 lines

<...snip...>

  +    /*
+     * P11 chip and variants
+     */
+    {
+        .name          = TYPE_PNV11_CHIP,
+        .parent        = TYPE_PNV10_CHIP,

Quoted 3 lines

why is the parent not TYPE_PNV_CHIP like the other chips ?

This is a hack which can be easily avoided with more work :)

When I do this, every function using Pnv10Chip* will need to be duplicated to use Pnv11Chip*.

I will do that.

But what do you say about changing Pnv10 chip to Pnv1x chip ? It may only be used by Pnv10 and Pnv11, not future chips. But is that unnecessary for just two versions of the chip ?

Just tried to think of some ways to reduce duplication, or having different files such as pnv10.c, pnv11.c ? I am not sure because these might be unnecessary things too.

Thanks,

- Aditya G

#11 lore raw

Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

Quoted 44 lines · Aditya Gupta

Hi Cedric,

Quoted 36 lines · Cédric Le Goater
Quoted 14 lines · Aditya Gupta

<...snip...>

  static void pnv_chip_power8_instance_init(Object *obj) {
      Pnv8Chip *chip8 = PNV8_CHIP(obj);

hw/ppc/pnv.c +0 -0
@@ -1966,6 +1996,20 @@ static void pnv_chip_power10_instance_init(Object *obj)
       PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
       int i;

  +    /*
+     * Power11 declares Power10 as it's parent class, to be able to reuse +     * most of the Power10 code.
+     * But this causes Power10 and Power11's both instance init to be +     * called for PowerNV11 chip
+     *

Quoted 8 lines

+     * Skip initialising Power10 specific child objects, if the chip is +     * Power11 chip, in which case power11's instance init will initialise +     * the child objects
+     */
+    if (!strcmp(object_get_typename(obj), TYPE_PNV_CHIP_POWER11)) { +        return;
+    }
+

This is a hack !  Please duplicate the code like done for other chips.

Quoted 8 lines

<...snip...>

  +    /*
+     * P11 chip and variants
+     */
+    {
+        .name          = TYPE_PNV11_CHIP,
+        .parent        = TYPE_PNV10_CHIP,

Quoted 3 lines

why is the parent not TYPE_PNV_CHIP like the other chips ?

This is a hack which can be easily avoided with more work :)

Quoted 7 lines

When I do this, every function using Pnv10Chip* will need to be duplicated to use Pnv11Chip*.

I will do that.

But what do you say about changing Pnv10 chip to Pnv1x chip ? It may only be used by Pnv10 and Pnv11, not future chips. But is that unnecessary for just two versions of the chip ?

Just tried to think of some ways to reduce duplication, or having different files such as pnv10.c, pnv11.c ? I am not sure because these might be unnecessary things too.

Please open code (and duplicate) first. Then we will see how we can make things common. Checking the typename in the instance_init handleris a hack not for upstream.

Thanks,

C.

#12 lore raw

Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine

Quoted 9 lines · Cédric Le Goater
Quoted 8 lines · Aditya Gupta

Hi Cedric,

<...snip...>

When I do this, every function using Pnv10Chip* will need to be duplicated to use Pnv11Chip*.

I will do that.

Quoted 7 lines
Quoted 3 lines

But what do you say about changing Pnv10 chip to Pnv1x chip ? It may only be used by Pnv10 and Pnv11, not future chips. But is that unnecessary for just two versions of the chip ?

Just tried to think of some ways to reduce duplication, or having different files such as pnv10.c, pnv11.c ? I am not sure because these might be unnecessary things too.

Please open code (and duplicate) first. Then we will see how we can make things common. Checking the typename in the instance_init handleris a hack not for upstream.

Sure Cedric, will duplicate it then.

Thanks,

- Aditya Gupta

Quoted 6 lines

Thanks,

C.

#13 lore raw

PATCH v5 8/8 ppc/pnv: Update skiboot to support Power11

In reply to Aditya Gupta

Update skiboot.lid to below commit which adds support for booting on Power11:

commit 785a5e3070a8 ("platform: Identify correct bmc platform based on bmc hw version")

Built with glibc 2.40 and gcc 14.2 (Fedora 41)

---
Should the roms/skiboot submodule also be updated ?

I see it has generally been updated on skiboot releases with versions, eg. 7.1, 7.0. No newer version available for upstream/master.
---

---
 pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/skiboot.lid binary +0 -0
index 906bd5127175d4f9fa8a1e160f7a648902bdedd4..9a9cdbdeb13cab1c362a3a386cf11ed5fe5d0db9 100644
GIT binary patch
Signature · 1 line
2.48.1
#14 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 11 lines · Aditya Gupta

Update skiboot.lid to below commit which adds support for booting on Power11:

commit 785a5e3070a8 ("platform: Identify correct bmc platform based on bmc hw version")

Built with glibc 2.40 and gcc 14.2 (Fedora 41)

---
Should the roms/skiboot submodule also be updated ?

Quoted 6 lines

I see it has generally been updated on skiboot releases with versions, eg. 7.1, 7.0. No newer version available for upstream/master.
---

---
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes
  1 file changed, 0 insertions(+), 0 deletions(-)

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Thanks,

C.

#15 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 19 lines · Cédric Le Goater
Quoted 11 lines · Aditya Gupta

Update skiboot.lid to below commit which adds support for booting on Power11:

     commit 785a5e3070a8 ("platform: Identify correct bmc platform based on bmc hw version")

Built with glibc 2.40 and gcc 14.2 (Fedora 41)

---
Should the roms/skiboot submodule also be updated ?

Quoted 6 lines

I see it has generally been updated on skiboot releases with versions, eg. 7.1, 7.0. No newer version available for upstream/master.
---
---
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes

  1 file changed, 0 insertions(+), 0 deletions(-)
Quoted 3 lines

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

Will skip sending this in v6.

Thanks,

- Aditya Gupta

Quoted 6 lines

Thanks,

C.

#16 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 21 lines · Aditya Gupta
Quoted 19 lines · Cédric Le Goater
Quoted 17 lines · Aditya Gupta

Update skiboot.lid to below commit which adds support for booting on Power11:

     commit 785a5e3070a8 ("platform: Identify correct bmc platform based on bmc hw version")

Built with glibc 2.40 and gcc 14.2 (Fedora 41)

---
Should the roms/skiboot submodule also be updated ?

I see it has generally been updated on skiboot releases with versions, eg. 7.1, 7.0. No newer version available for upstream/master.
---
---
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes

  1 file changed, 0 insertions(+), 0 deletions(-)
Quoted 4 lines
Quoted 3 lines

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see :

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

To be sent before v6.

Thanks,

C.

#17 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 5 lines · Cédric Le Goater
Quoted 4 lines · Aditya Gupta
Quoted 4 lines
Quoted 3 lines

<...snip...>
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes

  1 file changed, 0 insertions(+), 0 deletions(-)
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see  :

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

Thanks for the example Cédric. Now I see.

Quoted 1 line

To be sent before v6.

Sure, will wait for the maintainer to send it first before v6.

Thanks,

- Aditya Gupta

Quoted 6 lines

Thanks,

C.

#18 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 13 lines · Aditya Gupta
Quoted 12 lines · Cédric Le Goater
Quoted 8 lines · Aditya Gupta
Quoted 7 lines
Quoted 3 lines

<...snip...>
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes

  1 file changed, 0 insertions(+), 0 deletions(-)

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see  :

Quoted 8 lines
Quoted 2 lines

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

Thanks for the example Cédric. Now I see.

Quoted 1 line

To be sent before v6.

Sure, will wait for the maintainer to send it first before v6.

AFAICT, this person would be you or Nick, or one OPAL team member ?

Thanks,

C.

#19 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

Quoted 16 lines · Cédric Le Goater
Quoted 15 lines · Aditya Gupta
Quoted 14 lines · Cédric Le Goater
Quoted 8 lines · Aditya Gupta
Quoted 7 lines
Quoted 3 lines

<...snip...>
  pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes

  1 file changed, 0 insertions(+), 0 deletions(-)

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see  :

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

Quoted 8 lines
Quoted 6 lines

Thanks for the example Cédric. Now I see.

Quoted 1 line

To be sent before v6.

Sure, will wait for the maintainer to send it first before v6.

AFAICT, this person would be you or Nick, or one OPAL team member ?

Yes, I kind of butchered the skiboot PR message but no matter. I was planning to update skiboot bios because it contains HOMER/OCC fixes we need to test the QEMU updates to those models.

Power11 support is nice too, unfortunately I will skip the P11 patches for now. They will need some updates after the HOMER/OCC changes but that shouldn't be too hard I can help with it if needed. I will try to get your P11 in asap next time.

Thanks,
Nick

#20 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

+ Reza

Quoted 26 lines · Nicholas Piggin
Quoted 16 lines · Cédric Le Goater
Quoted 15 lines · Aditya Gupta
Quoted 14 lines · Cédric Le Goater
Quoted 8 lines · Aditya Gupta
Quoted 7 lines
Quoted 3 lines

<...snip...>

   pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes
   1 file changed, 0 insertions(+), 0 deletions(-)

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see  :

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

Quoted 8 lines
Quoted 6 lines

Thanks for the example Cédric. Now I see.

Quoted 1 line

To be sent before v6.

Sure, will wait for the maintainer to send it first before v6.

AFAICT, this person would be you or Nick, or one OPAL team member ?

Quoted 8 lines

Yes, I kind of butchered the skiboot PR message but no matter. I was planning to update skiboot bios because it contains HOMER/OCC fixes we need to test the QEMU updates to those models.

Power11 support is nice too, unfortunately I will skip the P11 patches for now. They will need some updates after the HOMER/OCC changes but that shouldn't be too hard I can help with it if needed. I will try to get your P11 in asap next time.

Tagging OPAL with P11 support would be nice too.

Thanks,

C.

#21 lore raw

Re: [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11

In reply to Nicholas Piggin
Quoted 21 lines · Nicholas Piggin
Quoted 12 lines · Cédric Le Goater
Quoted 11 lines · Aditya Gupta
Quoted 10 lines · Cédric Le Goater
Quoted 7 lines · Aditya Gupta
Quoted 6 lines
Quoted 3 lines

<...snip...>

   pc-bios/skiboot.lid | Bin 2527328 -> 2527424 bytes
   1 file changed, 0 insertions(+), 0 deletions(-)

This change should come first as a sub maintainer PR, to avoid sending 2.5MB on the mailing list :/ See how SLOF is handled.

Sorry didn't know this. I just checked the git log of skiboot.lid and thought maybe it's this same way of sending patches.

For example, see  :

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

https://lore.kernel.org/qemu-devel/CACPK8XfoKNxr6_KkDFFZm0P5w9m_ddD5E4SeuAkypXXr7swR7A@mail.gmail.com/

Thanks for the example Cédric. Now I see.

Quoted 1 line

To be sent before v6.

Sure, will wait for the maintainer to send it first before v6.

AFAICT, this person would be you or Nick, or one OPAL team member ?

Quoted 8 lines

Yes, I kind of butchered the skiboot PR message but no matter. I was planning to update skiboot bios because it contains HOMER/OCC fixes we need to test the QEMU updates to those models.

Power11 support is nice too, unfortunately I will skip the P11 patches for now. They will need some updates after the HOMER/OCC changes but that shouldn't be too hard I can help with it if needed. I will try to get your P11 in asap next time.

Okay. I will push the next patches after the skiboot and homer updates then.

Thanks Nick.

Quoted 4 lines

Thanks,
Nick

#22 lore raw
In reply to Aditya Gupta

Hello Aditya,

Quoted 5 lines · Aditya Gupta

Overview
============

Add support for Power11 powernv machine type, to emulate PowerNV VMs running on Power11.

Could you please consider deprecating the POWER8NVL and POWER8E CPUs and associated chips and machines ? I think keeping POWER8 is fine since it has different HW implementation from the following generations. However, the POWER8NVL and POWER8E variants don't add much to QEMU. They were practical at one point for bringup (2014). They are not anymore.

This will remove some lpc peculiarities.

Thanks,

C.

Quoted 91 lines

As Power11 core is same as Power10, hence much of the code has been reused from Power10. And Power10 PNV Chip has been declared as parent of Power11 PNV Chip so that any existing/new functionality can also be reused for Power11.

This parent/child hierarchy causes an issue in .instance_init, as parent's instance_init is also called for the child object. Skip initialising child objects in P10's instance init if we have a P11 chip, this prevents initialising same objects twice by p10 and p11 instance inits.

Power11 PSeries already added in QEMU in:
commit 273db89bcaf4 ("ppc/pseries: Add Power11 cpu type")

Git Tree for Testing
====================

QEMU: https://github.com/adi-g15-ibm/qemu/tree/p11-powernv-v5

Has been tested with following cases:
* '-M powernv' / '-M powernv10' / '-M powernv11'
* '-smp' option tested

skiboot with Power11 support: https://github.com/open-power/skiboot, since commit 785a5e3

Linux with Power11 support: https://github.com/torvalds/linux, since v6.9-rc1

Note: Functional test not added now, will add as soon as op-build releases new kernel image with Power11 support

Changelog
=========
v5:
+ add chiptod
+ add instance_init for P11 to use P11 models
+ move patch introducing Pnv11Chip to the last
+ update skiboot.lid to skiboot's upstream/master

v4:
+ patch #5: fix memory leak in pnv_chip_power10_quad_realize
- no change in other patches

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 (8):
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: Add ChipTOD model for Power11 ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine ppc/pnv: Update skiboot to support Power11

  docs/system/ppc/powernv.rst            |   9 +-
  hw/ppc/pnv.c                           | 177 ++++++++++++++++++++++++-
  hw/ppc/pnv_chiptod.c                   |  37 ++++++
  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 +++
  include/hw/ppc/pnv.h                   |   5 +
  include/hw/ppc/pnv_chip.h              |   7 +
  include/hw/ppc/pnv_chiptod.h           |   2 +
  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 -> 2527424 bytes
  19 files changed, 321 insertions(+), 10 deletions(-)
#23 lore raw

Hi Cedric,

Quoted 9 lines · Cédric Le Goater

Hello Aditya,

Quoted 5 lines · Aditya Gupta

Overview
============

Add support for Power11 powernv machine type, to emulate PowerNV VMs running on Power11.

Quoted 8 lines

Could you please consider deprecating the POWER8NVL and POWER8E CPUs and associated chips and machines ? I think keeping POWER8 is fine since it has different HW implementation from the following generations. However, the POWER8NVL and POWER8E variants don't add much to QEMU. They were practical at one point for bringup (2014). They are not anymore.

This will remove some lpc peculiarities.

I don't know how we 'mark' something deprecated in qemu. Checked the git history.

By deprecating, should I just mention it in deprecated section in documentation like done for PSeries in commit 0cac0f1b ?

Or directly remove it ?

Thanks,

- Aditya G

Quoted 6 lines

Thanks,

C.

#24 lore raw

Hello,

Quoted 7 lines
Quoted 7 lines

Could you please consider deprecating the POWER8NVL and POWER8E CPUs and associated chips and machines ? I think keeping POWER8 is fine since it has different HW implementation from the following generations. However, the POWER8NVL and POWER8E variants don't add much to QEMU. They were practical at one point for bringup (2014). They are not anymore.

Quoted 6 lines
Quoted 1 line

This will remove some lpc peculiarities.

I don't know how we 'mark' something deprecated in qemu. Checked the git history.

By deprecating, should I just mention it in deprecated section in documentation like done for PSeries in commit 0cac0f1b ?

commit 1392617d3576 is an example.

versioned machine types are special now and will be automatically deprecated and removed. powernv machines are not though.

Quoted 1 line

Or directly remove it ?.

nope. See :

https://www.qemu.org/docs/master/about/deprecated.html.

Thanks,

C.

#25 lore raw
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines

Could you please consider deprecating the POWER8NVL and POWER8E CPUs and associated chips and machines ? I think keeping POWER8 is fine since it has different HW implementation from the following generations. However, the POWER8NVL and POWER8E variants don't add much to QEMU. They were practical at one point for bringup (2014). They are not anymore.

Quoted 6 lines
Quoted 1 line

This will remove some lpc peculiarities.

I don't know how we 'mark' something deprecated in qemu. Checked the git history.

By deprecating, should I just mention it in deprecated section in documentation like done for PSeries in commit 0cac0f1b ?

commit 1392617d3576 is an example.

Quoted 10 lines

versioned machine types are special now and will be automatically deprecated and removed. powernv machines are not though.

Quoted 1 line

Or directly remove it ?.

nope. See :

    https://www.qemu.org/docs/master/about/deprecated.html.

Thanks Cédric !

I see we have .deprecation_reason and fields like that, will use those to mark the chips and machine deprecated.

- Aditya G

Quoted 5 lines

Thanks,

C.

#26 lore raw
Quoted 21 lines · Aditya Gupta
Quoted 21 lines
Quoted 7 lines
Quoted 7 lines

Could you please consider deprecating the POWER8NVL and POWER8E CPUs and associated chips and machines ? I think keeping POWER8 is fine since it has different HW implementation from the following generations. However, the POWER8NVL and POWER8E variants don't add much to QEMU. They were practical at one point for bringup (2014). They are not anymore.

Quoted 6 lines
Quoted 1 line

This will remove some lpc peculiarities.

I don't know how we 'mark' something deprecated in qemu. Checked the git history.

By deprecating, should I just mention it in deprecated section in documentation like done for PSeries in commit 0cac0f1b ?

commit 1392617d3576 is an example.

versioned machine types are special now and will be automatically deprecated and removed. powernv machines are not though.

Quoted 1 line

Or directly remove it ?.

Quoted 8 lines
Quoted 5 lines

nope. See :

    https://www.qemu.org/docs/master/about/deprecated.html.

Thanks Cédric !

I see we have .deprecation_reason and fields like that, will use those to mark the chips and machine deprecated.

yes. That's unrelated to this series though.

Thanks,

C.