ppc/pnv: Add QME region for P10
PATCH 1/1 ppc/pnv: Add QME region for P10
The Quad Management Engine (QME) manages power related settings for its quad. The xscom region is separate from the quad xscoms, therefore a new region is added. The xscoms in a QME select a given core by selecting the forth nibble.
Implement dummy reads for the stop state history (SSH) and special wakeup (SPWU) registers. This quietens some sxcom errors when skiboot boots on p10.
--- include/hw/ppc/pnv_core.h | 4 +++ include/hw/ppc/pnv_xscom.h | 11 ++++++++ hw/ppc/pnv.c | 5 ++++ hw/ppc/pnv_core.c | 56 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+)
include/hw/ppc/pnv_core.h +4 -0
@@ -65,6 +65,9 @@ struct PnvQuadClass {const MemoryRegionOps *xscom_ops;uint64_t xscom_size; + +const MemoryRegionOps *xscom_qme_ops; +uint64_t xscom_qme_size; };#define TYPE_PNV_QUAD "powernv-cpu-quad"
@@ -79,5 +82,6 @@ struct PnvQuad {uint32_t quad_id;MemoryRegion xscom_regs; + MemoryRegion xscom_qme_regs; };#endif /* PPC_PNV_CORE_H */
include/hw/ppc/pnv_xscom.h +11 -0
@@ -127,6 +127,17 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC (proc) \ ((0x2 << 16) | ((1 << (3 - (proc))) << 12)) +#define PNV10_XSCOM_QME (chiplet) \ + (PNV10_XSCOM_EQ(chiplet) | (0xE << 16)) + +/* +* Make the region larger by 0x1000 (instead of starting at an offset) so the +* modelled addresses start from 0 +*/ +#define PNV10_XSCOM_QME_BASE (core) \ + ((uint64_t) PNV10_XSCOM_QME(PNV10_XSCOM_EQ_CHIPLET(core))) +#define PNV10_XSCOM_QME_SIZE (0x8000 + 0x1000) +#define PNV10_XSCOM_EQ_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ(PNV10_XSCOM_EQ_CHIPLET(core)))#define PNV10_XSCOM_EQ_SIZE 0x20000
hw/ppc/pnv.c +5 -0
@@ -1673,6 +1673,11 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)pnv_xscom_add_subregion (chip,PNV10_XSCOM_EQ_BASE (eq->quad_id), &eq->xscom_regs); + +pnv_xscom_add_subregion (chip,PNV10_XSCOM_QME_BASE (eq->quad_id), + &eq->xscom_qme_regs); + + } }
hw/ppc/pnv_core.c +56 -0
74 lines not on this page · raw message
Signature · 1 line
2.40.1
Quoted 65 lines · Joel Stanley
The Quad Management Engine (QME) manages power related settings for its quad. The xscom region is separate from the quad xscoms, therefore a new region is added. The xscoms in a QME select a given core by selecting the forth nibble.
Implement dummy reads for the stop state history (SSH) and special wakeup (SPWU) registers. This quietens some sxcom errors when skiboot boots on p10.
Signed-off-by Joel Stanley <[email protected]>--- include/hw/ppc/pnv_core.h | 4 +++ include/hw/ppc/pnv_xscom.h | 11 ++++++++ hw/ppc/pnv.c | 5 ++++ hw/ppc/pnv_core.c | 56 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+)include/hw/ppc/pnv_core.h +4
-0@@ -65,6 +65,9 @@ struct PnvQuadClass {const MemoryRegionOps *xscom_ops;uint64_t xscom_size; + +const MemoryRegionOps *xscom_qme_ops; +uint64_t xscom_qme_size; };#define TYPE_PNV_QUAD "powernv-cpu-quad"@@ -79,5 +82,6 @@ struct PnvQuad {uint32_t quad_id;MemoryRegion xscom_regs; + MemoryRegion xscom_qme_regs; };#endif /* PPC_PNV_CORE_H */ include/hw/ppc/pnv_xscom.h +11
-0@@ -127,6 +127,17 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC (proc) \ ((0x2 << 16) | ((1 << (3 - (proc))) << 12)) +#define PNV10_XSCOM_QME (chiplet) \ + (PNV10_XSCOM_EQ(chiplet) | (0xE << 16)) + +/* +* Make the region larger by 0x1000 (instead of starting at an offset) so the +* modelled addresses start from 0 +*/ +#define PNV10_XSCOM_QME_BASE (core) \ + ((uint64_t) PNV10_XSCOM_QME(PNV10_XSCOM_EQ_CHIPLET(core))) +#define PNV10_XSCOM_QME_SIZE (0x8000 + 0x1000) +#define PNV10_XSCOM_EQ_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ(PNV10_XSCOM_EQ_CHIPLET(core)))#define PNV10_XSCOM_EQ_SIZE 0x20000hw/ppc/pnv.c +0
-0
hw/ppc/pnv.c static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp) · line 1680
Quoted 8 lines
hw/ppc/pnv.c +5
-0@@ -1673,6 +1673,11 @@ static void pnv_chip_power10_quad_realize(Pnv10Chip *chip10, Error **errp)pnv_xscom_add_subregion (chip,PNV10_XSCOM_EQ_BASE (eq->quad_id), &eq->xscom_regs); + +pnv_xscom_add_subregion (chip,PNV10_XSCOM_QME_BASE (eq->quad_id), + &eq->xscom_qme_regs); + +
extra new lines.
Quoted 62 lines
hw/ppc/pnv.c +0
-0} }hw/ppc/pnv_core.c +47
-0@@ -496,6 +496,53 @@ static const MemoryRegionOps pnv_quad_power10_xscom_ops = { .endianness = DEVICE_BIG_ENDIAN, }; +#define P10_QME_SPWU_HYP 0x83c +#define P10_QME_SSH_HYP 0x82c + +static uint64_t pnv_qme_power10_xscom_read (void *opaque,hwaddr addr, +unsigned int width) +{ +uint32_t offset = addr >>3 ; +uint64_t val =-1 ; + +/* +* Forth nibble selects the core within a quad, mask it to process read +* for any core. +*/ +switch (offset & ~0xf000 ) { +case P10_QME_SPWU_HYP : +case P10_QME_SSH_HYP : +return 0 ; +default : +qemu_log_mask (LOG_UNIMP ,"%s: unimp read 0x%08x\n" , __func__, + offset); + } + +return val; +} + +static void pnv_qme_power10_xscom_write (void *opaque,hwaddr addr, +uint64_t val,unsigned int width) +{ +uint32_t offset = addr >>3 ; + +switch (offset) { +default : +qemu_log_mask (LOG_UNIMP ,"%s: unimp write 0x%08x\n" , __func__, + offset); + } +} + +static const MemoryRegionOps pnv_qme_power10_xscom_ops = { + .read = pnv_qme_power10_xscom_read, + .write = pnv_qme_power10_xscom_write, + .valid.min_access_size =8 , + .valid.max_access_size =8 , + .impl.min_access_size =8 , + .impl.max_access_size =8 , + .endianness =DEVICE_BIG_ENDIAN , +}; +static void pnv_quad_realize (DeviceState *dev,Error **errp) {PnvQuad *eq =PNV_QUAD (dev);
hw/ppc/pnv_core.c static void pnv_quad_realize(DeviceState *dev, Error **errp) · line 562
Quoted 9 lines
hw/ppc/pnv_core.c +6
-0@@ -507,6 +554,12 @@ static void pnv_quad_realize(DeviceState *dev, Error **errp) pqc->xscom_ops, eq, name, pqc->xscom_size); + +snprintf (name,sizeof (name),"xscom-qme.%d" , eq->quad_id); +pnv_xscom_region_init (&eq->xscom_qme_regs,OBJECT (dev), + pqc->xscom_qme_ops, + eq, name, + pqc->xscom_qme_size);
pnv_quad_realize realizes power9 and power10 quad objects but ...
hw/ppc/pnv_core.c static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) · line 586
Quoted 10 lines
hw/ppc/pnv_core.c +3
-0}static Property pnv_quad_properties[] = {@@ -528,6 +581,9 @@ static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) pqc->xscom_ops = &pnv_quad_power10_xscom_ops; pqc->xscom_size =PNV10_XSCOM_EQ_SIZE ; + + pqc->xscom_qme_ops = &pnv_qme_power10_xscom_ops; + pqc->xscom_qme_size =PNV10_XSCOM_QME_SIZE ;
xscom_qme_size is only defined on power10 and it is 0 on power9. The region is nevertheless initialized on power9 and never mapped.
I think we should introduce a specific realize routine for each proc now.
Thanks,
C.
Quoted 3 lines
hw/ppc/pnv_core.c +0
-0}static void pnv_quad_class_init (ObjectClass *oc,void *data)
Quoted 16 lines · Cédric Le Goater
pnv_quad_realizerealizes power9 and power10 quad objects but ...hw/ppc/pnv_core.c static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) · line 586
Quoted 10 lines
} static Property pnv_quad_properties[] = {hw/ppc/pnv_core.c +3
-0@@ -528,6 +581,9 @@ static void pnv_quad_power10_class_init(ObjectClass *oc, void *data) pqc->xscom_ops = &pnv_quad_power10_xscom_ops; pqc->xscom_size =PNV10_XSCOM_EQ_SIZE ; + + pqc->xscom_qme_ops = &pnv_qme_power10_xscom_ops; + pqc->xscom_qme_size =PNV10_XSCOM_QME_SIZE ;
xscom_qme_sizeis only defined on power10 and it is 0 on power9. The region is nevertheless initialized on power9 and never mapped.
Quoted 1 line
I think we should introduce a specific realize routine for each proc now.
I overlooked the P9 behaviour, thanks for pointing that out. I'll make the realise proc specific.
Cheers,
Joel