Power11 support for QEMU [PowerNV]
v6 cover Power11 support for QEMU [PowerNV]
Overview
============
Add support for Power11 powernv machine type.
As Power11 core is same as Power10, hence much of the code has been reused from Power10.
Split Powernv11 chip/machine code into commits introducing: chip,machine,xive,phb This is to try to keep the code smaller in each commit, but can squash the xive/phb commits into respective chip/machine commit
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-v6
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
=========
v6:
+ make Pnv11Chip's parent as PnvChip, instead of Pnv10Chip
+ rebase on upstream/master
v5 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ 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 (10):
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: Introduce Pnv11Chip
ppc/pnv: Introduce Power11 PowerNV machine
ppc/pnv: Add XIVE2 controller to Power11
ppc/pnv: Add PHB5 PCIe Host bridge to Power11
ppc/pnv: Add ChipTOD model for Power11
docs/system/ppc/powernv.rst | 9 +- hw/ppc/pnv.c | 542 +++++++++++++++++++++++++++++++++++ hw/ppc/pnv_chiptod.c | 59 ++++ hw/ppc/pnv_core.c | 17 ++ 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 | 38 +++ include/hw/ppc/pnv_chip.h | 7 + include/hw/ppc/pnv_chiptod.h | 2 + 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 + include/hw/ppc/pnv_xscom.h | 49 ++++ 18 files changed, 806 insertions(+), 5 deletions(-)
Signature · 1 line
2.49.0
PATCH v6 1/10 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
--- 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
@@ -238,6 +238,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)
@@ -291,6 +298,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.49.0
Re: [PATCH v6 01/10] ppc/pnv: Add HOMER for Power11
Quoted 20 lines · Aditya Gupta
Power11 core is same as Power10, declare
PNV11_HOMERas a child class ofPNV10_HOMER, so it goes through same class initCc 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]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Aditya Gupta <[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 +0
-0
hw/ppc/pnv_homer.c static const TypeInfo pnv_homer_power10_type_info = { · line 241
Quoted 4 lines
hw/ppc/pnv_homer.c +1
-0@@ -238,6 +238,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,
I didn't see that previously.
Why are you introducing new types for P11 if they are the same as P10 ? Why not use them directly in the P11 chip instance ?
C.
Quoted 31 lines
hw/ppc/pnv_homer.c +7
-0+}; + +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)@@ -291,6 +298,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;
Re: [PATCH v6 01/10] ppc/pnv: Add HOMER for Power11
Hi Cedric,
Thanks for your reviews.
Quoted 12 lines · Cédric Le Goater
hw/ppc/pnv_homer.c static const TypeInfo · line 242
Quoted 8 lines · Aditya Gupta
<...snip...>
hw/ppc/pnv_homer.c +1
-0@@ -238,6 +238,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,I didn't see that previously.
Quoted 3 lines
Why are you introducing new types for P11 if they are the same as P10 ? Why not use them directly in the P11 chip instance ?
Cosmetic reasons only. The behavior is same for those models, p10 & p11, just the typenames and description are different.
I can use p10 models instead of declaring these, only difference will be that 'info qom-tree' in qemu will show p10 types for those models:
(qemu) info qom-tree
/homer (pnv-homer-POWER10)
/homer-chip0-memory[0] (memory-region)
/xscom-pba[0] (memory-region)
Will do it in v7 ?
Thanks,
- Aditya G
Quoted 31 lines
C.
Quoted 28 lines
hw/ppc/pnv_homer.c +7
-0+}; + +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)@@ -291,6 +298,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;
PATCH v6 2/10 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
@@ -790,6 +790,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);
@@ -868,6 +881,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
@@ -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.49.0
PATCH v6 3/10 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
@@ -286,6 +286,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 bool occ_init_homer_memory (PnvOCC *occ,Error **errp);static bool occ_model_tick (PnvOCC *occ);
@@ -360,6 +373,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.49.0
PATCH v6 4/10 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, 25 insertions(+), 1 deletion(-)
hw/ppc/pnv_psi.c +24 -0
@@ -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
@@ -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.49.0
Re: [PATCH v6 04/10] ppc/pnv: Add a PSI bridge model for Power11
Quoted 9 lines · Aditya Gupta
Power11 core is same as Power10, reuse
PNV10_PSIinitialisation, 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]>Reviewed-by Cédric Le Goater <[email protected]>
I am removing this Rb.
Quoted 11 lines
Signed-off-by Aditya Gupta <[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 +0
-0
hw/ppc/pnv_psi.c static const TypeInfo pnv_psi_power10_info = { · line 940
Quoted 4 lines
hw/ppc/pnv_psi.c +1
-0@@ -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,
why change class_base_init ?
Thanks,
C.
Quoted 46 lines
hw/ppc/pnv_psi.c +23
-0+}; + +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@@ -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;
Re: [PATCH v6 04/10] ppc/pnv: Add a PSI bridge model for Power11
Quoted 4 lines · Cédric Le Goater
Quoted 3 lines · Aditya Gupta
Power11 core is same as Power10, reuse
PNV10_PSIinitialisation, by declaring 'PNV11_PSI' as child class of 'PNV10_PSI'
Quoted 8 lines
Quoted 6 lines
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]>Reviewed-by Cédric Le Goater <[email protected]>I am removing this Rb.
Got it, I will take care in v7.
Quoted 10 lines
hw/ppc/pnv_psi.c static const TypeInfo pnv_psi_power10_info = { · line 940
Quoted 8 lines
<...snip...>
hw/ppc/pnv_psi.c +1
-0@@ -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,why change
class_base_init?
This was since I was keeping the P10 types as child of P11.
And for them to follow the same init, I found the .class_base_init to be a good option.
Based on your suggestion on Homer patch, I am thinking to drop these patches and just use p10 models.
Thanks,
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
PATCH v6 5/10 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.49.0
Re: [PATCH v6 05/10] ppc/pnv: Add SBE model for Power11
Quoted 20 lines · Aditya Gupta
Power11 core is same as Power10, reuse
PNV10_SBERinitialisation, by declaringPNV11_PSIas child class ofPNV10_PSICc 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]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Aditya Gupta <[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 +0
-0
hw/ppc/pnv_sbe.c static const TypeInfo pnv_sbe_power10_type_info = { · line 369
Quoted 4 lines
hw/ppc/pnv_sbe.c +1
-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,
again why change .class_base_init ?
C.
Quoted 37 lines
hw/ppc/pnv_sbe.c +14
-0+}; + +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;
Re: [PATCH v6 05/10] ppc/pnv: Add SBE model for Power11
Quoted 12 lines · Cédric Le Goater
hw/ppc/pnv_sbe.c static const TypeInfo pnv_sbe_power10_type_info = { · line 369
Quoted 9 lines · Aditya Gupta
<...snip...>
hw/ppc/pnv_sbe.c +1
-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,again why change .class_base_init ?
So that the P11 types which declared P10 types as parent, follow this .class_init. Same reason for the other models.
Will consider dropping these models, since same as P10s.
Thanks,
- Aditya Gupta
Quoted 3 lines
C.
PATCH v6 6/10 ppc/pnv: Introduce Pnv11Chip
In reply to Aditya GuptaImplement Pnv11Chip, currently without chiptod, xive and phb.
Chiptod, XIVE, PHB are implemented in later patches.
Since Power11 core is same as Power10, the implementation of Pnv11Chip is a duplicate of corresponding Pnv10Chip.
--- hw/ppc/pnv.c | 306 +++++++++++++++++++++++++++++++++++++ hw/ppc/pnv_core.c | 17 +++ include/hw/ppc/pnv.h | 20 +++ include/hw/ppc/pnv_chip.h | 7 + include/hw/ppc/pnv_xscom.h | 49 ++++++ 5 files changed, 399 insertions(+)
hw/ppc/pnv.c +306 -0
@@ -490,6 +490,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 (PNV11_XSCOM_BASE (chip)), +cpu_to_be64 (PNV11_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 ,PNV11_LPCM_BASE (chip),PNV11_LPCM_SIZE ); +} +static void pnv_dt_rtc (ISADevice *d,void *fdt,int lpc_off) {uint32_t io_base = d->ioport_id;
@@ -822,6 +849,26 @@ static ISABus *pnv_chip_power10_isa_create(PnvChip *chip, Error **errp)return pnv_lpc_isa_create (&chip10->lpc, false, errp); } +static ISABus *pnv_chip_power11_isa_create (PnvChip *chip,Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +qemu_irq irq; + + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPCHC ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"LPCHC" ,0 , irq); + + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ0 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,0 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ1 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,1 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ2 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,2 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ3 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,3 , irq); + +return pnv_lpc_isa_create (&chip11->lpc, false, errp); +} +static ISABus *pnv_isa_create (PnvChip *chip,Error **errp) {return PNV_CHIP_GET_CLASS (chip)->isa_create (chip, errp);
@@ -885,6 +932,12 @@ static uint64_t pnv_chip_power10_xscom_core_base(PnvChip *chip,return PNV10_XSCOM_EC_BASE (core_id); } +static uint64_t pnv_chip_power11_xscom_core_base (PnvChip *chip, +uint32_t core_id) +{ +return PNV11_XSCOM_EC_BASE (core_id); +} +static bool pnv_match_cpu (const char *default_type,const char *cpu_type) { PowerPCCPUClass *ppc_default =
@@ -914,6 +967,13 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, GString *buf) pnv_chip_power9_pic_print_info_child, buf); } +static void pnv_chip_power11_pic_print_info (PnvChip *chip,GString *buf) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); + +pnv_psi_pic_print_info (&chip11->psi, buf); +} +/* Always give the first 1GB to chip 0 else we won't boot */ static uint64_t pnv_chip_get_ram_size (PnvMachineState *pnv,int chip_id) {
@@ -1451,6 +1511,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);
@@ -2264,6 +2326,203 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp) } } +static void pnv_chip_power11_instance_init (Object *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,"psi" , &chip11->psi,TYPE_PNV11_PSI ); +object_initialize_child (obj,"lpc" , &chip11->lpc,TYPE_PNV11_LPC ); +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 ); + +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_quad_realize (Pnv11Chip *chip11,Error **errp) +{ +PnvChip *chip =PNV_CHIP (chip11); +int i; + + chip11->nr_quads =DIV_ROUND_UP (chip->nr_cores,4 ); + chip11->quads =g_new0 (PnvQuad, chip11->nr_quads); + +for (i =0 ; i < chip11->nr_quads; i++) { +PnvQuad *eq = &chip11->quads[i]; + +pnv_chip_quad_realize_one (chip, eq, chip->cores[i *4 ], +PNV_QUAD_TYPE_NAME ("power11" )); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_EQ_BASE (eq->quad_id), + &eq->xscom_regs); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_QME_BASE (eq->quad_id), + &eq->xscom_qme_regs); + } +} + +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) +{ +PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev); +PnvChip *chip =PNV_CHIP (dev); +Pnv11Chip *chip11 =PNV11_CHIP (dev); +Error *local_err =NULL ; +int i; + +/* XSCOM bridge is first */ +pnv_xscom_init (chip,PNV11_XSCOM_SIZE ,PNV11_XSCOM_BASE (chip)); + + pcc->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +/* ADU */ +object_property_set_link (OBJECT (&chip11->adu),"lpc" ,OBJECT (&chip11->lpc), + &error_abort); +if (!qdev_realize (DEVICE (&chip11->adu),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_ADU_BASE , + &chip11->adu.xscom_regs); + +pnv_chip_power11_quad_realize (chip11, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +/* WIP: XIVE added in future patch */ + +/* Processor Service Interface (PSI) Host Bridge */ +object_property_set_int (OBJECT (&chip11->psi),"bar" , +PNV11_PSIHB_BASE (chip), &error_fatal); +if (!qdev_realize (DEVICE (&chip11->psi),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PSIHB_BASE , + &PNV_PSI (&chip11->psi)->xscom_regs); + +/* LPC */ +if (!qdev_realize (DEVICE (&chip11->lpc),NULL , errp)) { +return ; + } +memory_region_add_subregion (get_system_memory (),PNV11_LPCM_BASE (chip), + &chip11->lpc.xscom_regs); + + chip->fw_mr = &chip11->lpc.isa_fw; + chip->dt_isa_nodename =g_strdup_printf ("/lpcm-opb@%" PRIx64"/lpc@0" , + (uint64_t )PNV11_LPCM_BASE (chip)); + +/* HOMER (must be created before OCC) */ +object_property_set_link (OBJECT (&chip11->homer),"chip" ,OBJECT (chip), + &error_abort); +if (!qdev_realize (DEVICE (&chip11->homer),NULL , errp)) { +return ; + } +/* Homer Xscom region */ +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PBA_BASE , + &chip11->homer.pba_regs); +/* Homer RAM region */ +memory_region_add_subregion (get_system_memory (), chip11->homer.base, + &chip11->homer.mem); + +/* Create the simplified OCC model */ +object_property_set_link (OBJECT (&chip11->occ),"homer" , +OBJECT (&chip11->homer), &error_abort); +if (!qdev_realize (DEVICE (&chip11->occ),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_OCC_BASE , + &chip11->occ.xscom_regs); +qdev_connect_gpio_out (DEVICE (&chip11->occ),0 ,qdev_get_gpio_in ( +DEVICE (&chip11->psi),PSIHB9_IRQ_OCC )); + +/* OCC SRAM model */ +memory_region_add_subregion (get_system_memory (), +PNV11_OCC_SENSOR_BASE (chip), + &chip11->occ.sram_regs); + +/* SBE */ +if (!qdev_realize (DEVICE (&chip11->sbe),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_SBE_CTRL_BASE , + &chip11->sbe.xscom_ctrl_regs); +pnv_xscom_add_subregion (chip,PNV11_XSCOM_SBE_MBOX_BASE , + &chip11->sbe.xscom_mbox_regs); +qdev_connect_gpio_out (DEVICE (&chip11->sbe),0 ,qdev_get_gpio_in ( +DEVICE (&chip11->psi),PSIHB9_IRQ_PSU )); + +/* N1 chiplet */ +if (!qdev_realize (DEVICE (&chip11->n1_chiplet),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_CHIPLET_CTRL_REGS_BASE , + &chip11->n1_chiplet.nest_pervasive.xscom_ctrl_regs_mr); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_EQ_BASE , + &chip11->n1_chiplet.xscom_pb_eq_mr); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_ES_BASE , + &chip11->n1_chiplet.xscom_pb_es_mr); + +/* WIP: PHB added in future patch */ + +/* +* I2C +*/ +for (i =0 ; i < pcc->i2c_num_engines; i++) { +Object *obj =OBJECT (&chip11->i2c[i]); + +object_property_set_int (obj,"engine" , i +1 , &error_fatal); +object_property_set_int (obj,"num-busses" , + pcc->i2c_ports_per_engine[i], + &error_fatal); +object_property_set_link (obj,"chip" ,OBJECT (chip), &error_abort); +if (!qdev_realize (DEVICE (obj),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_I2CM_BASE + + (chip11->i2c[i].engine -1 ) * +PNV11_XSCOM_I2CM_SIZE , + &chip11->i2c[i].xscom_regs); +qdev_connect_gpio_out (DEVICE (&chip11->i2c[i]),0 , +qdev_get_gpio_in (DEVICE (&chip11->psi), +PSIHB9_IRQ_SBE_I2C )); + } +/* PIB SPI Controller */ +for (i =0 ; i <PNV10_CHIP_MAX_PIB_SPIC ; i++) { +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"spic_num" , + i, &error_fatal); +/* pib_spic[2] connected to 25csm04 which implements 1 byte transfer */ +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"transfer_len" , + (i ==2 ) ?1 :4 , &error_fatal); +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"chip-id" , + chip->chip_id, &error_fatal); +if (!sysbus_realize (SYS_BUS_DEVICE (OBJECT + (&chip11->pib_spic[i])), errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PIB_SPIC_BASE + + i *PNV11_XSCOM_PIB_SPIC_SIZE , + &chip11->pib_spic[i].xscom_spic_regs); + } +} +static void pnv_rainier_i2c_init (PnvMachineState *pnv) {int i;
@@ -2302,6 +2561,12 @@ static uint32_t pnv_chip_power10_xscom_pcba(PnvChip *chip, uint64_t addr)return addr >>3 ; } +static uint32_t pnv_chip_power11_xscom_pcba (PnvChip *chip,uint64_t addr) +{ + addr &= (PNV11_XSCOM_SIZE -1 ); +return addr >>3 ; +} +static void pnv_chip_power10_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -2329,6 +2594,29 @@ 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->isa_create = pnv_chip_power11_isa_create; + k->dt_populate = pnv_chip_power11_dt_populate; + k->pic_print_info = pnv_chip_power11_pic_print_info; + k->xscom_core_base = pnv_chip_power11_xscom_core_base; + k->xscom_pcba = pnv_chip_power11_xscom_pcba; + dc->desc ="PowerNV Chip Power11" ; + 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) {
@@ -2962,6 +3250,13 @@ 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 ("powernv10-rainier" ),
@@ -3017,6 +3312,17 @@ static const TypeInfo types[] = { .abstract = true, }, +/* +* P11 chip and variants +*/ + { + .name = TYPE_PNV11_CHIP, + .parent = TYPE_PNV_CHIP, + .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 +17 -0
@@ -473,6 +473,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);
@@ -504,6 +509,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)
@@ -725,6 +731,12 @@ static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) pqc->xscom_qme_size =PNV10_XSCOM_QME_SIZE ; } +static void pnv_quad_power11_class_init (ObjectClass *oc,void *data) +{ +/* Power11 quad is similar to Power10 quad */ +pnv_quad_power10_class_init (oc, data); +} +static void pnv_quad_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);
@@ -752,6 +764,11 @@ static const TypeInfo pnv_quad_infos[] = { .name = PNV_QUAD_TYPE_NAME("power10"), .class_init = pnv_quad_power10_class_init, }, + { + .parent = TYPE_PNV_QUAD, + .name = PNV_QUAD_TYPE_NAME("power11"), + .class_init = pnv_quad_power11_class_init, + }, };DEFINE_TYPES (pnv_quad_infos);
include/hw/ppc/pnv.h +20 -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);
@@ -252,4 +257,19 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor);#define PNV10_HOMER_BASE (chip) \ (0x300ffd800000ll + ((uint64_t)(chip)->chip_id) * PNV_HOMER_SIZE) +/* Power11 */ +#define PNV11_XSCOM_SIZE PNV10_XSCOM_SIZE +#define PNV11_XSCOM_BASE (chip) PNV10_XSCOM_BASE(chip) + +#define PNV11_LPCM_SIZE PNV10_LPCM_SIZE +#define PNV11_LPCM_BASE (chip) PNV10_LPCM_BASE(chip) + +#define PNV11_PSIHB_ESB_SIZE PNV10_PSIHB_ESB_SIZE +#define PNV11_PSIHB_ESB_BASE (chip) PNV10_PSIHB_ESB_BASE(chip) + +#define PNV11_PSIHB_SIZE PNV10_PSIHB_SIZE +#define PNV11_PSIHB_BASE (chip) PNV10_PSIHB_BASE(chip) + +#define PNV11_OCC_SENSOR_BASE (chip) PNV10_OCC_SENSOR_BASE(chip) +#endif /* PPC_PNV_H */
include/hw/ppc/pnv_chip.h +7 -0
@@ -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_xscom.h +49 -0
55 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v6 06/10] ppc/pnv: Introduce Pnv11Chip
Quoted 7 lines · Aditya Gupta
Implement Pnv11Chip, currently without chiptod, xive and phb.
Chiptod, XIVE, PHB are implemented in later patches.
Since Power11 core is same as Power10, the implementation of Pnv11Chip is a duplicate of corresponding Pnv10Chip.
Quoted 6 lines
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]>Signed-off-by Aditya Gupta <[email protected]>
Looks correct, one comment below.
Anyhow,
Quoted 115 lines
--- hw/ppc/pnv.c | 306 +++++++++++++++++++++++++++++++++++++ hw/ppc/pnv_core.c | 17 +++ include/hw/ppc/pnv.h | 20 +++ include/hw/ppc/pnv_chip.h | 7 + include/hw/ppc/pnv_xscom.h | 49 ++++++ 5 files changed, 399 insertions(+)hw/ppc/pnv.c +64
-0@@ -490,6 +490,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 (PNV11_XSCOM_BASE (chip)), +cpu_to_be64 (PNV11_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 ,PNV11_LPCM_BASE (chip),PNV11_LPCM_SIZE ); +} +static void pnv_dt_rtc (ISADevice *d,void *fdt,int lpc_off) {uint32_t io_base = d->ioport_id;@@ -822,6 +849,26 @@ static ISABus *pnv_chip_power10_isa_create(PnvChip *chip, Error **errp)return pnv_lpc_isa_create (&chip10->lpc, false, errp); } +static ISABus *pnv_chip_power11_isa_create (PnvChip *chip,Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +qemu_irq irq; + + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPCHC ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"LPCHC" ,0 , irq); + + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ0 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,0 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ1 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,1 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ2 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,2 , irq); + irq =qdev_get_gpio_in (DEVICE (&chip11->psi),PSIHB9_IRQ_LPC_SIRQ3 ); +qdev_connect_gpio_out_named (DEVICE (&chip11->lpc),"SERIRQ" ,3 , irq); + +return pnv_lpc_isa_create (&chip11->lpc, false, errp); +} +static ISABus *pnv_isa_create (PnvChip *chip,Error **errp) {return PNV_CHIP_GET_CLASS (chip)->isa_create (chip, errp);@@ -885,6 +932,12 @@ static uint64_t pnv_chip_power10_xscom_core_base(PnvChip *chip,return PNV10_XSCOM_EC_BASE (core_id); } +static uint64_t pnv_chip_power11_xscom_core_base (PnvChip *chip, +uint32_t core_id) +{ +return PNV11_XSCOM_EC_BASE (core_id); +} +static bool pnv_match_cpu (const char *default_type,const char *cpu_type) { PowerPCCPUClass *ppc_default =@@ -914,6 +967,13 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, GString *buf) pnv_chip_power9_pic_print_info_child, buf); } +static void pnv_chip_power11_pic_print_info (PnvChip *chip,GString *buf) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); + +pnv_psi_pic_print_info (&chip11->psi, buf); +} +/* Always give the first 1GB to chip 0 else we won't boot */ static uint64_t pnv_chip_get_ram_size (PnvMachineState *pnv,int chip_id) {@@ -1451,6 +1511,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);@@ -2264,6 +2326,203 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp) } } +static void pnv_chip_power11_instance_init (Object *obj) +{
hw/ppc/pnv.c static void pnv_chip_power10_realize(DeviceState *dev, Error **errp) · line 2340
Quoted 10 lines
hw/ppc/pnv.c +10
-0+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,"psi" , &chip11->psi,TYPE_PNV11_PSI ); +object_initialize_child (obj,"lpc" , &chip11->lpc,TYPE_PNV11_LPC ); +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 );
As said earlier, if the models of the HW units above are the same on P10 an P11, you could simply use the P10 types. That's fine. Just add a little comment.
Thanks,
C.
Quoted 433 lines
hw/ppc/pnv.c +232
-0+object_initialize_child (obj,"n1-chiplet" , &chip11->n1_chiplet, +TYPE_PNV_N1_CHIPLET ); + +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_quad_realize (Pnv11Chip *chip11,Error **errp) +{ +PnvChip *chip =PNV_CHIP (chip11); +int i; + + chip11->nr_quads =DIV_ROUND_UP (chip->nr_cores,4 ); + chip11->quads =g_new0 (PnvQuad, chip11->nr_quads); + +for (i =0 ; i < chip11->nr_quads; i++) { +PnvQuad *eq = &chip11->quads[i]; + +pnv_chip_quad_realize_one (chip, eq, chip->cores[i *4 ], +PNV_QUAD_TYPE_NAME ("power11" )); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_EQ_BASE (eq->quad_id), + &eq->xscom_regs); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_QME_BASE (eq->quad_id), + &eq->xscom_qme_regs); + } +} + +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) +{ +PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev); +PnvChip *chip =PNV_CHIP (dev); +Pnv11Chip *chip11 =PNV11_CHIP (dev); +Error *local_err =NULL ; +int i; + +/* XSCOM bridge is first */ +pnv_xscom_init (chip,PNV11_XSCOM_SIZE ,PNV11_XSCOM_BASE (chip)); + + pcc->parent_realize (dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +/* ADU */ +object_property_set_link (OBJECT (&chip11->adu),"lpc" ,OBJECT (&chip11->lpc), + &error_abort); +if (!qdev_realize (DEVICE (&chip11->adu),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_ADU_BASE , + &chip11->adu.xscom_regs); + +pnv_chip_power11_quad_realize (chip11, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +/* WIP: XIVE added in future patch */ + +/* Processor Service Interface (PSI) Host Bridge */ +object_property_set_int (OBJECT (&chip11->psi),"bar" , +PNV11_PSIHB_BASE (chip), &error_fatal); +if (!qdev_realize (DEVICE (&chip11->psi),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PSIHB_BASE , + &PNV_PSI (&chip11->psi)->xscom_regs); + +/* LPC */ +if (!qdev_realize (DEVICE (&chip11->lpc),NULL , errp)) { +return ; + } +memory_region_add_subregion (get_system_memory (),PNV11_LPCM_BASE (chip), + &chip11->lpc.xscom_regs); + + chip->fw_mr = &chip11->lpc.isa_fw; + chip->dt_isa_nodename =g_strdup_printf ("/lpcm-opb@%" PRIx64"/lpc@0" , + (uint64_t )PNV11_LPCM_BASE (chip)); + +/* HOMER (must be created before OCC) */ +object_property_set_link (OBJECT (&chip11->homer),"chip" ,OBJECT (chip), + &error_abort); +if (!qdev_realize (DEVICE (&chip11->homer),NULL , errp)) { +return ; + } +/* Homer Xscom region */ +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PBA_BASE , + &chip11->homer.pba_regs); +/* Homer RAM region */ +memory_region_add_subregion (get_system_memory (), chip11->homer.base, + &chip11->homer.mem); + +/* Create the simplified OCC model */ +object_property_set_link (OBJECT (&chip11->occ),"homer" , +OBJECT (&chip11->homer), &error_abort); +if (!qdev_realize (DEVICE (&chip11->occ),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_OCC_BASE , + &chip11->occ.xscom_regs); +qdev_connect_gpio_out (DEVICE (&chip11->occ),0 ,qdev_get_gpio_in ( +DEVICE (&chip11->psi),PSIHB9_IRQ_OCC )); + +/* OCC SRAM model */ +memory_region_add_subregion (get_system_memory (), +PNV11_OCC_SENSOR_BASE (chip), + &chip11->occ.sram_regs); + +/* SBE */ +if (!qdev_realize (DEVICE (&chip11->sbe),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_SBE_CTRL_BASE , + &chip11->sbe.xscom_ctrl_regs); +pnv_xscom_add_subregion (chip,PNV11_XSCOM_SBE_MBOX_BASE , + &chip11->sbe.xscom_mbox_regs); +qdev_connect_gpio_out (DEVICE (&chip11->sbe),0 ,qdev_get_gpio_in ( +DEVICE (&chip11->psi),PSIHB9_IRQ_PSU )); + +/* N1 chiplet */ +if (!qdev_realize (DEVICE (&chip11->n1_chiplet),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_CHIPLET_CTRL_REGS_BASE , + &chip11->n1_chiplet.nest_pervasive.xscom_ctrl_regs_mr); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_EQ_BASE , + &chip11->n1_chiplet.xscom_pb_eq_mr); + +pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_ES_BASE , + &chip11->n1_chiplet.xscom_pb_es_mr); + +/* WIP: PHB added in future patch */ + +/* +* I2C +*/ +for (i =0 ; i < pcc->i2c_num_engines; i++) { +Object *obj =OBJECT (&chip11->i2c[i]); + +object_property_set_int (obj,"engine" , i +1 , &error_fatal); +object_property_set_int (obj,"num-busses" , + pcc->i2c_ports_per_engine[i], + &error_fatal); +object_property_set_link (obj,"chip" ,OBJECT (chip), &error_abort); +if (!qdev_realize (DEVICE (obj),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_I2CM_BASE + + (chip11->i2c[i].engine -1 ) * +PNV11_XSCOM_I2CM_SIZE , + &chip11->i2c[i].xscom_regs); +qdev_connect_gpio_out (DEVICE (&chip11->i2c[i]),0 , +qdev_get_gpio_in (DEVICE (&chip11->psi), +PSIHB9_IRQ_SBE_I2C )); + } +/* PIB SPI Controller */ +for (i =0 ; i <PNV10_CHIP_MAX_PIB_SPIC ; i++) { +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"spic_num" , + i, &error_fatal); +/* pib_spic[2] connected to 25csm04 which implements 1 byte transfer */ +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"transfer_len" , + (i ==2 ) ?1 :4 , &error_fatal); +object_property_set_int (OBJECT (&chip11->pib_spic[i]),"chip-id" , + chip->chip_id, &error_fatal); +if (!sysbus_realize (SYS_BUS_DEVICE (OBJECT + (&chip11->pib_spic[i])), errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_PIB_SPIC_BASE + + i *PNV11_XSCOM_PIB_SPIC_SIZE , + &chip11->pib_spic[i].xscom_spic_regs); + } +} +static void pnv_rainier_i2c_init (PnvMachineState *pnv) {int i;@@ -2302,6 +2561,12 @@ static uint32_t pnv_chip_power10_xscom_pcba(PnvChip *chip, uint64_t addr)return addr >>3 ; } +static uint32_t pnv_chip_power11_xscom_pcba (PnvChip *chip,uint64_t addr) +{ + addr &= (PNV11_XSCOM_SIZE -1 ); +return addr >>3 ; +} +static void pnv_chip_power10_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);@@ -2329,6 +2594,29 @@ 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->isa_create = pnv_chip_power11_isa_create; + k->dt_populate = pnv_chip_power11_dt_populate; + k->pic_print_info = pnv_chip_power11_pic_print_info; + k->xscom_core_base = pnv_chip_power11_xscom_core_base; + k->xscom_pcba = pnv_chip_power11_xscom_pcba; + dc->desc ="PowerNV Chip Power11" ; + 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) {@@ -2962,6 +3250,13 @@ 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 ("powernv10-rainier" ),@@ -3017,6 +3312,17 @@ static const TypeInfo types[] = { .abstract = true, }, +/* +* P11 chip and variants +*/ + { + .name = TYPE_PNV11_CHIP, + .parent = TYPE_PNV_CHIP, + .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 +17
-0@@ -473,6 +473,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);@@ -504,6 +509,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)@@ -725,6 +731,12 @@ static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) pqc->xscom_qme_size =PNV10_XSCOM_QME_SIZE ; } +static void pnv_quad_power11_class_init (ObjectClass *oc,void *data) +{ +/* Power11 quad is similar to Power10 quad */ +pnv_quad_power10_class_init (oc, data); +} +static void pnv_quad_class_init (ObjectClass *oc,void *data) {DeviceClass *dc =DEVICE_CLASS (oc);@@ -752,6 +764,11 @@ static const TypeInfo pnv_quad_infos[] = { .name = PNV_QUAD_TYPE_NAME("power10"), .class_init = pnv_quad_power10_class_init, }, + { + .parent = TYPE_PNV_QUAD, + .name = PNV_QUAD_TYPE_NAME("power11"), + .class_init = pnv_quad_power11_class_init, + }, };DEFINE_TYPES (pnv_quad_infos);include/hw/ppc/pnv.h +20
-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);@@ -252,4 +257,19 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor);#define PNV10_HOMER_BASE (chip) \ (0x300ffd800000ll + ((uint64_t)(chip)->chip_id) * PNV_HOMER_SIZE) +/* Power11 */ +#define PNV11_XSCOM_SIZE PNV10_XSCOM_SIZE +#define PNV11_XSCOM_BASE (chip) PNV10_XSCOM_BASE(chip) + +#define PNV11_LPCM_SIZE PNV10_LPCM_SIZE +#define PNV11_LPCM_BASE (chip) PNV10_LPCM_BASE(chip) + +#define PNV11_PSIHB_ESB_SIZE PNV10_PSIHB_ESB_SIZE +#define PNV11_PSIHB_ESB_BASE (chip) PNV10_PSIHB_ESB_BASE(chip) + +#define PNV11_PSIHB_SIZE PNV10_PSIHB_SIZE +#define PNV11_PSIHB_BASE (chip) PNV10_PSIHB_BASE(chip) + +#define PNV11_OCC_SENSOR_BASE (chip) PNV10_OCC_SENSOR_BASE(chip) +#endif /* PPC_PNV_H */ include/hw/ppc/pnv_chip.h +7
-0@@ -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_xscom.h +49
-0@@ -207,6 +207,55 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_PIB_SPIC_BASE 0xc0000#define PNV10_XSCOM_PIB_SPIC_SIZE 0x20 +/* +* Power11 core is same as Power10 +*/ +#define PNV11_XSCOM_EC_BASE (core) PNV10_XSCOM_EC_BASE(core) + +#define PNV11_XSCOM_ADU_BASE PNV10_XSCOM_ADU_BASE +#define PNV11_XSCOM_ADU_SIZE PNV10_XSCOM_ADU_SIZE + +#define PNV11_XSCOM_QME_BASE (core) PNV10_XSCOM_QME_BASE(core) + +#define PNV11_XSCOM_EQ_BASE (core) PNV10_XSCOM_EQ_BASE(core) + +#define PNV11_XSCOM_PSIHB_BASE PNV10_XSCOM_PSIHB_BASE +#define PNV11_XSCOM_PSIHB_SIZE PNV10_XSCOM_PSIHB_SIZE + +#define PNV11_XSCOM_I2CM_BASE PNV10_XSCOM_I2CM_BASE +#define PNV11_XSCOM_I2CM_SIZE PNV10_XSCOM_I2CM_SIZE + +#define PNV11_XSCOM_CHIPTOD_BASE PNV10_XSCOM_CHIPTOD_BASE +#define PNV11_XSCOM_CHIPTOD_SIZE PNV10_XSCOM_CHIPTOD_SIZE + +#define PNV11_XSCOM_OCC_BASE PNV10_XSCOM_OCC_BASE +#define PNV11_XSCOM_OCC_SIZE PNV10_XSCOM_OCC_SIZE + +#define PNV11_XSCOM_SBE_CTRL_BASE PNV10_XSCOM_SBE_CTRL_BASE +#define PNV11_XSCOM_SBE_CTRL_SIZE PNV10_XSCOM_SBE_CTRL_SIZE + +#define PNV11_XSCOM_SBE_MBOX_BASE PNV10_XSCOM_SBE_MBOX_BASE +#define PNV11_XSCOM_SBE_MBOX_SIZE PNV10_XSCOM_SBE_MBOX_SIZE + +#define PNV11_XSCOM_PBA_BASE PNV10_XSCOM_PBA_BASE +#define PNV11_XSCOM_PBA_SIZE PNV10_XSCOM_PBA_SIZE + +#define PNV11_XSCOM_XIVE2_BASE PNV10_XSCOM_XIVE2_BASE +#define PNV11_XSCOM_XIVE2_SIZE PNV10_XSCOM_XIVE2_SIZE + +#define PNV11_XSCOM_N1_CHIPLET_CTRL_REGS_BASE \ + PNV10_XSCOM_N1_CHIPLET_CTRL_REGS_BASE +#define PNV11_XSCOM_CHIPLET_CTRL_REGS_SIZE PNV10_XSCOM_CHIPLET_CTRL_REGS_SIZE + +#define PNV11_XSCOM_N1_PB_SCOM_EQ_BASE PNV10_XSCOM_N1_PB_SCOM_EQ_BASE +#define PNV11_XSCOM_N1_PB_SCOM_EQ_SIZE PNV10_XSCOM_N1_PB_SCOM_EQ_SIZE + +#define PNV11_XSCOM_N1_PB_SCOM_ES_BASE PNV10_XSCOM_N1_PB_SCOM_ES_BASE +#define PNV11_XSCOM_N1_PB_SCOM_ES_SIZE PNV10_XSCOM_N1_PB_SCOM_ES_SIZE + +#define PNV11_XSCOM_PIB_SPIC_BASE PNV10_XSCOM_PIB_SPIC_BASE +#define PNV11_XSCOM_PIB_SPIC_SIZE PNV10_XSCOM_PIB_SPIC_SIZE +void pnv_xscom_init (PnvChip *chip,uint64_t size,hwaddr addr); int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset, uint64_t xscom_base, uint64_t xscom_size,
Re: [PATCH v6 06/10] ppc/pnv: Introduce Pnv11Chip
Quoted 34 lines · Cédric Le Goater
Quoted 7 lines · Aditya Gupta
Implement Pnv11Chip, currently without chiptod, xive and phb.
Chiptod, XIVE, PHB are implemented in later patches.
Since Power11 core is same as Power10, the implementation of Pnv11Chip is a duplicate of corresponding Pnv10Chip.
Quoted 6 lines
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]>Signed-off-by Aditya Gupta <[email protected]>Looks correct, one comment below.
Anyhow,
Reviewed-by Cédric Le Goater <[email protected]>Quoted 9 lines
<...snip...>
+
object_initialize_child(obj, "adu", &chip11->adu, TYPE_PNV_ADU); +object_initialize_child(obj, "psi", &chip11->psi, TYPE_PNV11_PSI); +object_initialize_child(obj, "lpc", &chip11->lpc, TYPE_PNV11_LPC); +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);
Quoted 4 lines
As said earlier, if the models of the HW units above are the same on P10 an P11, you could simply use the P10 types. That's fine. Just add a little comment.
Sure, made that change in my tree. And thanks for the tag Cédric !
- Aditya Gupta
Quoted 6 lines
Thanks,
C.
PATCH v6 7/10 ppc/pnv: Introduce Power11 PowerNV machine
In reply to Aditya GuptaThe Powernv11 machine doesn't have XIVE & PHBs as of now
XIVE2 interface and PHB5 added in later patches to Powernv11 machine
Also add mention of Power11 to powernv documentation
--- docs/system/ppc/powernv.rst | 9 +++++---- hw/ppc/pnv.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 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 +36 -0
@@ -3145,6 +3145,37 @@ 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" ; + + pmc->compat = compat; + pmc->compat_size =sizeof (compat); + pmc->max_smt_threads =4 ; + pmc->has_lpar_per_thread = true; + pmc->quirk_tb_big_core = true; + pmc->dt_power_mgt = pnv_dt_power_mgt; + +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); + + mc->desc ="IBM PowerNV (Non-Virtualized) Power11" ; + mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power11_v2.0" ); + +object_class_property_add_bool (oc,"big-core" , + pnv_machine_get_big_core, + pnv_machine_set_big_core); +object_class_property_set_description (oc,"big-core" , +"Use big-core (aka fused-core) mode" ); + +object_class_property_add_bool (oc,"lpar-per-core" , + pnv_machine_get_lpar_per_core, + pnv_machine_set_lpar_per_core); +object_class_property_set_description (oc,"lpar-per-core" , +"Use 1 LPAR per core mode" ); +} +static void pnv_cpu_do_nmi_on_cpu (CPUState *cs,run_on_cpu_data arg) {CPUPPCState *env =cpu_env (cs);
@@ -3258,6 +3289,11 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) }static const TypeInfo types[] = { + { + .name =MACHINE_TYPE_NAME ("powernv11" ), + .parent =TYPE_PNV_MACHINE , + .class_init = pnv_machine_power11_class_init, + }, { .name =MACHINE_TYPE_NAME ("powernv10-rainier" ), .parent =MACHINE_TYPE_NAME ("powernv10" ),
Signature · 1 line
2.49.0
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 56 lines · Aditya Gupta
The Powernv11 machine doesn't have XIVE & PHBs as of now
XIVE2 interface and PHB5 added in later patches to Powernv11 machine
Also add mention of Power11 to powernv documentation
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]>Signed-off-by Aditya Gupta <[email protected]>--- docs/system/ppc/powernv.rst | 9 +++++---- hw/ppc/pnv.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 4 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 +4
-0@@ -3145,6 +3145,37 @@ 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);
hw/ppc/pnv.c static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, void *data) · line 3161
Quoted 10 lines
hw/ppc/pnv.c +10
-0+static const char compat[] ="qemu,powernv11\0ibm,powernv" ; + + pmc->compat = compat; + pmc->compat_size =sizeof (compat); + pmc->max_smt_threads =4 ; + pmc->has_lpar_per_thread = true; + pmc->quirk_tb_big_core = true; + pmc->dt_power_mgt = pnv_dt_power_mgt; + +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB );
There was a lot of work done to have dynamic PHBs in the PowerNV machines. This was to add support in libvirt and this goal was abandoned when people left. I think we should consider removing it as it adds unnecessary complexity.
Anyhow,
Thanks,
C.
+
Quoted 31 lines
hw/ppc/pnv.c +21
-0+ mc->desc ="IBM PowerNV (Non-Virtualized) Power11" ; + mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power11_v2.0" ); + +object_class_property_add_bool (oc,"big-core" , + pnv_machine_get_big_core, + pnv_machine_set_big_core); +object_class_property_set_description (oc,"big-core" , +"Use big-core (aka fused-core) mode" ); + +object_class_property_add_bool (oc,"lpar-per-core" , + pnv_machine_get_lpar_per_core, + pnv_machine_set_lpar_per_core); +object_class_property_set_description (oc,"lpar-per-core" , +"Use 1 LPAR per core mode" ); +} +static void pnv_cpu_do_nmi_on_cpu (CPUState *cs,run_on_cpu_data arg) {CPUPPCState *env =cpu_env (cs);@@ -3258,6 +3289,11 @@ static void pnv_machine_class_init(ObjectClass *oc, void *data) }static const TypeInfo types[] = { + { + .name =MACHINE_TYPE_NAME ("powernv11" ), + .parent =TYPE_PNV_MACHINE , + .class_init = pnv_machine_power11_class_init, + }, { .name =MACHINE_TYPE_NAME ("powernv10-rainier" ), .parent =MACHINE_TYPE_NAME ("powernv10" ),
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 14 lines · Cédric Le Goater
Quoted 13 lines · Aditya Gupta
<...snip...>
+static void
pnv_machine_power11_class_init(ObjectClass *oc, void *data)hw/ppc/pnv.c +10
-0+{ + MachineClass *mc = MACHINE_CLASS(oc); + PnvMachineClass *pmc = PNV_MACHINE_CLASS(oc); + static const char compat[] = "qemu,powernv11\0ibm,powernv"; + + pmc->compat = compat; + pmc->compat_size = sizeof(compat); + pmc->max_smt_threads = 4; + pmc->has_lpar_per_thread = true; + pmc->quirk_tb_big_core = true;
Quoted 9 lines
Quoted 3 lines
+
pmc->dt_power_mgt=pnv_dt_power_mgt;
+
+machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB);There was a lot of work done to have dynamic PHBs in the PowerNV machines. This was to add support in libvirt and this goal was abandoned when people left. I think we should consider removing it as it adds unnecessary complexity.
Thanks for telling the history behind it, agreed this is unnecessary, will remove in v7.
Quoted 4 lines
Anyhow,
Reviewed-by Cédric Le Goater <[email protected]>
Thanks for the tag Cédric !
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 25 lines · Aditya Gupta
Quoted 14 lines · Cédric Le Goater
Quoted 13 lines · Aditya Gupta
<...snip...>
+static void
pnv_machine_power11_class_init(ObjectClass *oc, void *data)hw/ppc/pnv.c +10
-0+{ + MachineClass *mc = MACHINE_CLASS(oc); + PnvMachineClass *pmc = PNV_MACHINE_CLASS(oc); + static const char compat[] = "qemu,powernv11\0ibm,powernv"; + + pmc->compat = compat; + pmc->compat_size = sizeof(compat); + pmc->max_smt_threads = 4; + pmc->has_lpar_per_thread = true; + pmc->quirk_tb_big_core = true;Quoted 9 lines
Quoted 3 lines
+
pmc->dt_power_mgt=pnv_dt_power_mgt;
+
+machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB);There was a lot of work done to have dynamic PHBs in the PowerNV machines. This was to add support in libvirt and this goal was abandoned when people left. I think we should consider removing it as it adds unnecessary complexity.
Quoted 1 line
Thanks for telling the history behind it, agreed this is unnecessary, will remove in v7.
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
Also, you should add functional tests for the powernv11 machine.
See under tests/functional/test_ppc64_powernv.py.
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 13 lines · Cédric Le Goater
Quoted 12 lines · Aditya Gupta
Quoted 10 lines · Cédric Le Goater
Quoted 3 lines · Aditya Gupta
<...snip...>
+
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB);There was a lot of work done to have dynamic PHBs in the PowerNV machines. This was to add support in libvirt and this goal was abandoned when people left. I think we should consider removing it as it adds unnecessary complexity.
Quoted 6 lines
Quoted 1 line
Thanks for telling the history behind it, agreed this is unnecessary, will remove in v7.
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
I tried some variations of 'device_add/device_del'. Unable to see how to dynamically add/remove phbs.
Do you have any options to device_add/del which I can try, I want to see if the dynamic addition/removal of PHB changes if i remove that '_allow_dynamic_sysbus_dev' call.
Quoted 4 lines
Also, you should add functional tests for the powernv11 machine.
See under
tests/functional/test_ppc64_powernv.py.
Currently the test uses op-build kernels, which don't support Power11, working on that side, will post as soon as op-build creates a new release with p11 support (any linux >= 6.9).
Thanks,
- Aditya Gupta
Quoted 5 lines
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 15 lines · Aditya Gupta
Quoted 13 lines · Cédric Le Goater
Quoted 12 lines · Aditya Gupta
Quoted 10 lines · Cédric Le Goater
Quoted 3 lines · Aditya Gupta
<...snip...>
+
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB);There was a lot of work done to have dynamic PHBs in the PowerNV machines. This was to add support in libvirt and this goal was abandoned when people left. I think we should consider removing it as it adds unnecessary complexity.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Thanks for telling the history behind it, agreed this is unnecessary, will remove in v7.
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
I tried some variations of 'device_add/device_del'. Unable to see how to dynamically add/remove phbs.
I don't think hotplug works, this would require FW support, only coldplug is supported : devices should be defined on the command line.
Quoted 9 lines
Do you have any options to device_add/del which I can try, I want to see if the dynamic addition/removal of PHB changes if i remove that '
_allow_dynamic_sysbus_dev' call.Quoted 4 lines
Also, you should add functional tests for the powernv11 machine.
See under
tests/functional/test_ppc64_powernv.py.Currently the test uses op-build kernels, which don't support Power11, working on that side, will post as soon as op-build creates a new release with p11 support (any linux >= 6.9).
And is that planned ? I doubt it since open-power boxes are out of business.
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
[ ... ]
Quoted 3 lines
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
Images pushed here :
https://github.com/legoater/qemu-ppc-boot/tree/main/buildroot/qemu_ppc64le_powernv8-2025.02
qemu-system-ppc64 -m 1G -M powernv10 \
-kernel ./buildroot/qemu_ppc64le_powernv8-2025.02/vmlinux \
-append root=/dev/nvme0n1 \
-device nvme,bus=pcie.2,addr=0x0,drive=drive0,serial=1234 \
-drive file=./buildroot/qemu_ppc64le_powernv8-2025.02/rootfs.ext2,if=none,id=drive0,format=raw,cache=none \
-device e1000e,bus=pcie.1,addr=0x0,netdev=net0 \
-netdev user,id=net0 \
-serial mon:stdio -nographic -snapshot [ 0.010515922,5] OPAL v7.1-106-g785a5e307 starting...
...
[ 0.000000][ T0] Linux version 6.12.9 (legoater@ryzen) (powerpc64le-buildroot-linux-gnu-gcc.br_real (Buildroot 2025.02) 13.3.0, GNU ld (GNU Binutils) 2.43.1) #1 SMP Wed Mar 26 11:11:35 CET 2025 ...
Please use these images or the opbuild image which should also work but the CPU won't be recognized as a POWER11.
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 19 lines · Cédric Le Goater
[ ... ]
Quoted 3 lines
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
Images pushed here :
https://github.com/legoater/qemu-ppc-boot/tree/main/buildroot/qemu_ppc64le_powernv8-2025.02
qemu-system-ppc64 -m 1G -M powernv10 \
-kernel ./buildroot/qemu_ppc64le_powernv8-2025.02/vmlinux \
-append root=/dev/nvme0n1 \
-device nvme,bus=pcie.2,addr=0x0,drive=drive0,serial=1234 \
-drive file=./buildroot/qemu_ppc64le_powernv8-2025.02/rootfs.ext2,if=none,id=drive0,format=raw,cache=none \
-device e1000e,bus=pcie.1,addr=0x0,netdev=net0 \
-netdev user,id=net0 \
-serial mon:stdio -nographic -snapshot
Quoted 7 lines
[ 0.010515922,5] OPAL v7.1-106-g785a5e307 starting...
...
[ 0.000000][ T0] Linux version 6.12.9 (legoater@ryzen) (powerpc64le-buildroot-linux-gnu-gcc.br_real (Buildroot 2025.02) 13.3.0, GNU ld (GNU Binutils) 2.43.1) #1 SMP Wed Mar 26 11:11:35 CET 2025
...Please use these images or the opbuild image which should also work but the CPU won't be recognized as a POWER11.
Thank you, will use those images then.
opbuild image boots but since it doesn't "print" p11 in its dmesg log, the powernv test fails with it. Will use your images.
Thanks,
- Aditya Gupta
Quoted 5 lines
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
In reply to Cédric Le GoaterQuoted 8 lines · Cédric Le Goater
Quoted 7 lines · Aditya Gupta
<...snip...>
Quoted 4 lines · Cédric Le Goater
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
Quoted 5 lines
Quoted 1 line
I tried some variations of 'device_add/device_del'. Unable to see how to dynamically add/remove phbs.
I don't think hotplug works, this would require FW support, only coldplug is supported : devices should be defined on the command line.
Got it. Thanks for mentioning this, found a bug in my patch:
$ ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial mon:stdio -device pnv-phb -device pnv-phb-root-port <$QEMU_DIR>/include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object 0x564afddb5e00 is not an instance of type pnv10-chip [1] 1253963 IOT instruction (core dumped) ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial -devic
Happens due to 'pnv_pec_add_phb' assuming phb5 to be related to pnv10:
if (phb->version == 4) {
Pnv9Chip *chip9 = PNV9_CHIP(chip);
pecs = chip9->pecs;
} else if (phb->version == 5) {
Pnv10Chip *chip10 = PNV10_CHIP(chip);
pecs = chip10->pecs;
}
Top of my mind, hacky ways come up to differentiate Pnv11Chip and Pnv10Chip, other (still hacky) might be to add "pecs" as a property to the chip objects and get it that way, still feels hacky.
Can't pass extra args (pecs) to the function, without handling this pnv10 vs pnv11 in the callers.
Is adding a callback to PnvChipClass->get_pecs a good idea, similar to xive callbacks on the chipclass ?
Will think of alternate ways. Thanks.
Quoted 9 lines
Quoted 9 lines
Do you have any options to device_add/del which I can try, I want to see if the dynamic addition/removal of PHB changes if i remove that '
_allow_dynamic_sysbus_dev' call.Quoted 4 lines
Also, you should add functional tests for the powernv11 machine.
See under
tests/functional/test_ppc64_powernv.py.
Quoted 9 lines
Quoted 1 line
Currently the test uses op-build kernels, which don't support Power11, working on that side, will post as soon as op-build creates a new release with p11 support (any linux >= 6.9).
And is that planned ? I doubt it since open-power boxes are out of business.
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
I was thinking there should be. I will ask.
Thanks,
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 34 lines · Aditya Gupta
Quoted 8 lines · Cédric Le Goater
Quoted 7 lines · Aditya Gupta
<...snip...>
Quoted 4 lines · Cédric Le Goater
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
Quoted 5 lines
Quoted 1 line
I tried some variations of 'device_add/device_del'. Unable to see how to dynamically add/remove phbs.
I don't think hotplug works, this would require FW support, only coldplug is supported : devices should be defined on the command line.
Got it. Thanks for mentioning this, found a bug in my patch:
$ ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial mon:stdio -device pnv-phb -device pnv-phb-root-port <$QEMU_DIR>/include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object 0x564afddb5e00 is not an instance of type pnv10-chip [1] 1253963 IOT instruction (core dumped) ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial -devicHappens due to '
pnv_pec_add_phb' assuming phb5 to be related to pnv10:if (
phb->version== 4) {
Pnv9Chip *chip9 =PNV9_CHIP(chip);pecs =
chip9->pecs;
} else if (phb->version== 5) {
Pnv10Chip *chip10 =PNV10_CHIP(chip);
Quoted 6 lines
pecs =
chip10->pecs;
}Top of my mind, hacky ways come up to differentiate Pnv11Chip and Pnv10Chip, other (still hacky) might be to add "pecs" as a property to the chip objects and get it that way, still feels hacky.
The pnv-phb and pnv-phb-root-port devices introduced too much complexity for an unused feature. It is time to step back and deprecate.
The segfault on P11 should be fixed. Failing gracefully is OK.
Thanks,
C.
Quoted 37 lines
Can't pass extra args (pecs) to the function, without handling this pnv10 vs pnv11 in the callers.
Is adding a callback to
PnvChipClass->get_pecsa good idea, similar to xive callbacks on the chipclass ?Will think of alternate ways. Thanks.
Quoted 9 lines
Quoted 9 lines
Do you have any options to device_add/del which I can try, I want to see if the dynamic addition/removal of PHB changes if i remove that '
_allow_dynamic_sysbus_dev' call.Quoted 4 lines
Also, you should add functional tests for the powernv11 machine.
See under
tests/functional/test_ppc64_powernv.py.Quoted 9 lines
Quoted 1 line
Currently the test uses op-build kernels, which don't support Power11, working on that side, will post as soon as op-build creates a new release with p11 support (any linux >= 6.9).
And is that planned ? I doubt it since open-power boxes are out of business.
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
I was thinking there should be. I will ask.
Thanks,
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
Re: [PATCH v6 07/10] ppc/pnv: Introduce Power11 PowerNV machine
Quoted 39 lines · Cédric Le Goater
Quoted 38 lines · Aditya Gupta
Quoted 8 lines · Cédric Le Goater
Quoted 7 lines · Aditya Gupta
<...snip...>
Quoted 4 lines · Cédric Le Goater
One nice about it IIRC was being able to tune the number of PHBs per chip, which reduced booting time (for 16s) and also provided support to test various chip configs. Check that first.
Quoted 5 lines
Quoted 1 line
I tried some variations of 'device_add/device_del'. Unable to see how to dynamically add/remove phbs.
I don't think hotplug works, this would require FW support, only coldplug is supported : devices should be defined on the command line.
Got it. Thanks for mentioning this, found a bug in my patch:
$ ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial mon:stdio -device pnv-phb -device pnv-phb-root-port <$QEMU_DIR>/include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object 0x564afddb5e00 is not an instance of type pnv10-chip [1] 1253963 IOT instruction (core dumped) ./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial -devicHappens due to '
pnv_pec_add_phb' assuming phb5 to be related to pnv10:if (
phb->version== 4) {
Pnv9Chip *chip9 =PNV9_CHIP(chip);pecs =
chip9->pecs;
} else if (phb->version== 5) {
Pnv10Chip *chip10 =PNV10_CHIP(chip);pecs =
chip10->pecs;
}
Quoted 8 lines
Quoted 2 lines
Top of my mind, hacky ways come up to differentiate Pnv11Chip and Pnv10Chip, other (still hacky) might be to add "pecs" as a property to the chip objects and get it that way, still feels hacky.
The pnv-phb and pnv-phb-root-port devices introduced too much complexity for an unused feature. It is time to step back and deprecate.
The segfault on P11 should be fixed. Failing gracefully is OK.
Sure Cedric, for now I have removed the dynamic phbs in powernv11, so it fails like this:
./build/qemu-system-ppc64 -nographic -M powernv11 -nodefaults -serial mon:stdio -device pnv-phb -device pnv-phb-root-port
qemu-system-ppc64: -device pnv-phb: Parameter 'driver' expects a dynamic sysbus device type for the machine
Regarding deprecating for p10, don't know, as you said it gave benefits in power10 bringup, maybe since it's working for power10 it might keep it. I haven't personally needed it though.
Thanks,
- Aditya Gupta
Quoted 47 lines
Thanks,
C.
Quoted 37 lines
Can't pass extra args (pecs) to the function, without handling this pnv10 vs pnv11 in the callers.
Is adding a callback to
PnvChipClass->get_pecsa good idea, similar to xive callbacks on the chipclass ?Will think of alternate ways. Thanks.
Quoted 9 lines
Quoted 9 lines
Do you have any options to device_add/del which I can try, I want to see if the dynamic addition/removal of PHB changes if i remove that '
_allow_dynamic_sysbus_dev' call.Quoted 4 lines
Also, you should add functional tests for the powernv11 machine.
See under
tests/functional/test_ppc64_powernv.py.Quoted 9 lines
Quoted 1 line
Currently the test uses op-build kernels, which don't support Power11, working on that side, will post as soon as op-build creates a new release with p11 support (any linux >= 6.9).
And is that planned ? I doubt it since open-power boxes are out of business.
You could use a buildroot image instead. :
https://github.com/buildroot/buildroot/blob/master/configs/qemu_ppc64le_powernv8_defconfig
I was thinking there should be. I will ask.
Thanks,
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
PATCH v6 8/10 ppc/pnv: Add XIVE2 controller to Power11
In reply to Aditya GuptaAdd a XIVE2 controller to Power11 chip and machine. The controller has the same logic as Power10.
--- hw/ppc/pnv.c | 132 ++++++++++++++++++++++++++++++++++++++++++- include/hw/ppc/pnv.h | 18 ++++++ 2 files changed, 149 insertions(+), 1 deletion(-)
hw/ppc/pnv.c +131 -1
@@ -972,6 +972,7 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf)Pnv11Chip *chip11 =PNV11_CHIP (chip);pnv_psi_pic_print_info (&chip11->psi, buf); +pnv_xive2_pic_print_info (&chip11->xive, buf); }/* Always give the first 1GB to chip 0 else we won't boot */
@@ -1481,6 +1482,50 @@ static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,xive_tctx_pic_print_info (XIVE_TCTX (pnv_cpu_state (cpu)->intc), buf); } +static void pnv_chip_power11_intc_create (PnvChip *chip,PowerPCCPU *cpu, +Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +Error *local_err =NULL ; +Object *obj; +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +/* +* The core creates its interrupt presenter but the XIVE2 interrupt +* controller object is initialized afterwards. Hopefully, it's +* only used at runtime. +*/ + obj =xive_tctx_create (OBJECT (cpu),XIVE_PRESENTER (&chip11->xive), + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + + pnv_cpu->intc = obj; +} + +static void pnv_chip_power11_intc_reset (PnvChip *chip,PowerPCCPU *cpu) +{ +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +xive_tctx_reset (XIVE_TCTX (pnv_cpu->intc)); +} + +static void pnv_chip_power11_intc_destroy (PnvChip *chip,PowerPCCPU *cpu) +{ +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +xive_tctx_destroy (XIVE_TCTX (pnv_cpu->intc)); + pnv_cpu->intc =NULL ; +} + +static void pnv_chip_power11_intc_print_info (PnvChip *chip,PowerPCCPU *cpu, +GString *buf) +{ +xive_tctx_pic_print_info (XIVE_TCTX (pnv_cpu_state (cpu)->intc), buf); +} +/* * Allowed core identifiers on a POWER8 Processor Chip : *
@@ -2334,6 +2379,9 @@ static void pnv_chip_power11_instance_init(Object *obj)object_initialize_child (obj,"adu" , &chip11->adu,TYPE_PNV_ADU );object_initialize_child (obj,"psi" , &chip11->psi,TYPE_PNV11_PSI ); +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,"lpc" , &chip11->lpc,TYPE_PNV11_LPC );object_initialize_child (obj,"occ" , &chip11->occ,TYPE_PNV11_OCC );object_initialize_child (obj,"sbe" , &chip11->sbe,TYPE_PNV11_SBE );
@@ -2405,11 +2453,33 @@ static void pnv_chip_power11_realize(DeviceState *dev, Error **errp)return ; } -/* WIP: XIVE added in future patch */ +/* XIVE2 interrupt controller */ +object_property_set_int (OBJECT (&chip11->xive),"ic-bar" , +PNV11_XIVE2_IC_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"esb-bar" , +PNV11_XIVE2_ESB_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"end-bar" , +PNV11_XIVE2_END_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"nvpg-bar" , +PNV11_XIVE2_NVPG_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"nvc-bar" , +PNV11_XIVE2_NVC_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"tm-bar" , +PNV11_XIVE2_TM_BASE (chip), &error_fatal); +object_property_set_link (OBJECT (&chip11->xive),"chip" ,OBJECT (chip), + &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&chip11->xive), errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_XIVE2_BASE , + &chip11->xive.xscom_regs);/* Processor Service Interface (PSI) Host Bridge */ object_property_set_int (OBJECT (&chip11->psi),"bar" ,PNV11_PSIHB_BASE (chip), &error_fatal); +/* PSI can be configured to use 64k ESB pages on POWER11 */ +object_property_set_int (OBJECT (&chip11->psi),"shift" ,XIVE_ESB_64K , + &error_fatal);if (!qdev_realize (DEVICE (&chip11->psi),NULL , errp)) {return ; }
@@ -2604,6 +2674,10 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, void *data) 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_power11_intc_create; + k->intc_reset = pnv_chip_power11_intc_reset; + k->intc_destroy = pnv_chip_power11_intc_destroy; + k->intc_print_info = pnv_chip_power11_intc_print_info; k->isa_create = pnv_chip_power11_isa_create; k->dt_populate = pnv_chip_power11_dt_populate; k->pic_print_info = pnv_chip_power11_pic_print_info;
@@ -2972,6 +3046,54 @@ static int pnv10_xive_broadcast(XiveFabric *xfb,return 0 ; } +static int pnv11_xive_match_nvt (XiveFabric *xfb,uint8_t format, +uint8_t nvt_blk,uint32_t nvt_idx, +bool crowd,bool cam_ignore,uint8_t priority, +uint32_t logic_serv, +XiveTCTXMatch *match) +{ +PnvMachineState *pnv =PNV_MACHINE (xfb); +int total_count =0 ; +int i; + +for (i =0 ; i < pnv->num_chips; i++) { +Pnv11Chip *chip11 =PNV11_CHIP (pnv->chips[i]); +XivePresenter *xptr =XIVE_PRESENTER (&chip11->xive); +XivePresenterClass *xpc =XIVE_PRESENTER_GET_CLASS (xptr); +int count; + + count = xpc->match_nvt (xptr, format, nvt_blk, nvt_idx, crowd, + cam_ignore, priority, logic_serv, match); + +if (count <0 ) { +return count; + } + + total_count += count; + } + +return total_count; +} + +static int pnv11_xive_broadcast (XiveFabric *xfb, +uint8_t nvt_blk,uint32_t nvt_idx, +bool crowd,bool cam_ignore, +uint8_t priority) +{ +PnvMachineState *pnv =PNV_MACHINE (xfb); +int i; + +for (i =0 ; i < pnv->num_chips; i++) { +Pnv11Chip *chip11 =PNV11_CHIP (pnv->chips[i]); +XivePresenter *xptr =XIVE_PRESENTER (&chip11->xive); +XivePresenterClass *xpc =XIVE_PRESENTER_GET_CLASS (xptr); + + xpc->broadcast (xptr, nvt_blk, nvt_idx, crowd, cam_ignore, priority); + } +return 0 ; +} + +static bool pnv_machine_get_big_core (Object *obj,Error **errp) {PnvMachineState *pnv =PNV_MACHINE (obj);
@@ -3149,6 +3271,7 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data) {MachineClass *mc =MACHINE_CLASS (oc);PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc); +XiveFabricClass *xfc =XIVE_FABRIC_CLASS (oc);static const char compat[] ="qemu,powernv11\0ibm,powernv" ; pmc->compat = compat;
@@ -3158,6 +3281,9 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data) pmc->quirk_tb_big_core = true; pmc->dt_power_mgt = pnv_dt_power_mgt; + xfc->match_nvt = pnv11_xive_match_nvt; + xfc->broadcast = pnv11_xive_broadcast; +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); mc->desc ="IBM PowerNV (Non-Virtualized) Power11" ;
@@ -3293,6 +3419,10 @@ 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"),
include/hw/ppc/pnv.h +18 -0
@@ -270,6 +270,24 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor);#define PNV11_PSIHB_SIZE PNV10_PSIHB_SIZE#define PNV11_PSIHB_BASE (chip) PNV10_PSIHB_BASE(chip) +#define PNV11_XIVE2_IC_SIZE PNV10_XIVE2_IC_SIZE +#define PNV11_XIVE2_IC_BASE (chip) PNV10_XIVE2_IC_BASE(chip) + +#define PNV11_XIVE2_TM_SIZE PNV10_XIVE2_TM_SIZE +#define PNV11_XIVE2_TM_BASE (chip) PNV10_XIVE2_TM_BASE(chip) + +#define PNV11_XIVE2_NVC_SIZE PNV10_XIVE2_NVC_SIZE +#define PNV11_XIVE2_NVC_BASE (chip) PNV10_XIVE2_NVC_BASE(chip) + +#define PNV11_XIVE2_NVPG_SIZE PNV10_XIVE2_NVPG_SIZE +#define PNV11_XIVE2_NVPG_BASE (chip) PNV10_XIVE2_NVPG_BASE(chip) + +#define PNV11_XIVE2_ESB_SIZE PNV10_XIVE2_ESB_SIZE +#define PNV11_XIVE2_ESB_BASE (chip) PNV10_XIVE2_ESB_BASE(chip) + +#define PNV11_XIVE2_END_SIZE PNV10_XIVE2_END_SIZE +#define PNV11_XIVE2_END_BASE (chip) PNV10_XIVE2_END_BASE(chip) +#define PNV11_OCC_SENSOR_BASE (chip) PNV10_OCC_SENSOR_BASE(chip)#endif /* PPC_PNV_H */
Signature · 1 line
2.49.0
Re: [PATCH v6 08/10] ppc/pnv: Add XIVE2 controller to Power11
Quoted 9 lines · Aditya Gupta
Add a XIVE2 controller to Power11 chip and machine. The controller has the same logic as Power10.
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]>Signed-off-by Aditya Gupta <[email protected]>
LGTM,
Thanks,
C.
Quoted 237 lines
--- hw/ppc/pnv.c | 132 ++++++++++++++++++++++++++++++++++++++++++- include/hw/ppc/pnv.h | 18 ++++++ 2 files changed, 149 insertions(+), 1 deletion(-)hw/ppc/pnv.c +131
-1@@ -972,6 +972,7 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf)Pnv11Chip *chip11 =PNV11_CHIP (chip);pnv_psi_pic_print_info (&chip11->psi, buf); +pnv_xive2_pic_print_info (&chip11->xive, buf); }/* Always give the first 1GB to chip 0 else we won't boot */ @@ -1481,6 +1482,50 @@ static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,xive_tctx_pic_print_info (XIVE_TCTX (pnv_cpu_state (cpu)->intc), buf); } +static void pnv_chip_power11_intc_create (PnvChip *chip,PowerPCCPU *cpu, +Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +Error *local_err =NULL ; +Object *obj; +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +/* +* The core creates its interrupt presenter but the XIVE2 interrupt +* controller object is initialized afterwards. Hopefully, it's +* only used at runtime. +*/ + obj =xive_tctx_create (OBJECT (cpu),XIVE_PRESENTER (&chip11->xive), + &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + + pnv_cpu->intc = obj; +} + +static void pnv_chip_power11_intc_reset (PnvChip *chip,PowerPCCPU *cpu) +{ +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +xive_tctx_reset (XIVE_TCTX (pnv_cpu->intc)); +} + +static void pnv_chip_power11_intc_destroy (PnvChip *chip,PowerPCCPU *cpu) +{ +PnvCPUState *pnv_cpu =pnv_cpu_state (cpu); + +xive_tctx_destroy (XIVE_TCTX (pnv_cpu->intc)); + pnv_cpu->intc =NULL ; +} + +static void pnv_chip_power11_intc_print_info (PnvChip *chip,PowerPCCPU *cpu, +GString *buf) +{ +xive_tctx_pic_print_info (XIVE_TCTX (pnv_cpu_state (cpu)->intc), buf); +} +/* * Allowed core identifiers on a POWER8 Processor Chip : * @@ -2334,6 +2379,9 @@ static void pnv_chip_power11_instance_init(Object *obj)object_initialize_child (obj,"adu" , &chip11->adu,TYPE_PNV_ADU );object_initialize_child (obj,"psi" , &chip11->psi,TYPE_PNV11_PSI ); +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,"lpc" , &chip11->lpc,TYPE_PNV11_LPC );object_initialize_child (obj,"occ" , &chip11->occ,TYPE_PNV11_OCC );object_initialize_child (obj,"sbe" , &chip11->sbe,TYPE_PNV11_SBE );@@ -2405,11 +2453,33 @@ static void pnv_chip_power11_realize(DeviceState *dev, Error **errp)return ; } -/* WIP: XIVE added in future patch */ +/* XIVE2 interrupt controller */ +object_property_set_int (OBJECT (&chip11->xive),"ic-bar" , +PNV11_XIVE2_IC_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"esb-bar" , +PNV11_XIVE2_ESB_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"end-bar" , +PNV11_XIVE2_END_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"nvpg-bar" , +PNV11_XIVE2_NVPG_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"nvc-bar" , +PNV11_XIVE2_NVC_BASE (chip), &error_fatal); +object_property_set_int (OBJECT (&chip11->xive),"tm-bar" , +PNV11_XIVE2_TM_BASE (chip), &error_fatal); +object_property_set_link (OBJECT (&chip11->xive),"chip" ,OBJECT (chip), + &error_abort); +if (!sysbus_realize (SYS_BUS_DEVICE (&chip11->xive), errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_XIVE2_BASE , + &chip11->xive.xscom_regs);/* Processor Service Interface (PSI) Host Bridge */ object_property_set_int (OBJECT (&chip11->psi),"bar" ,PNV11_PSIHB_BASE (chip), &error_fatal); +/* PSI can be configured to use 64k ESB pages on POWER11 */ +object_property_set_int (OBJECT (&chip11->psi),"shift" ,XIVE_ESB_64K , + &error_fatal);if (!qdev_realize (DEVICE (&chip11->psi),NULL , errp)) {return ; }@@ -2604,6 +2674,10 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, void *data) 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_power11_intc_create; + k->intc_reset = pnv_chip_power11_intc_reset; + k->intc_destroy = pnv_chip_power11_intc_destroy; + k->intc_print_info = pnv_chip_power11_intc_print_info; k->isa_create = pnv_chip_power11_isa_create; k->dt_populate = pnv_chip_power11_dt_populate; k->pic_print_info = pnv_chip_power11_pic_print_info;@@ -2972,6 +3046,54 @@ static int pnv10_xive_broadcast(XiveFabric *xfb,return 0 ; } +static int pnv11_xive_match_nvt (XiveFabric *xfb,uint8_t format, +uint8_t nvt_blk,uint32_t nvt_idx, +bool crowd,bool cam_ignore,uint8_t priority, +uint32_t logic_serv, +XiveTCTXMatch *match) +{ +PnvMachineState *pnv =PNV_MACHINE (xfb); +int total_count =0 ; +int i; + +for (i =0 ; i < pnv->num_chips; i++) { +Pnv11Chip *chip11 =PNV11_CHIP (pnv->chips[i]); +XivePresenter *xptr =XIVE_PRESENTER (&chip11->xive); +XivePresenterClass *xpc =XIVE_PRESENTER_GET_CLASS (xptr); +int count; + + count = xpc->match_nvt (xptr, format, nvt_blk, nvt_idx, crowd, + cam_ignore, priority, logic_serv, match); + +if (count <0 ) { +return count; + } + + total_count += count; + } + +return total_count; +} + +static int pnv11_xive_broadcast (XiveFabric *xfb, +uint8_t nvt_blk,uint32_t nvt_idx, +bool crowd,bool cam_ignore, +uint8_t priority) +{ +PnvMachineState *pnv =PNV_MACHINE (xfb); +int i; + +for (i =0 ; i < pnv->num_chips; i++) { +Pnv11Chip *chip11 =PNV11_CHIP (pnv->chips[i]); +XivePresenter *xptr =XIVE_PRESENTER (&chip11->xive); +XivePresenterClass *xpc =XIVE_PRESENTER_GET_CLASS (xptr); + + xpc->broadcast (xptr, nvt_blk, nvt_idx, crowd, cam_ignore, priority); + } +return 0 ; +} + +static bool pnv_machine_get_big_core (Object *obj,Error **errp) {PnvMachineState *pnv =PNV_MACHINE (obj);@@ -3149,6 +3271,7 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data) {MachineClass *mc =MACHINE_CLASS (oc);PnvMachineClass *pmc =PNV_MACHINE_CLASS (oc); +XiveFabricClass *xfc =XIVE_FABRIC_CLASS (oc);static const char compat[] ="qemu,powernv11\0ibm,powernv" ; pmc->compat = compat;@@ -3158,6 +3281,9 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data) pmc->quirk_tb_big_core = true; pmc->dt_power_mgt = pnv_dt_power_mgt; + xfc->match_nvt = pnv11_xive_match_nvt; + xfc->broadcast = pnv11_xive_broadcast; +machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB ); mc->desc ="IBM PowerNV (Non-Virtualized) Power11" ;@@ -3293,6 +3419,10 @@ 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"),include/hw/ppc/pnv.h +18
-0@@ -270,6 +270,24 @@ void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor);#define PNV11_PSIHB_SIZE PNV10_PSIHB_SIZE#define PNV11_PSIHB_BASE (chip) PNV10_PSIHB_BASE(chip) +#define PNV11_XIVE2_IC_SIZE PNV10_XIVE2_IC_SIZE +#define PNV11_XIVE2_IC_BASE (chip) PNV10_XIVE2_IC_BASE(chip) + +#define PNV11_XIVE2_TM_SIZE PNV10_XIVE2_TM_SIZE +#define PNV11_XIVE2_TM_BASE (chip) PNV10_XIVE2_TM_BASE(chip) + +#define PNV11_XIVE2_NVC_SIZE PNV10_XIVE2_NVC_SIZE +#define PNV11_XIVE2_NVC_BASE (chip) PNV10_XIVE2_NVC_BASE(chip) + +#define PNV11_XIVE2_NVPG_SIZE PNV10_XIVE2_NVPG_SIZE +#define PNV11_XIVE2_NVPG_BASE (chip) PNV10_XIVE2_NVPG_BASE(chip) + +#define PNV11_XIVE2_ESB_SIZE PNV10_XIVE2_ESB_SIZE +#define PNV11_XIVE2_ESB_BASE (chip) PNV10_XIVE2_ESB_BASE(chip) + +#define PNV11_XIVE2_END_SIZE PNV10_XIVE2_END_SIZE +#define PNV11_XIVE2_END_BASE (chip) PNV10_XIVE2_END_BASE(chip) +#define PNV11_OCC_SENSOR_BASE (chip) PNV10_OCC_SENSOR_BASE(chip)#endif /* PPC_PNV_H */
Re: [PATCH v6 08/10] ppc/pnv: Add XIVE2 controller to Power11
Quoted 12 lines · Cédric Le Goater
Quoted 9 lines · Aditya Gupta
Add a XIVE2 controller to Power11 chip and machine. The controller has the same logic as Power10.
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]>Signed-off-by Aditya Gupta <[email protected]>
Quoted 5 lines
LGTM,
Reviewed-by Cédric Le Goater <[email protected]>
Thanks for so many reviews and the tag Cédric.
- Aditya Gupta
Quoted 4 lines
Thanks,
C.
PATCH v6 9/10 ppc/pnv: Add PHB5 PCIe Host bridge to Power11
In reply to Aditya GuptaPower11 also uses PHB5, same as Power10.
Add Power11 PHBs with similar code as the corresponding Power10 implementation.
--- hw/ppc/pnv.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-)
hw/ppc/pnv.c +56 -1
@@ -973,6 +973,8 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf)pnv_psi_pic_print_info (&chip11->psi, buf);pnv_xive2_pic_print_info (&chip11->xive, buf); +object_child_foreach_recursive (OBJECT (chip), + pnv_chip_power9_pic_print_info_child, buf); }/* Always give the first 1GB to chip 0 else we won't boot */
@@ -2373,6 +2375,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)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;
@@ -2389,6 +2392,13 @@ static void pnv_chip_power11_instance_init(Object *obj)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 ); }
@@ -2421,6 +2431,38 @@ static void pnv_chip_power11_quad_realize(Pnv11Chip *chip11, Error **errp) } } +static void pnv_chip_power11_phb_realize (PnvChip *chip,Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +int i; + +for (i =0 ; i < chip->num_pecs; i++) { +PnvPhb4PecState *pec = &chip11->pecs[i]; +PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (pec); +uint32_t pec_cplt_base; +uint32_t pec_nest_base; +uint32_t pec_pci_base; + +object_property_set_int (OBJECT (pec),"index" , i, &error_fatal); +object_property_set_int (OBJECT (pec),"chip-id" , chip->chip_id, + &error_fatal); +object_property_set_link (OBJECT (pec),"chip" ,OBJECT (chip), + &error_fatal); +if (!qdev_realize (DEVICE (pec),NULL , errp)) { +return ; + } + + pec_cplt_base = pecc->xscom_cplt_base (pec); + pec_nest_base = pecc->xscom_nest_base (pec); + pec_pci_base = pecc->xscom_pci_base (pec); + +pnv_xscom_add_subregion (chip, pec_cplt_base, + &pec->nest_pervasive.xscom_ctrl_regs_mr); +pnv_xscom_add_subregion (chip, pec_nest_base, &pec->nest_regs_mr); +pnv_xscom_add_subregion (chip, pec_pci_base, &pec->pci_regs_mr); + } +} +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev);
@@ -2550,7 +2592,12 @@ static void pnv_chip_power11_realize(DeviceState *dev, Error **errp)pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_ES_BASE , &chip11->n1_chiplet.xscom_pb_es_mr); -/* WIP: PHB added in future patch */ +/* PHBs */ +pnv_chip_power11_phb_realize (chip, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }/* * I2C
@@ -2684,6 +2731,7 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, void *data) k->xscom_core_base = pnv_chip_power11_xscom_core_base; k->xscom_pcba = pnv_chip_power11_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;
@@ -3274,6 +3322,13 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data)XiveFabricClass *xfc =XIVE_FABRIC_CLASS (oc);static const char compat[] ="qemu,powernv11\0ibm,powernv" ; +static GlobalProperty phb_compat[] = { + {TYPE_PNV_PHB ,"version" ,"5" }, + {TYPE_PNV_PHB_ROOT_PORT ,"version" ,"5" }, + }; + +compat_props_add (mc->compat_props, phb_compat,G_N_ELEMENTS (phb_compat)); + pmc->compat = compat; pmc->compat_size =sizeof (compat); pmc->max_smt_threads =4 ;
Signature · 1 line
2.49.0
Re: [PATCH v6 09/10] ppc/pnv: Add PHB5 PCIe Host bridge to Power11
Quoted 10 lines · Aditya Gupta
Power11 also uses PHB5, same as Power10.
Add Power11 PHBs with similar code as the corresponding Power10 implementation.
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]>Signed-off-by Aditya Gupta <[email protected]>
LGTM,
Thanks,
C.
Quoted 114 lines
--- hw/ppc/pnv.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-)hw/ppc/pnv.c +56
-1@@ -973,6 +973,8 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf)pnv_psi_pic_print_info (&chip11->psi, buf);pnv_xive2_pic_print_info (&chip11->xive, buf); +object_child_foreach_recursive (OBJECT (chip), + pnv_chip_power9_pic_print_info_child, buf); }/* Always give the first 1GB to chip 0 else we won't boot */ @@ -2373,6 +2375,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)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;@@ -2389,6 +2392,13 @@ static void pnv_chip_power11_instance_init(Object *obj)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 ); }@@ -2421,6 +2431,38 @@ static void pnv_chip_power11_quad_realize(Pnv11Chip *chip11, Error **errp) } } +static void pnv_chip_power11_phb_realize (PnvChip *chip,Error **errp) +{ +Pnv11Chip *chip11 =PNV11_CHIP (chip); +int i; + +for (i =0 ; i < chip->num_pecs; i++) { +PnvPhb4PecState *pec = &chip11->pecs[i]; +PnvPhb4PecClass *pecc =PNV_PHB4_PEC_GET_CLASS (pec); +uint32_t pec_cplt_base; +uint32_t pec_nest_base; +uint32_t pec_pci_base; + +object_property_set_int (OBJECT (pec),"index" , i, &error_fatal); +object_property_set_int (OBJECT (pec),"chip-id" , chip->chip_id, + &error_fatal); +object_property_set_link (OBJECT (pec),"chip" ,OBJECT (chip), + &error_fatal); +if (!qdev_realize (DEVICE (pec),NULL , errp)) { +return ; + } + + pec_cplt_base = pecc->xscom_cplt_base (pec); + pec_nest_base = pecc->xscom_nest_base (pec); + pec_pci_base = pecc->xscom_pci_base (pec); + +pnv_xscom_add_subregion (chip, pec_cplt_base, + &pec->nest_pervasive.xscom_ctrl_regs_mr); +pnv_xscom_add_subregion (chip, pec_nest_base, &pec->nest_regs_mr); +pnv_xscom_add_subregion (chip, pec_pci_base, &pec->pci_regs_mr); + } +} +static void pnv_chip_power11_realize (DeviceState *dev,Error **errp) {PnvChipClass *pcc =PNV_CHIP_GET_CLASS (dev);@@ -2550,7 +2592,12 @@ static void pnv_chip_power11_realize(DeviceState *dev, Error **errp)pnv_xscom_add_subregion (chip,PNV11_XSCOM_N1_PB_SCOM_ES_BASE , &chip11->n1_chiplet.xscom_pb_es_mr); -/* WIP: PHB added in future patch */ +/* PHBs */ +pnv_chip_power11_phb_realize (chip, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + }/* * I2C @@ -2684,6 +2731,7 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, void *data) k->xscom_core_base = pnv_chip_power11_xscom_core_base; k->xscom_pcba = pnv_chip_power11_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;@@ -3274,6 +3322,13 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, void *data)XiveFabricClass *xfc =XIVE_FABRIC_CLASS (oc);static const char compat[] ="qemu,powernv11\0ibm,powernv" ; +static GlobalProperty phb_compat[] = { + {TYPE_PNV_PHB ,"version" ,"5" }, + {TYPE_PNV_PHB_ROOT_PORT ,"version" ,"5" }, + }; + +compat_props_add (mc->compat_props, phb_compat,G_N_ELEMENTS (phb_compat)); + pmc->compat = compat; pmc->compat_size =sizeof (compat); pmc->max_smt_threads =4 ;
PATCH v6 10/10 ppc/pnv: Add ChipTOD model for Power11
In reply to Aditya GuptaIntroduce Power11 ChipTod. The code has been copied from Power10 ChipTod code as the Power11 core is same as Power10 core.
--- hw/ppc/pnv.c | 15 +++++++++ hw/ppc/pnv_chiptod.c | 59 ++++++++++++++++++++++++++++++++++++ include/hw/ppc/pnv_chiptod.h | 2 ++ 3 files changed, 76 insertions(+)
hw/ppc/pnv.c +15 -0
@@ -2386,6 +2386,8 @@ static void pnv_chip_power11_instance_init(Object *obj)object_property_add_alias (obj,"xive-fabric" ,OBJECT (&chip11->xive),"xive-fabric" );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 );
@@ -2539,6 +2541,19 @@ static void pnv_chip_power11_realize(DeviceState *dev, Error **errp) chip->dt_isa_nodename =g_strdup_printf ("/lpcm-opb@%" PRIx64"/lpc@0" , (uint64_t )PNV11_LPCM_BASE (chip)); +/* ChipTOD */ +object_property_set_bool (OBJECT (&chip11->chiptod),"primary" , + chip->chip_id ==0 , &error_abort); +object_property_set_bool (OBJECT (&chip11->chiptod),"secondary" , + chip->chip_id ==1 , &error_abort); +object_property_set_link (OBJECT (&chip11->chiptod),"chip" ,OBJECT (chip), + &error_abort); +if (!qdev_realize (DEVICE (&chip11->chiptod),NULL , errp)) { +return ; + } +pnv_xscom_add_subregion (chip,PNV11_XSCOM_CHIPTOD_BASE , + &chip11->chiptod.xscom_regs); +/* HOMER (must be created before OCC) */ object_property_set_link (OBJECT (&chip11->homer),"chip" ,OBJECT (chip), &error_abort);
hw/ppc/pnv_chiptod.c +59 -0
83 lines not on this page · raw message
include/hw/ppc/pnv_chiptod.h +2 -0
@@ -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.49.0