Power11 support for QEMU [PowerNV]
v9 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-v9
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
Changelog
=========
v9:
+ [PATCH 1/7]: apply hunks from commit cf0eb929e59cb, and commit 24c8fa968a6d8, for changes that were done for Power10, as those changes make sense for Power11 also
+ [PATCH 3/7]: fixed build breakage identified with QEMU CI, due to changes in upstream function pointer types
v8:
+ rebase to upstream
+ propose myself as a powernv reviewer
v7 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ use Power10 models of homer, sbe, occ, psi, lpc. As they are same.
+ switch powernv tests to use buildroot images instead of op-build images
+ add functional test for powernv11
- remove dynamic sysbus device for PHBs, so no more dynamic number of PHBs in Power11 as it became complex to handle it and not much used
v6 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ 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 (7):
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 tests/powernv: Switch to buildroot images instead of op-build tests/powernv: Add PowerNV test for Power11
docs/system/ppc/powernv.rst | 9 +- hw/ppc/pnv.c | 540 +++++++++++++++++++++++++ hw/ppc/pnv_chiptod.c | 59 +++ hw/ppc/pnv_core.c | 17 + include/hw/ppc/pnv.h | 38 ++ include/hw/ppc/pnv_chip.h | 7 + include/hw/ppc/pnv_chiptod.h | 2 + include/hw/ppc/pnv_xscom.h | 49 +++ tests/functional/test_ppc64_powernv.py | 34 +- 9 files changed, 737 insertions(+), 18 deletions(-)
Signature · 1 line
2.50.1
PATCH v9 1/7 ppc/pnv: Introduce Pnv11Chip
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.
--- hw/ppc/pnv.c | 317 +++++++++++++++++++++++++++++++++++++ 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, 410 insertions(+)
hw/ppc/pnv.c +317 -0
@@ -490,6 +490,37 @@ 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 (pnv_core->big_core) { + i++;/* Big-core groups two QEMU cores */ + } + } + +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 +853,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 +936,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 +971,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 +1515,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 +2330,211 @@ 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 ); + +/* +* Use Power10 device models for PSI/LPC/OCC/SBE/HOMER as corresponding +* device models for Power11 are same +*/ +object_initialize_child (obj,"psi" , &chip11->psi,TYPE_PNV10_PSI ); +object_initialize_child (obj,"lpc" , &chip11->lpc,TYPE_PNV10_LPC ); +object_initialize_child (obj,"occ" , &chip11->occ,TYPE_PNV10_OCC ); +object_initialize_child (obj,"sbe" , &chip11->sbe,TYPE_PNV10_SBE ); +object_initialize_child (obj,"homer" , &chip11->homer,TYPE_PNV10_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); +/* 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 ; + } +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;
@@ -2329,6 +2600,34 @@ static void pnv_chip_power10_class_init(ObjectClass *klass, const void *data) &k->parent_realize); } +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_power11_class_init (ObjectClass *klass,const 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) {
@@ -2947,6 +3246,13 @@ static void pnv_machine_class_init(ObjectClass *oc, const 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" ),
@@ -3002,6 +3308,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, const void *data) pcc->xscom_size =PNV10_XSCOM_EC_SIZE ; } +static void pnv_core_power11_class_init (ObjectClass *oc,const void *data) +{ +pnv_core_power10_class_init (oc, data); +} +static void pnv_core_class_init (ObjectClass *oc,const 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, const void *data) pqc->xscom_qme_size =PNV10_XSCOM_QME_SIZE ; } +static void pnv_quad_power11_class_init (ObjectClass *oc,const void *data) +{ +/* Power11 quad is similar to Power10 quad */ +pnv_quad_power10_class_init (oc, data); +} +static void pnv_quad_class_init (ObjectClass *oc,const 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.50.1
PATCH v9 2/7 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
Note: A difference from P10's and P11's machine_class_init is, in P11 different number of PHBs cannot be used on the command line, ie. the following line does NOT exist in pnv_machine_power11_class_init, which existed in case of Power10:
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB);
--- docs/system/ppc/powernv.rst | 9 +++++---- hw/ppc/pnv.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 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 +34 -0
@@ -3141,6 +3141,35 @@ static void pnv_machine_p10_rainier_class_init(ObjectClass *oc, pmc->i2c_init = pnv_rainier_i2c_init; } +static void pnv_machine_power11_class_init (ObjectClass *oc,const 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; + + 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);
@@ -3254,6 +3283,11 @@ static void pnv_machine_class_init(ObjectClass *oc, const 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.50.1
PATCH v9 3/7 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 | 121 ++++++++++++++++++++++++++++++++++++++++++- include/hw/ppc/pnv.h | 18 +++++++ 2 files changed, 138 insertions(+), 1 deletion(-)
hw/ppc/pnv.c +120 -1
@@ -975,6 +975,7 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf) {Pnv11Chip *chip11 =PNV11_CHIP (chip); +pnv_xive2_pic_print_info (&chip11->xive, buf);pnv_psi_pic_print_info (&chip11->psi, buf); }
@@ -1485,6 +1486,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 : *
@@ -2347,6 +2392,10 @@ static void pnv_chip_power11_instance_init(Object *obj)object_initialize_child (obj,"occ" , &chip11->occ,TYPE_PNV10_OCC );object_initialize_child (obj,"sbe" , &chip11->sbe,TYPE_PNV10_SBE );object_initialize_child (obj,"homer" , &chip11->homer,TYPE_PNV10_HOMER ); + +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,"n1-chiplet" , &chip11->n1_chiplet,TYPE_PNV_N1_CHIPLET );
@@ -2414,7 +2463,26 @@ 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",
@@ -2615,6 +2683,10 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, const 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;
@@ -2967,6 +3039,45 @@ static int pnv10_xive_broadcast(XiveFabric *xfb,return 0 ; } +static bool 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 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->match_nvt (xptr, format, nvt_blk, nvt_idx, crowd, + cam_ignore, priority, logic_serv, match); + } + +return !!match->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);
@@ -3145,6 +3256,7 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, const 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;
@@ -3154,6 +3266,9 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, const 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; + mc->desc ="IBM PowerNV (Non-Virtualized) Power11" ; mc->default_cpu_type =POWERPC_CPU_TYPE_NAME ("power11_v2.0" );
@@ -3287,6 +3402,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.50.1
PATCH v9 4/7 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
@@ -977,6 +977,8 @@ static void pnv_chip_power11_pic_print_info(PnvChip *chip, GString *buf)pnv_xive2_pic_print_info (&chip11->xive, buf);pnv_psi_pic_print_info (&chip11->psi, 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 */
@@ -2377,6 +2379,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;
@@ -2399,6 +2402,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 ); }
@@ -2431,6 +2441,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);
@@ -2560,7 +2602,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
@@ -2693,6 +2740,7 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, const 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;
@@ -3259,6 +3307,13 @@ static void pnv_machine_power11_class_init(ObjectClass *oc, const 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.50.1
PATCH v9 5/7 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
@@ -2399,6 +2399,8 @@ static void pnv_chip_power11_instance_init(Object *obj)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,"chiptod" , &chip11->chiptod, +TYPE_PNV11_CHIPTOD );object_initialize_child (obj,"n1-chiplet" , &chip11->n1_chiplet,TYPE_PNV_N1_CHIPLET );
@@ -2549,6 +2551,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.50.1
PATCH v9 6/7 tests/powernv: Switch to buildroot images instead of op-build
In reply to Aditya GuptaAs op-build images haven't been updated from long time (and may not get updated in future), use buildroot images provided by cedric [1].
Use existing nvme device being used in the test to mount the initrd.
Also replace the check for "zImage loaded message" to skiboot's message when it starts the kernel: "Starting kernel at", since we are no longer using zImage from op-build
This is required for newer processor tests such as Power11, as the op-build kernel image is old and doesn't support Power11.
Power11 test has been added in a later patch.
[1]: https://github.com/legoater/qemu-ppc-boot/tree/main/buildroot/qemu_ppc64le_powernv8-2025.02
--- tests/functional/test_ppc64_powernv.py | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-)
tests/functional/test_ppc64_powernv.py +16 -14
@@ -18,9 +18,14 @@ class powernvMachine(LinuxKernelTest): good_message = 'VFS: Cannot open root device' ASSET_KERNEL = Asset( - ('https://archives.fedoraproject.org/pub/archive/fedora-secondary/' - 'releases/29/Everything/ppc64le/os/ppc/ppc64/vmlinuz'), - '383c2f5c23bc0d9d32680c3924d3fd7ee25cc5ef97091ac1aa5e1d853422fc5f') + ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/' + 'buildroot/qemu_ppc64le_powernv8-2025.02/vmlinux'), + '6fd29aff9ad4362511ea5d0acbb510667c7031928e97d64ec15bbc5daf4b8151') + + ASSET_INITRD = Asset( + ('https://github.com/legoater/qemu-ppc-boot/raw/refs/heads/main/' + 'buildroot/qemu_ppc64le_powernv8-2025.02/rootfs.ext2'), + 'aee2192b692077c4bde31cb56ce474424b358f17cec323d5c94af3970c9aada2') def do_test_linux_boot(self, command_line = KERNEL_COMMON_COMMAND_LINE): self.require_accelerator("tcg")
@@ -78,27 +83,24 @@ def test_linux_big_boot(self): wait_for_console_pattern(self, console_pattern, self.panic_message) wait_for_console_pattern(self, self.good_message, self.panic_message) - - ASSET_EPAPR_KERNEL = Asset( - ('https://github.com/open-power/op-build/releases/download/v2.7/' - 'zImage.epapr'), - '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd') - def do_test_ppc64_powernv(self, proc): self.require_accelerator("tcg") - kernel_path = self.ASSET_EPAPR_KERNEL.fetch() + kernel_path = self.ASSET_KERNEL.fetch() + initrd_path = self.ASSET_INITRD.fetch() self.vm.set_console() self.vm.add_args('-kernel', kernel_path, - '-append', 'console=tty0 console=hvc0', + '-drive', + f'file={initrd_path},format=raw,if=none,id=drive0,readonly=on', + '-append', 'root=/dev/nvme0n1 console=tty0 console=hvc0', '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0', - '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234', + '-device', 'nvme,drive=drive0,bus=pcie.2,addr=0x0,serial=1234', '-device', 'e1000e,bus=bridge1,addr=0x3', '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2') self.vm.launch() self.wait_for_console_pattern("CPU: " + proc + " generation processor") - self.wait_for_console_pattern("zImage starting: loaded") - self.wait_for_console_pattern("Run /init as init process") + self.wait_for_console_pattern("INIT: Starting kernel at ") + self.wait_for_console_pattern("Run /sbin/init as init process") # Device detection output driven by udev probing is sometimes cut off # from console output, suspect S14silence-console init script.
Signature · 1 line
2.50.1
PATCH v9 7/7 tests/powernv: Add PowerNV test for Power11
In reply to Aditya GuptaWith all Power11 support in place, add Power11 PowerNV test.
--- tests/functional/test_ppc64_powernv.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/functional/test_ppc64_powernv.py +4 -0
@@ -116,5 +116,9 @@ def test_powernv10(self): self.set_machine('powernv10') self.do_test_ppc64_powernv('P10') + def test_powernv11(self): + self.set_machine('powernv11') + self.do_test_ppc64_powernv('Power11') + if __name__ == '__main__': LinuxKernelTest.main()
Signature · 1 line
2.50.1
Quoted 90 lines · Aditya Gupta
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:
commit273db89bcaf4("ppc/pseries: Add Power11 cpu type")Git Tree for Testing
====================QEMU: https://github.com/adi-g15-ibm/qemu/tree/p11-powernv-v9
Has been tested with following cases:
* '-M powernv' / '-M powernv10' / '-M powernv11'
* '-smp' option testedskiboot 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
Changelog
=========
v9:
+ [PATCH 1/7]: apply hunks from commitcf0eb929e59cb, and commit24c8fa968a6d8, for changes that were done for Power10, as those changes make sense for Power11 also
+ [PATCH 3/7]: fixed build breakage identified with QEMU CI, due to changes in upstream function pointer typesv8:
+ rebase to upstream
+ propose myself as a powernv reviewerv7 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ use Power10 models of homer, sbe, occ, psi, lpc. As they are same.
+ switch powernv tests to use buildroot images instead of op-build images
+ add functional test for powernv11
- remove dynamic sysbus device for PHBs, so no more dynamic number of PHBs in Power11 as it became complex to handle it and not much usedv6 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ make Pnv11Chip's parent as PnvChip, instead of Pnv10Chip
+ rebase on upstream/masterv5 (https://lore.kernel.org/qemu-devel/[email protected]/):
+ add chiptod
+ addinstance_initfor P11 to use P11 models
+ move patch introducing Pnv11Chip to the last
+ update skiboot.lid to skiboot's upstream/masterv4:
+ patch #5: fix memory leak inpnv_chip_power10_quad_realize
- no change in other patchesv3:
+ 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: createpnv_chip_power11_dt_populateand splitpnv_chip_power10_common_realizeas per review
+ patch #6-#11: no change
- remove commit to make Power11 as defaultv2:
+ 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.lidAditya Gupta (7):
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 tests/powernv: Switch to buildroot images instead of op-build tests/powernv: Add PowerNV test for Power11
Quoted 11 lines
docs/system/ppc/powernv.rst | 9 +- hw/ppc/pnv.c | 540 +++++++++++++++++++++++++ hw/ppc/pnv_chiptod.c | 59 +++ hw/ppc/pnv_core.c | 17 + include/hw/ppc/pnv.h | 38 ++ include/hw/ppc/pnv_chip.h | 7 + include/hw/ppc/pnv_chiptod.h | 2 + include/hw/ppc/pnv_xscom.h | 49 +++ tests/functional/test_ppc64_powernv.py | 34 +- 9 files changed, 737 insertions(+), 18 deletions(-)
Booting a PowerNV11 machine crashes QEMU. See below.
Are you testing with petitboot kexecing a distro kernel from disk ? Please do and also start a KVM guest. Please check your tests.
Thanks,
C.
[ 6.806342] e1000e 0001:02:03.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000 [ 6.844448] e1000e 0001:02:03.0 enP1p2s3: renamed from eth0
../include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object 0x555556ab0cf0 is not an instance of type pnv10-chip
Thread 1 "qemu-system-ppc" received signal SIGABRT, Aborted.0x00007ffff6a8d02c in __pthread_kill_implementation () from /lib64/libc.so.6
Missing rpms, try: dnf --enablerepo='*debug*' install capstone-debuginfo-4.0.2-10.el9.x86_64 gnutls-debuginfo-3.8.3-9.el9.x86_64 pixman-debuginfo-0.40.0-6.el9.x86_64 zlib-debuginfo-1.2.11-40.el9.x86_64 lzo-debuginfo-2.10-7.el9.x86_64 SDL2-debuginfo-2.26.0-1.el9.x86_64 libpmem-debuginfo-1.12.1-1.el9.x86_64 libfdt-debuginfo-1.6.0-7.el9.x86_64 numactl-libs-debuginfo-2.0.19-1.el9.x86_64 glib2-debuginfo-2.68.4-16.el9_6.2.x86_64 libzstd-debuginfo-1.5.5-1.el9.x86_64 libslirp-debuginfo-4.4.0-8.el9.x86_64 elfutils-libs-debuginfo-0.193-1.el9.x86_64 ncurses-libs-debuginfo-6.2-12.20210508.el9.x86_64 usbredir-debuginfo-0.13.0-2.el9.x86_64 libusbx-debuginfo-1.0.26-1.el9.x86_64 glibc-debuginfo-2.34-221.el9.x86_64 p11-kit-debuginfo-0.25.3-3.el9.x86_64 libidn2-debuginfo-2.3.0-7.el9.x86_64 libunistring-debuginfo-0.9.10-15.el9.x86_64 libtasn1-debuginfo-4.16.0-9.el9.x86_64 nettle-debuginfo-3.10.1-1.el9.x86_64 ndctl-libs-debuginfo-78-2.el9.x86_64 daxctl-libs-debuginfo-78-2.el9.x86_64 libmount-debuginfo-2.37.4-21.el9.x86_64 libselinux-debuginfo-3.6-3.el9.x86_64 libffi-debuginfo-3.4.2-8.el9.x86_64 pcre-debuginfo-8.44-4.el9.x86_64 elfutils-libelf-debuginfo-0.193-1.el9.x86_64 xz-libs-debuginfo-5.2.5-8.el9_0.x86_64 bzip2-libs-debuginfo-1.0.8-10.el9_5.x86_64 systemd-libs-debuginfo-252-53.el9.x86_64 libuuid-debuginfo-2.37.4-21.el9.x86_64 kmod-libs-debuginfo-28-10.el9.x86_64 libblkid-debuginfo-2.37.4-21.el9.x86_64 pcre2-debuginfo-10.40-6.el9.x86_64 libgcc-debuginfo-11.5.0-9.el9.x86_64 openssl-libs-debuginfo-3.5.1-3.el9.x86_64 (gdb) bt
#0 0x00007ffff6a8d02c in __pthread_kill_implementation () at /lib64/libc.so.6
#1 0x00007ffff6a3fb86 in raise () at /lib64/libc.so.6
#2 0x00007ffff6a29873 in abort () at /lib64/libc.so.6
#3 0x0000555555d62988 in object_dynamic_cast_assert
(obj=0x555556ab0cf0, typename=typename@entry=0x5555560528a5 "pnv10-chip", file=file@entry=0x555556051628 "/home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h", line=line@entry=110, func=func@entry=0x55555606a2c8 <__func__.27> "PNV10_CHIP")
at ../qom/object.c:925
#4 0x0000555555cfe852 in PNV10_CHIP (obj=<optimized out>) at /home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h:110
#5 pnv_xive2_get_remote (fwd_addr=<optimized out>, vsd_type=2) at ../hw/intc/pnv_xive2.c:113
#6 pnv_xive2_vst_addr (idx=15, blk=<optimized out>, type=2, xive=<optimized out>) at ../hw/intc/pnv_xive2.c:265
#7 pnv_xive2_vst_addr (xive=<optimized out>, type=2, blk=<optimized out>, idx=15) at ../hw/intc/pnv_xive2.c:244
#8 0x0000555555cfec35 in pnv_xive2_vst_read (xive=0x555556ab1500, type=2, blk=1 '\001', idx=15, data=0x7fffffffcf20)
at ../hw/intc/pnv_xive2.c:286
#9 0x0000555555d06a69 in xive2_router_get_end (end=0x7fffffffcf20, end_idx=15, end_blk=1 '\001', xrtr=0x555556ab1500)
at ../hw/intc/xive2.c:1437
#10 xive2_router_end_notify
(xrtr=xrtr@entry=0x555556ab1500, end_blk=1 '\001', end_idx=15, end_data=97, redistribute=redistribute@entry=false)
at ../hw/intc/xive2.c:1669
#11 0x0000555555d06990 in xive2_notify (xrtr=0x555556ab1500, lisn=1040385, pq_checked=<optimized out>)
at ../hw/intc/xive2.c:1955
#12 0x0000555555add8bb in memory_region_write_accessor
(mr=mr@entry=0x555556ab3e00, addr=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, shift=<optimized out>, mask=mask@entry=18446744073709551615, attrs=...) at ../system/memory.c:490
#13 0x0000555555adf1a2 in access_with_adjusted_size
(addr=addr@entry=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x555556ab3e00, attrs=...)
at ../system/memory.c:561
#14 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x555556ab3e00, addr=136365408256, data=<optimized out>,
data@entry=0, op=<optimized out>, attrs=attrs@entry=...) at ../system/memory.c:1553
#15 0x0000555555ae8357 in address_space_stq_internal
(as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=..., result=result@entry=0x7fffffffd1f4, endian=endian@entry=DEVICE_BIG_ENDIAN) at ../system/memory_ldst.c.inc:479
#16 0x0000555555aeef0b in address_space_stq_be
(as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=...,
attrs@entry=..., result=result@entry=0x7fffffffd1f4) at ../system/memory_ldst.c.inc:524
#17 0x0000555555d2159c in pnv_phb4_xive_notify_abt (pq_checked=false, srcno=<optimized out>, phb=0x5555574bc500)
at ../hw/pci-host/pnv_phb4.c:1650
#18 pnv_phb4_xive_notify (xf=<optimized out>, srcno=<optimized out>, pq_checked=<optimized out>)
at ../hw/pci-host/pnv_phb4.c:1686
#19 0x0000555555d203f0 in qemu_irq_pulse (irq=0x5555574c8440) at /home/legoater/work/qemu/qemu.git/include/hw/irq.h:33
#20 pnv_phb4_msi_write (opaque=<optimized out>, addr=<optimized out>, data=<optimized out>, size=<optimized out>)
at ../hw/pci-host/pnv_phb4.c:1423
#21 0x0000555555add8bb in memory_region_write_accessor
(mr=mr@entry=0x55555d8c76b0, addr=0, value=value@entry=0x7fffffffd318, size=size@entry=4, shift=<optimized out>, mask=mask@entry=4294967295, attrs=...) at ../system/memory.c:490
#22 0x0000555555adf23b in access_with_adjusted_size
(addr=addr@entry=0, value=value@entry=0x7fffffffd318, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x55555d8c76b0, attrs=...)
at ../system/memory.c:566
#23 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x55555d8c76b0, addr=0, data=<optimized out>,
data@entry=1, op=op@entry=MO_32, attrs=attrs@entry=...) at ../system/memory.c:1553
#24 0x0000555555aee333 in address_space_stl_internal
(endian=DEVICE_LITTLE_ENDIAN, result=0x0, attrs=..., val=1, addr=<optimized out>, as=<optimized out>)
at ../system/memory_ldst.c.inc:319
#25 address_space_stl_le (as=<optimized out>, addr=<optimized out>, val=1, attrs=..., result=0x0)
at ../system/memory_ldst.c.inc:357#26 0x0000555555ef3c05 in aio_bh_call (bh=bh@entry=0x55555d0d59e0) at ../util/async.c:172
#27 0x0000555555ef3d35 in aio_bh_poll (ctx=ctx@entry=0x55555667ad50) at ../util/async.c:219
#28 0x0000555555edcede in aio_dispatch (ctx=0x55555667ad50) at ../util/aio-posix.c:436
#29 0x0000555555ef3a7e in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>)
at ../util/async.c:361
#30 0x00007ffff76c0f4f in g_main_context_dispatch () at /lib64/libglib-2.0.so.0 #31 0x0000555555ef5058 in glib_pollfds_poll () at ../util/main-loop.c:287
#32 os_host_main_loop_wait (timeout=0) at ../util/main-loop.c:310
#33 main_loop_wait (nonblocking=nonblocking@entry=0) at ../util/main-loop.c:589 #34 0x0000555555af89b3 in qemu_main_loop () at ../system/runstate.c:905
#35 0x0000555555e4273c in qemu_default_main (opaque=opaque@entry=0x0) at ../system/main.c:50 #36 0x000055555589eddd in main (argc=<optimized out>, argv=<optimized out>) at ../system/main.c:93
Hi Cedric,
Sorry for the late reply, I am on vacation this week, will try to look at this, but reply might be late.
Quoted 4 lines · Cédric Le Goater
Quoted 3 lines · Aditya Gupta
Overview
============
Quoted 8 lines
Quoted 3 lines
Add support for Power11 powernv machine type.
Quoted 1 line
<...snip...>
Booting a PowerNV11 machine crashes QEMU. See below.
Are you testing with petitboot kexecing a distro kernel from disk ? Please do and also start a KVM guest. Please check your tests.
No, I ran the qemu functional tests, and few boot tests with different options.
The functional test already attaches a e1000e device, somehow that didn't trigger the same error that you saw (maybe the kernel used doesn't have support for that device).
Will add a test to try petitboot kexec scenario also, so we don't hit these kind of issues in future.
Regarding KVM guest, iirc we can't start KVM guest for PowerNV yet right ?
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
Thank you for testing this Cedric !
- Aditya G
Quoted 77 lines
Thanks,
C.
[ 6.806342] e1000e 0001:02:03.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000 [ 6.844448] e1000e 0001:02:03.0 enP1p2s3: renamed from eth0../include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object
0x555556ab0cf0is not an instance of type pnv10-chipThread 1 "qemu-system-ppc" received signal SIGABRT, Aborted.
0x00007ffff6a8d02cin__pthread_kill_implementation() from/lib64/libc.so.6
Missing rpms, try: dnf --enablerepo='*debug*' install capstone-debuginfo-4.0.2-10.el9.x86_64 gnutls-debuginfo-3.8.3-9.el9.x86_64 pixman-debuginfo-0.40.0-6.el9.x86_64 zlib-debuginfo-1.2.11-40.el9.x86_64 lzo-debuginfo-2.10-7.el9.x86_64 SDL2-debuginfo-2.26.0-1.el9.x86_64 libpmem-debuginfo-1.12.1-1.el9.x86_64 libfdt-debuginfo-1.6.0-7.el9.x86_64 numactl-libs-debuginfo-2.0.19-1.el9.x86_64 glib2-debuginfo-2.68.4-16.el9_6.2.x86_64 libzstd-debuginfo-1.5.5-1.el9.x86_64 libslirp-debuginfo-4.4.0-8.el9.x86_64 elfutils-libs-debuginfo-0.193-1.el9.x86_64 ncurses-libs-debuginfo-6.2-12.20210508.el9.x86_64 usbredir-debuginfo-0.13.0-2.el9.x86_64 libusbx-debuginfo-1.0.26-1.el9.x86_64 glibc-debuginfo-2.34-221.el9.x86_64 p11-kit-debuginfo-0.25.3-3.el9.x86_64 libidn2-debuginfo-2.3.0-7.el9.x86_64 libunistring-debuginfo-0.9.10-15.el9.x86_64 libtasn1-debuginfo-4.16.0-9.el9.x86_64 nettle-debuginfo-3.10.1-1.el9.x86_64 ndctl-libs-debuginfo-78-2.el9.x86_64 daxctl-libs-debuginfo-78-2.el9.x86_64 libmount-debuginfo-2.37.4-21.el9.x86_64 libselinux-debuginfo-3.6-3.el9.x86_64 libffi-debuginfo-3.4.2-8.el9.x86_64 pcre-debuginfo-8.44-4.el9.x86_64 elfutils-libelf-debuginfo-0.193-1.el9.x86_64 xz-libs-debuginfo-5.2.5-8.el9_0.x86_64 bzip2-libs-debuginfo-1.0.8-10.el9_5.x86_64 systemd-libs-debuginfo-252-53.el9.x86_64 libuuid-debuginfo-2.37.4-21.el9.x86_64 kmod-libs-debuginfo-28-10.el9.x86_64 libblkid-debuginfo-2.37.4-21.el9.x86_64 pcre2-debuginfo-10.40-6.el9.x86_64 libgcc-debuginfo-11.5.0-9.el9.x86_64 openssl-libs-debuginfo-3.5.1-3.el9.x86_64 (gdb) bt#0 0x00007ffff6a8d02c in __pthread_kill_implementation () at /lib64/libc.so.6 #1 0x00007ffff6a3fb86 in raise () at /lib64/libc.so.6 #2 0x00007ffff6a29873 in abort () at /lib64/libc.so.6 #3 0x0000555555d62988 in object_dynamic_cast_assert (obj=0x555556ab0cf0, typename=typename@entry=0x5555560528a5 "pnv10-chip", file=file@entry=0x555556051628 "/home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h", line=line@entry=110, func=func@entry=0x55555606a2c8 <__func__.27> "PNV10_CHIP") at ../qom/object.c:925 #4 0x0000555555cfe852 in PNV10_CHIP (obj=<optimized out>) at /home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h:110 #5 pnv_xive2_get_remote (fwd_addr=<optimized out>, vsd_type=2) at ../hw/intc/pnv_xive2.c:113 #6 pnv_xive2_vst_addr (idx=15, blk=<optimized out>, type=2, xive=<optimized out>) at ../hw/intc/pnv_xive2.c:265 #7 pnv_xive2_vst_addr (xive=<optimized out>, type=2, blk=<optimized out>, idx=15) at ../hw/intc/pnv_xive2.c:244 #8 0x0000555555cfec35 in pnv_xive2_vst_read (xive=0x555556ab1500, type=2, blk=1 '\001', idx=15, data=0x7fffffffcf20) at ../hw/intc/pnv_xive2.c:286 #9 0x0000555555d06a69 in xive2_router_get_end (end=0x7fffffffcf20, end_idx=15, end_blk=1 '\001', xrtr=0x555556ab1500) at ../hw/intc/xive2.c:1437 #10 xive2_router_end_notify (xrtr=xrtr@entry=0x555556ab1500, end_blk=1 '\001', end_idx=15, end_data=97, redistribute=redistribute@entry=false) at ../hw/intc/xive2.c:1669 #11 0x0000555555d06990 in xive2_notify (xrtr=0x555556ab1500, lisn=1040385, pq_checked=<optimized out>) at ../hw/intc/xive2.c:1955 #12 0x0000555555add8bb in memory_region_write_accessor (mr=mr@entry=0x555556ab3e00, addr=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, shift=<optimized out>, mask=mask@entry=18446744073709551615, attrs=...) at ../system/memory.c:490 #13 0x0000555555adf1a2 in access_with_adjusted_size (addr=addr@entry=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x555556ab3e00, attrs=...) at ../system/memory.c:561 #14 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x555556ab3e00, addr=136365408256, data=<optimized out>, data@entry=0, op=<optimized out>, attrs=attrs@entry=...) at ../system/memory.c:1553 #15 0x0000555555ae8357 in address_space_stq_internal (as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=..., result=result@entry=0x7fffffffd1f4, endian=endian@entry=DEVICE_BIG_ENDIAN) at ../system/memory_ldst.c.inc:479 #16 0x0000555555aeef0b in address_space_stq_be (as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=..., attrs@entry=..., result=result@entry=0x7fffffffd1f4) at ../system/memory_ldst.c.inc:524 #17 0x0000555555d2159c in pnv_phb4_xive_notify_abt (pq_checked=false, srcno=<optimized out>, phb=0x5555574bc500) at ../hw/pci-host/pnv_phb4.c:1650 #18 pnv_phb4_xive_notify (xf=<optimized out>, srcno=<optimized out>, pq_checked=<optimized out>) at ../hw/pci-host/pnv_phb4.c:1686 #19 0x0000555555d203f0 in qemu_irq_pulse (irq=0x5555574c8440) at /home/legoater/work/qemu/qemu.git/include/hw/irq.h:33 #20 pnv_phb4_msi_write (opaque=<optimized out>, addr=<optimized out>, data=<optimized out>, size=<optimized out>) at ../hw/pci-host/pnv_phb4.c:1423 #21 0x0000555555add8bb in memory_region_write_accessor (mr=mr@entry=0x55555d8c76b0, addr=0, value=value@entry=0x7fffffffd318, size=size@entry=4, shift=<optimized out>, mask=mask@entry=4294967295, attrs=...) at ../system/memory.c:490 #22 0x0000555555adf23b in access_with_adjusted_size (addr=addr@entry=0, value=value@entry=0x7fffffffd318, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x55555d8c76b0, attrs=...) at ../system/memory.c:566 #23 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x55555d8c76b0, addr=0, data=<optimized out>, data@entry=1, op=op@entry=MO_32, attrs=attrs@entry=...) at ../system/memory.c:1553 #24 0x0000555555aee333 in address_space_stl_internal (endian=DEVICE_LITTLE_ENDIAN, result=0x0, attrs=..., val=1, addr=<optimized out>, as=<optimized out>) at ../system/memory_ldst.c.inc:319 #25 address_space_stl_le (as=<optimized out>, addr=<optimized out>, val=1, attrs=..., result=0x0) at ../system/memory_ldst.c.inc:357#26
0x0000555555ef3c05inaio_bh_call(bh=bh@entry=0x55555d0d59e0) at../util/async.c:172
#270x0000555555ef3d35inaio_bh_poll(ctx=ctx@entry=0x55555667ad50) at../util/async.c:219
#280x0000555555edcedeinaio_dispatch(ctx=0x55555667ad50) at../util/aio-posix.c:436
#290x0000555555ef3a7einaio_ctx_dispatch(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>)at ../util/async.c:361#30
0x00007ffff76c0f4fing_main_context_dispatch() at/lib64/libglib-2.0.so.0#310x0000555555ef5058inglib_pollfds_poll() at../util/main-loop.c:287
#32os_host_main_loop_wait(timeout=0) at../util/main-loop.c:310
#33main_loop_wait(nonblocking=nonblocking@entry=0) at../util/main-loop.c:589#340x0000555555af89b3inqemu_main_loop() at../system/runstate.c:905
#350x0000555555e4273cinqemu_default_main(opaque=opaque@entry=0x0) at../system/main.c:50#360x000055555589edddin main (argc=<optimized out>, argv=<optimized out>) at../system/main.c:93
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in 'pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place in hw/intc/pnv_xive2.c assuming Pnv10Chip object.
Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index e019cad5c14c..9832be5fd297 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr)
int i;
for (i = 0; i < pnv->num_chips; i++) {
- Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]);
- PnvXive2 *xive = &chip10->xive;
+ PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]);
+ PnvXive2 *xive = k->intc_get(pnv->chips[i]);
/*
* Is this the XIVE matching the forwarded VSD address is for thisWhich one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Attaching complete patch at end of the message.
Thanks,
- Aditya G
Quoted 69 lines
Quoted 69 lines
Thanks,
C.
[ 6.806342] e1000e 0001:02:03.0 eth0: MAC: 3, PHY: 8, PBA No: 000000-000 [ 6.844448] e1000e 0001:02:03.0 enP1p2s3: renamed from eth0../include/hw/ppc/pnv_chip.h:110:PNV10_CHIP: Object
0x555556ab0cf0is not an instance of type pnv10-chipThread 1 "qemu-system-ppc" received signal SIGABRT, Aborted.
0x00007ffff6a8d02cin__pthread_kill_implementation() from/lib64/libc.so.6
Missing rpms, try: dnf --enablerepo='*debug*' install capstone-debuginfo-4.0.2-10.el9.x86_64 gnutls-debuginfo-3.8.3-9.el9.x86_64 pixman-debuginfo-0.40.0-6.el9.x86_64 zlib-debuginfo-1.2.11-40.el9.x86_64 lzo-debuginfo-2.10-7.el9.x86_64 SDL2-debuginfo-2.26.0-1.el9.x86_64 libpmem-debuginfo-1.12.1-1.el9.x86_64 libfdt-debuginfo-1.6.0-7.el9.x86_64 numactl-libs-debuginfo-2.0.19-1.el9.x86_64 glib2-debuginfo-2.68.4-16.el9_6.2.x86_64 libzstd-debuginfo-1.5.5-1.el9.x86_64 libslirp-debuginfo-4.4.0-8.el9.x86_64 elfutils-libs-debuginfo-0.193-1.el9.x86_64 ncurses-libs-debuginfo-6.2-12.20210508.el9.x86_64 usbredir-debuginfo-0.13.0-2.el9.x86_64 libusbx-debuginfo-1.0.26-1.el9.x86_64 glibc-debuginfo-2.34-221.el9.x86_64 p11-kit-debuginfo-0.25.3-3.el9.x86_64 libidn2-debuginfo-2.3.0-7.el9.x86_64 libunistring-debuginfo-0.9.10-15.el9.x86_64 libtasn1-debuginfo-4.16.0-9.el9.x86_64 nettle-debuginfo-3.10.1-1.el9.x86_64 ndctl-libs-debuginfo-78-2.el9.x86_64 daxctl-libs-debuginfo-78-2.el9.x86_64 libmount-debuginfo-2.37.4-21.el9.x86_64 libselinux-debuginfo-3.6-3.el9.x86_64 libffi-debuginfo-3.4.2-8.el9.x86_64 pcre-debuginfo-8.44-4.el9.x86_64 elfutils-libelf-debuginfo-0.193-1.el9.x86_64 xz-libs-debuginfo-5.2.5-8.el9_0.x86_64 bzip2-libs-debuginfo-1.0.8-10.el9_5.x86_64 systemd-libs-debuginfo-252-53.el9.x86_64 libuuid-debuginfo-2.37.4-21.el9.x86_64 kmod-libs-debuginfo-28-10.el9.x86_64 libblkid-debuginfo-2.37.4-21.el9.x86_64 pcre2-debuginfo-10.40-6.el9.x86_64 libgcc-debuginfo-11.5.0-9.el9.x86_64 openssl-libs-debuginfo-3.5.1-3.el9.x86_64 (gdb) bt#0 0x00007ffff6a8d02c in __pthread_kill_implementation () at /lib64/libc.so.6 #1 0x00007ffff6a3fb86 in raise () at /lib64/libc.so.6 #2 0x00007ffff6a29873 in abort () at /lib64/libc.so.6 #3 0x0000555555d62988 in object_dynamic_cast_assert (obj=0x555556ab0cf0, typename=typename@entry=0x5555560528a5 "pnv10-chip", file=file@entry=0x555556051628 "/home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h", line=line@entry=110, func=func@entry=0x55555606a2c8 <__func__.27> "PNV10_CHIP") at ../qom/object.c:925 #4 0x0000555555cfe852 in PNV10_CHIP (obj=<optimized out>) at /home/legoater/work/qemu/qemu.git/include/hw/ppc/pnv_chip.h:110 #5 pnv_xive2_get_remote (fwd_addr=<optimized out>, vsd_type=2) at ../hw/intc/pnv_xive2.c:113 #6 pnv_xive2_vst_addr (idx=15, blk=<optimized out>, type=2, xive=<optimized out>) at ../hw/intc/pnv_xive2.c:265 #7 pnv_xive2_vst_addr (xive=<optimized out>, type=2, blk=<optimized out>, idx=15) at ../hw/intc/pnv_xive2.c:244 #8 0x0000555555cfec35 in pnv_xive2_vst_read (xive=0x555556ab1500, type=2, blk=1 '\001', idx=15, data=0x7fffffffcf20) at ../hw/intc/pnv_xive2.c:286 #9 0x0000555555d06a69 in xive2_router_get_end (end=0x7fffffffcf20, end_idx=15, end_blk=1 '\001', xrtr=0x555556ab1500) at ../hw/intc/xive2.c:1437 #10 xive2_router_end_notify (xrtr=xrtr@entry=0x555556ab1500, end_blk=1 '\001', end_idx=15, end_data=97, redistribute=redistribute@entry=false) at ../hw/intc/xive2.c:1669 #11 0x0000555555d06990 in xive2_notify (xrtr=0x555556ab1500, lisn=1040385, pq_checked=<optimized out>) at ../hw/intc/xive2.c:1955 #12 0x0000555555add8bb in memory_region_write_accessor (mr=mr@entry=0x555556ab3e00, addr=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, shift=<optimized out>, mask=mask@entry=18446744073709551615, attrs=...) at ../system/memory.c:490 #13 0x0000555555adf1a2 in access_with_adjusted_size (addr=addr@entry=136365408256, value=value@entry=0x7fffffffd0e8, size=size@entry=8, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x555556ab3e00, attrs=...) at ../system/memory.c:561 #14 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x555556ab3e00, addr=136365408256, data=<optimized out>, data@entry=0, op=<optimized out>, attrs=attrs@entry=...) at ../system/memory.c:1553 #15 0x0000555555ae8357 in address_space_stq_internal (as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=..., result=result@entry=0x7fffffffd1f4, endian=endian@entry=DEVICE_BIG_ENDIAN) at ../system/memory_ldst.c.inc:479 #16 0x0000555555aeef0b in address_space_stq_be (as=<optimized out>, addr=addr@entry=1694483783811072, val=val@entry=0, attrs=..., attrs@entry=..., result=result@entry=0x7fffffffd1f4) at ../system/memory_ldst.c.inc:524 #17 0x0000555555d2159c in pnv_phb4_xive_notify_abt (pq_checked=false, srcno=<optimized out>, phb=0x5555574bc500) at ../hw/pci-host/pnv_phb4.c:1650 #18 pnv_phb4_xive_notify (xf=<optimized out>, srcno=<optimized out>, pq_checked=<optimized out>) at ../hw/pci-host/pnv_phb4.c:1686 #19 0x0000555555d203f0 in qemu_irq_pulse (irq=0x5555574c8440) at /home/legoater/work/qemu/qemu.git/include/hw/irq.h:33 #20 pnv_phb4_msi_write (opaque=<optimized out>, addr=<optimized out>, data=<optimized out>, size=<optimized out>) at ../hw/pci-host/pnv_phb4.c:1423 #21 0x0000555555add8bb in memory_region_write_accessor (mr=mr@entry=0x55555d8c76b0, addr=0, value=value@entry=0x7fffffffd318, size=size@entry=4, shift=<optimized out>, mask=mask@entry=4294967295, attrs=...) at ../system/memory.c:490 #22 0x0000555555adf23b in access_with_adjusted_size (addr=addr@entry=0, value=value@entry=0x7fffffffd318, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=0x555555add850 <memory_region_write_accessor>, mr=0x55555d8c76b0, attrs=...) at ../system/memory.c:566 #23 0x0000555555ae0164 in memory_region_dispatch_write (mr=mr@entry=0x55555d8c76b0, addr=0, data=<optimized out>, data@entry=1, op=op@entry=MO_32, attrs=attrs@entry=...) at ../system/memory.c:1553 #24 0x0000555555aee333 in address_space_stl_internal (endian=DEVICE_LITTLE_ENDIAN, result=0x0, attrs=..., val=1, addr=<optimized out>, as=<optimized out>) at ../system/memory_ldst.c.inc:319 #25 address_space_stl_le (as=<optimized out>, addr=<optimized out>, val=1, attrs=..., result=0x0) at ../system/memory_ldst.c.inc:357#26
0x0000555555ef3c05inaio_bh_call(bh=bh@entry=0x55555d0d59e0) at../util/async.c:172
#270x0000555555ef3d35inaio_bh_poll(ctx=ctx@entry=0x55555667ad50) at../util/async.c:219
#280x0000555555edcedeinaio_dispatch(ctx=0x55555667ad50) at../util/aio-posix.c:436
#290x0000555555ef3a7einaio_ctx_dispatch(source=<optimized out>, callback=<optimized out>, user_data=<optimized out>)at ../util/async.c:361
Quoted 8 lines
Quoted 8 lines
#30
0x00007ffff76c0f4fing_main_context_dispatch() at/lib64/libglib-2.0.so.0#310x0000555555ef5058inglib_pollfds_poll() at../util/main-loop.c:287
#32os_host_main_loop_wait(timeout=0) at../util/main-loop.c:310
#33main_loop_wait(nonblocking=nonblocking@entry=0) at../util/main-loop.c:589#340x0000555555af89b3inqemu_main_loop() at../system/runstate.c:905
#350x0000555555e4273cinqemu_default_main(opaque=opaque@entry=0x0) at../system/main.c:50#360x000055555589edddin main (argc=<optimized out>, argv=<optimized out>) at../system/main.c:93
The patch which fixes the issue, adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index e019cad5c14c..9832be5fd297 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr)
int i;
for (i = 0; i < pnv->num_chips; i++) {
- Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]);
- PnvXive2 *xive = &chip10->xive;
+ PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]);
+ PnvXive2 *xive = k->intc_get(pnv->chips[i]);
/*
* Is this the XIVE matching the forwarded VSD address is for this
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 673bb54c6789..81889ede2e0c 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1488,6 +1488,11 @@ 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 PnvXive2 *pnv_chip_power10_intc_get(PnvChip *chip)
+{
+ return &PNV10_CHIP(chip)->xive;
+}
+
static void pnv_chip_power11_intc_create(PnvChip *chip, PowerPCCPU *cpu,
Error **errp)
{
@@ -1532,6 +1537,11 @@ static void pnv_chip_power11_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
}
+static PnvXive2 *pnv_chip_power11_intc_get(PnvChip *chip)
+{
+ return &PNV11_CHIP(chip)->xive;
+}
+
/*
* Allowed core identifiers on a POWER8 Processor Chip :
*
@@ -2716,6 +2726,7 @@ static void pnv_chip_power10_class_init(ObjectClass *klass, const void *data)
k->intc_reset = pnv_chip_power10_intc_reset;
k->intc_destroy = pnv_chip_power10_intc_destroy;
k->intc_print_info = pnv_chip_power10_intc_print_info;
+ k->intc_get = pnv_chip_power10_intc_get;
k->isa_create = pnv_chip_power10_isa_create;
k->dt_populate = pnv_chip_power10_dt_populate;
k->pic_print_info = pnv_chip_power10_pic_print_info;
@@ -2749,6 +2760,7 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, const void *data)
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->intc_get = pnv_chip_power11_intc_get;
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;
diff --git a/include/hw/ppc/pnv_chip.h b/include/hw/ppc/pnv_chip.h
index 6bd930f8b439..dcdbf519f894 100644
--- a/include/hw/ppc/pnv_chip.h
+++ b/include/hw/ppc/pnv_chip.h
@@ -170,6 +170,7 @@ struct PnvChipClass {
void (*intc_reset)(PnvChip *chip, PowerPCCPU *cpu);
void (*intc_destroy)(PnvChip *chip, PowerPCCPU *cpu);
void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, GString *buf);
+ PnvXive2* (*intc_get)(PnvChip *chip);
ISABus *(*isa_create)(PnvChip *chip, Error **errp);
void (*dt_populate)(PnvChip *chip, void *fdt);
void (*pic_print_info)(PnvChip *chip, GString *buf);Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
+ Glenn
+ Gautam
Quoted 33 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index e019cad5c14c..9832be5fd297 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr) int i; for (i = 0; i < pnv->num_chips; i++) { - Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]); - PnvXive2 *xive = &chip10->xive; + PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]); + PnvXive2 *xive = k->intc_get(pnv->chips[i]); /* * Is this the XIVE matching the forwarded VSD address is for this
Quoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to qdev_get_machine() in device model is at best a modeling shortcut, most likely it is a hack :
/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/
So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
In the particular case of XIVE2, the solution is to rework pnv_xive2_get_remote() like it was for P9. See b68147b7a5bf ("ppc/xive: Add support for the PC MMIOs").
Thanks,
C.
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
+ Mike Kowal
Quoted 76 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 33 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index e019cad5c14c..9832be5fd297 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr) int i; for (i = 0; i < pnv->num_chips; i++) { - Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]); - PnvXive2 *xive = &chip10->xive; + PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]); + PnvXive2 *xive = k->intc_get(pnv->chips[i]); /* * Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").Thanks,
C.
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
In reply to Cédric Le GoaterQuoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index e019cad5c14c..9832be5fd297 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr) int i; for (i = 0; i < pnv->num_chips; i++) { - Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]); - PnvXive2 *xive = &chip10->xive; + PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]); + PnvXive2 *xive = k->intc_get(pnv->chips[i]); /* * Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
Quoted 3 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").
I am having difficulties making a change here, don't know this path. Going through the docs to understand XIVE2.
Will post once I have a patch.
Thanks Cedric,
- Aditya G
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
In reply to Cédric Le Goater+ Ganesh
Quoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index e019cad5c14c..9832be5fd297 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr) int i; for (i = 0; i < pnv->num_chips; i++) { - Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]); - PnvXive2 *xive = &chip10->xive; + PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]); + PnvXive2 *xive = k->intc_get(pnv->chips[i]); /* * Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
Quoted 4 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").
Hi Cedric,
While I am working with XIVE engineers to get the pnv_xive2_get_remote() reworked as suggested (since it's a bit more work due to multiple cases of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like to propose below patch to have as an interim solution to unblock the PowerNV11 support patches.
Please let me know if it looks good to you.
I am planning to have this as part of the pnv11 patches.
hw/intc/pnv_xive2.c +2 -2
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr)int i;for (i =0 ; i < pnv->num_chips; i++) { -Pnv10Chip *chip10 =PNV10_CHIP (pnv->chips[i]); -PnvXive2 *xive = &chip10->xive; +PnvChipClass *k =PNV_CHIP_GET_CLASS (pnv->chips[i]); +PnvXive2 *xive =PNV_XIVE2 (k->intc_get (pnv->chips[i]));/* * Is this the XIVE matching the forwarded VSD address is for this
hw/ppc/pnv.c +12 -0
@@ -1488,6 +1488,11 @@ 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_power10_intc_get (PnvChip *chip) +{ +return &PNV10_CHIP (chip)->xive; +} +static void pnv_chip_power11_intc_create (PnvChip *chip,PowerPCCPU *cpu,Error **errp) {
@@ -1532,6 +1537,11 @@ static void pnv_chip_power11_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_get (PnvChip *chip) +{ +return &PNV11_CHIP (chip)->xive; +} +/* * Allowed core identifiers on a POWER8 Processor Chip : *
@@ -2716,6 +2726,7 @@ static void pnv_chip_power10_class_init(ObjectClass *klass, const void *data) k->intc_reset = pnv_chip_power10_intc_reset; k->intc_destroy = pnv_chip_power10_intc_destroy; k->intc_print_info = pnv_chip_power10_intc_print_info; + k->intc_get = pnv_chip_power10_intc_get; k->isa_create = pnv_chip_power10_isa_create; k->dt_populate = pnv_chip_power10_dt_populate; k->pic_print_info = pnv_chip_power10_pic_print_info;
@@ -2749,6 +2760,7 @@ static void pnv_chip_power11_class_init(ObjectClass *klass, const void *data) 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->intc_get = pnv_chip_power11_intc_get; 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;
include/hw/ppc/pnv_chip.h +1 -0
@@ -170,6 +170,7 @@ struct PnvChipClass {void (*intc_reset)(PnvChip *chip,PowerPCCPU *cpu);void (*intc_destroy)(PnvChip *chip,PowerPCCPU *cpu);void (*intc_print_info)(PnvChip *chip,PowerPCCPU *cpu,GString *buf); +void * (*intc_get)(PnvChip *chip); ISABus *(*isa_create)(PnvChip *chip, Error **errp);void (*dt_populate)(PnvChip *chip,void *fdt);void (*pic_print_info)(PnvChip *chip,GString *buf);
Thanks,
- Aditya G
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Quoted 67 lines · Aditya Gupta
+ Ganesh
Quoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index e019cad5c14c..9832be5fd297 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_t vsd_type, hwaddr fwd_addr) int i; for (i = 0; i < pnv->num_chips; i++) { - Pnv10Chip *chip10 = PNV10_CHIP(pnv->chips[i]); - PnvXive2 *xive = &chip10->xive; + PnvChipClass *k = PNV_CHIP_GET_CLASS(pnv->chips[i]); + PnvXive2 *xive = k->intc_get(pnv->chips[i]); /* * Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());Quoted 4 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").
Quoted 7 lines
Hi Cedric,
While I am working with XIVE engineers to get the
pnv_xive2_get_remote()reworked as suggested (since it's a bit more work due to multiple cases of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like to propose below patch to have as an interim solution to unblock the PowerNV11 support patches.
pHyp is an unknown FW implementation for opensource. Until an image is released somewhere (please think about it), QEMU has nothing to worry about other than supporting OPAL.
For now, let's forget about the grouping aspect of XIVE2, simply rework pnv_xive2_get_remote() as it was done in b68147b7a5bf for XIVE. This shouldn't take long. And, for the nvg/nvc types, report an error of some sort and add a TODO in the code.
Quoted 2 lines
Please let me know if it looks good to you.
It's a hack. So please try the above first.
Thanks,
C.
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Quoted 76 lines · Cédric Le Goater
Quoted 67 lines · Aditya Gupta
+ Ganesh
Quoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git
a/hw/intc/pnv_xive2.cb/hw/intc/pnv_xive2.c
indexe019cad5c14c..9832be5fd297100644
---a/hw/intc/pnv_xive2.c
+++b/hw/intc/pnv_xive2.c
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_tvsd_type, hwaddrfwd_addr) int i;
for (i = 0; i <pnv->num_chips; i++) {
- Pnv10Chip *chip10 =PNV10_CHIP(pnv->chips[i]);
- PnvXive2 *xive =&chip10->xive;
+ PnvChipClass *k =PNV_CHIP_GET_CLASS(pnv->chips[i]);
+ PnvXive2 *xive =k->intc_get(pnv->chips[i]);
/*
* Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());Quoted 4 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").Quoted 7 lines
Hi Cedric,
While I am working with XIVE engineers to get the
pnv_xive2_get_remote()reworked as suggested (since it's a bit more work due to multiple cases of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like to propose below patch to have as an interim solution to unblock the PowerNV11 support patches.
Quoted 9 lines
pHyp is an unknown FW implementation for opensource. Until an image is released somewhere (please think about it), QEMU has nothing to worry about other than supporting OPAL.
For now, let's forget about the grouping aspect of XIVE2, simply rework
pnv_xive2_get_remote()as it was done inb68147b7a5bffor XIVE. This shouldn't take long. And, for the nvg/nvc types, report an error of some sort and add a TODO in the code.
A similar change cannot be done to XIVE2, because Fredric’s commit (96a2132ce95) has introduced modifications to the NVPG and NVC MMIO callbacks in order to support backlog counter operations.
Quoted 10 lines
Quoted 2 lines
Please let me know if it looks good to you.
It's a hack. So please try the above first.
Thanks,
C.
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Quoted 82 lines · Ganesh G R
Quoted 80 lines · Cédric Le Goater
Quoted 67 lines · Aditya Gupta
+ Ganesh
Quoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git
a/hw/intc/pnv_xive2.cb/hw/intc/pnv_xive2.c
indexe019cad5c14c..9832be5fd297100644
---a/hw/intc/pnv_xive2.c
+++b/hw/intc/pnv_xive2.c
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_tvsd_type, hwaddrfwd_addr) int i;
for (i = 0; i <pnv->num_chips; i++) {
- Pnv10Chip *chip10 =PNV10_CHIP(pnv->chips[i]);
- PnvXive2 *xive =&chip10->xive;
+ PnvChipClass *k =PNV_CHIP_GET_CLASS(pnv->chips[i]);
+ PnvXive2 *xive =k->intc_get(pnv->chips[i]);
/*
* Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());Quoted 4 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").Quoted 7 lines
Hi Cedric,
While I am working with XIVE engineers to get the
pnv_xive2_get_remote()reworked as suggested (since it's a bit more work due to multiple cases of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like to propose below patch to have as an interim solution to unblock the PowerNV11 support patches.pHyp is an unknown FW implementation for opensource. Until an image is released somewhere (please think about it), QEMU has nothing to worry about other than supporting OPAL.
Quoted 6 lines
Quoted 5 lines
For now, let's forget about the grouping aspect of XIVE2, simply rework
pnv_xive2_get_remote()as it was done inb68147b7a5bffor XIVE. This shouldn't take long. And, for the nvg/nvc types, report an error of some sort and add a TODO in the code.A similar change cannot be done to XIVE2, because Fredric’s commit (
96a2132ce95) has introduced modifications to the NVPG and NVC MMIO callbacks in order to support backlog counter operations.
Thanks for looking.
Indeed. So I guess Aditya's proposal adding a new PnvChipClass handler is then the best alternative :
@@ -170,6 +170,7 @@ struct PnvChipClass {
void (*intc_reset)(PnvChip *chip, PowerPCCPU *cpu);
void (*intc_destroy)(PnvChip *chip, PowerPCCPU *cpu);
void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, GString *buf);
+ void* (*intc_get)(PnvChip *chip);
ISABus *(*isa_create)(PnvChip *chip, Error **errp);
void (*dt_populate)(PnvChip *chip, void *fdt);
void (*pic_print_info)(PnvChip *chip, GString *buf);Aditya,
Could you please resend the whole powernv11 series including this new patch for xive2 ?
Thanks,
C.
Re: Access to remote XIVE2 units (was Re: [PATCH v9 0/7] Power11 support for QEMU [PowerNV])
Quoted 104 lines · Cédric Le Goater
Quoted 82 lines · Ganesh G R
Quoted 80 lines · Cédric Le Goater
Quoted 67 lines · Aditya Gupta
+ Ganesh
Quoted 59 lines · Cédric Le Goater
+ Glenn
+ GautamQuoted 31 lines · Aditya Gupta
Quoted 5 lines · Aditya Gupta
Quoted 1 line
<...snip...>
About the error, seems xive2 always expecting powernv10 chip, I will have to rethink how should I use the same xive2 for powernv11.
There's a type cast to Pnv10Chip in '
pnv_xive2_get_remote'. The cast is only temporarily used to get the 'PnvXive2' object in the Pnv10Chip.
It's the only place inhw/intc/pnv_xive2.cassuming Pnv10Chip object.Thinking to have a helper function to just return the 'PnvXive2' object inside the chip, given a 'PnvChip'.
Or the below change where we are adding another pointer in PnvChipClass:
diff --git
a/hw/intc/pnv_xive2.cb/hw/intc/pnv_xive2.c
indexe019cad5c14c..9832be5fd297100644
---a/hw/intc/pnv_xive2.c
+++b/hw/intc/pnv_xive2.c
@@ -110,8 +110,8 @@ static PnvXive2 *pnv_xive2_get_remote(uint32_tvsd_type, hwaddrfwd_addr) int i;
for (i = 0; i <pnv->num_chips; i++) {
- Pnv10Chip *chip10 =PNV10_CHIP(pnv->chips[i]);
- PnvXive2 *xive =&chip10->xive;
+ PnvChipClass *k =PNV_CHIP_GET_CLASS(pnv->chips[i]);
+ PnvXive2 *xive =k->intc_get(pnv->chips[i]);
/*
* Is this the XIVE matching the forwarded VSD address is for thisQuoted 3 lines
Which one do you suggest ? Or should I look for another way ?
I am preferring the first way to have a helper, but both ways look hacky.
Any call to
qdev_get_machine()in device model is at best a modeling shortcut, most likely it is a hack :/*
* Remote access to INT controllers. HW uses MMIOs(?). For now, a simple
* scan of all the chips INT controller is good enough.
*/So all these calls are suspicious :
$ git grep qdev_get_machine hw/*/*pnv* hw/intc/pnv_xive2.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/pci-host/pnv_phb3.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_chiptod.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine()); hw/ppc/pnv_lpc.c: PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());Quoted 4 lines
In the particular case of XIVE2, the solution is to rework
pnv_xive2_get_remote()like it was for P9. Seeb68147b7a5bf("ppc/xive: Add support for the PC MMIOs").Quoted 7 lines
Hi Cedric,
While I am working with XIVE engineers to get the
pnv_xive2_get_remote()reworked as suggested (since it's a bit more work due to multiple cases of indirect/direct vst, nvg/nvc types in case of XIVE2), I would like to propose below patch to have as an interim solution to unblock the PowerNV11 support patches.pHyp is an unknown FW implementation for opensource. Until an image is released somewhere (please think about it), QEMU has nothing to worry about other than supporting OPAL.
Quoted 6 lines
Quoted 5 lines
For now, let's forget about the grouping aspect of XIVE2, simply rework
pnv_xive2_get_remote()as it was done inb68147b7a5bffor XIVE. This shouldn't take long. And, for the nvg/nvc types, report an error of some sort and add a TODO in the code.A similar change cannot be done to XIVE2, because Fredric’s commit (
96a2132ce95) has introduced modifications to the NVPG and NVC MMIO callbacks in order to support backlog counter operations.Thanks for looking.
Indeed. So I guess Aditya's proposal adding a new PnvChipClass handler is then the best alternative :
include/hw/ppc/pnv_chip.h +1
-0@@ -170,6 +170,7 @@ struct PnvChipClass {void (*intc_reset)(PnvChip *chip,PowerPCCPU *cpu);void (*intc_destroy)(PnvChip *chip,PowerPCCPU *cpu);void (*intc_print_info)(PnvChip *chip,PowerPCCPU *cpu,GString *buf); +void * (*intc_get)(PnvChip *chip); ISABus *(*isa_create)(PnvChip *chip, Error **errp);void (*dt_populate)(PnvChip *chip,void *fdt);void (*pic_print_info)(PnvChip *chip,GString *buf);
Quoted 4 lines
Aditya,
Could you please resend the whole powernv11 series including this new patch for xive2 ?
Sure, will post v10 today.
Thanks Cedric !
Quoted 7 lines
Thanks,
C.
Quoted 18 lines · Aditya Gupta
Hi Cedric,
Sorry for the late reply, I am on vacation this week, will try to look at this, but reply might be late.Quoted 4 lines · Cédric Le Goater
Quoted 3 lines · Aditya Gupta
Overview
============Quoted 8 lines
Quoted 3 lines
Add support for Power11 powernv machine type.
Quoted 1 line
<...snip...>
Booting a PowerNV11 machine crashes QEMU. See below.
Are you testing with petitboot kexecing a distro kernel from disk ? Please do and also start a KVM guest. Please check your tests.
Quoted 8 lines
No, I ran the qemu functional tests, and few boot tests with different options.
The functional test already attaches a e1000e device, somehow that didn't trigger the same error that you saw (maybe the kernel used doesn't have support for that device).
Will add a test to try petitboot kexec scenario also, so we don't hit these kind of issues in future.
I run a multi socket config :
qemu-system-ppc64 -m 4G -machine powernv11 -smp 16,sockets=2,cores=2,threads=4 -accel tcg,thread=multi
-kernel ./zImage.epapr
-initrd ./rootfs.cpio.xz
-device pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0 -device nvme,bus=pcie.0,addr=0x0,drive=drive0,serial=1234
-drive file=./Fedora-Cloud-Base-Generic-42-1.1.ppc64le.qcow2,if=none,id=drive0,format=qcow2,cache=none
-device e1000e,netdev=net0,mac=C0:FF:EE:00:01:05,bus=bridge1,addr=0x3
-netdev bridge,helper=/usr/libexec/qemu-bridge-helper,br=virbr0,id=net0
-device nec-usb-xhci,bus=bridge1,addr=0x2
-device usb-storage,drive=usbkey
-drive file=usb.img,if=none,id=usbkey,format=raw,cache=none
-serial mon:stdio -nographicSee :
https://lore.kernel.org/qemu-devel/[email protected]/
Quoted 3 lines
Regarding KVM guest, iirc we can't start KVM guest for PowerNV yet right ?
The QEMU PowerNV machines support emulated KVM guests. XIVE is a key component in its support, as it controls the wake-up of the virtual processors.
The QEMU pseries machines support nested too, both implementations:
the initial on OPAL systems and the most recent v2 one for pHyp.
I believe QEMU PowerNV machines support nested KVM too. Never tried that though.
C.