ppc/pnv: Set P10 core xscom region size to match hardware
PATCH 1/1 ppc/pnv: Set P10 core xscom region size to match hardware
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as 0x1000 (with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.
--- hw/ppc/pnv_core.c | 3 +-- include/hw/ppc/pnv_xscom.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
hw/ppc/pnv_core.c +1 -2
@@ -299,9 +299,8 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) }snprintf (name,sizeof (name),"xscom-core.%d" , cc->core_id); -/* TODO: check PNV_XSCOM_EX_SIZE for p10 */ pnv_xscom_region_init (&pc->xscom_regs,OBJECT (dev), pcc->xscom_ops, - pc, name,PNV_XSCOM_EX_SIZE ); + pc, name,PNV10_XSCOM_EC_SIZE );qemu_register_reset (pnv_core_reset, pc);return ;
include/hw/ppc/pnv_xscom.h +1 -1
@@ -133,7 +133,7 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) -#define PNV10_XSCOM_EC_SIZE 0x100000 +#define PNV10_XSCOM_EC_SIZE 0x1000#define PNV10_XSCOM_PSIHB_BASE 0x3011D00#define PNV10_XSCOM_PSIHB_SIZE 0x100
Signature · 1 line
2.40.1
Quoted 8 lines · Nicholas Piggin
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as
0x1000(with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.Signed-off-by Nicholas Piggin <[email protected]>
Nice, that looks better:
0000000100000000-00000001000fffff (prio 0, i/o): xscom-quad.0: 0x100000 0000000100108000-000000010010ffff (prio 0, i/o): xscom-core.3: 0x8000 0000000100110000-0000000100117fff (prio 0, i/o): xscom-core.2: 0x8000 0000000100120000-0000000100127fff (prio 0, i/o): xscom-core.1: 0x8000 0000000100140000-0000000100147fff (prio 0, i/o): xscom-core.0: 0x8000 0000000108000000-00000001080fffff (prio 0, i/o): xscom-quad.4: 0x100000 0000000108108000-000000010810ffff (prio 0, i/o): xscom-core.7: 0x8000 0000000108110000-0000000108117fff (prio 0, i/o): xscom-core.6: 0x8000 0000000108120000-0000000108127fff (prio 0, i/o): xscom-core.5: 0x8000 0000000108140000-0000000108147fff (prio 0, i/o): xscom-core.4: 0x8000
Quoted 36 lines
--- hw/ppc/pnv_core.c | 3 +-- include/hw/ppc/pnv_xscom.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)hw/ppc/pnv_core.c +1
-2@@ -299,9 +299,8 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) }snprintf (name,sizeof (name),"xscom-core.%d" , cc->core_id); -/* TODO: check PNV_XSCOM_EX_SIZE for p10 */ pnv_xscom_region_init (&pc->xscom_regs,OBJECT (dev), pcc->xscom_ops, - pc, name,PNV_XSCOM_EX_SIZE ); + pc, name,PNV10_XSCOM_EC_SIZE );qemu_register_reset (pnv_core_reset, pc);return ;include/hw/ppc/pnv_xscom.h +1
-2@@ -133,7 +133,7 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) -#define PNV10_XSCOM_EC_SIZE 0x100000 +#define PNV10_XSCOM_EC_SIZE 0x1000#define PNV10_XSCOM_PSIHB_BASE 0x3011D00#define PNV10_XSCOM_PSIHB_SIZE 0x100 --2.40.1
Quoted 23 lines · Joel Stanley
Quoted 8 lines · Nicholas Piggin
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as
0x1000(with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.Signed-off-by Nicholas Piggin <[email protected]>Nice, that looks better:
0000000100000000-00000001000fffff (prio 0, i/o): xscom-quad.0:
0x1000000000000100108000-000000010010ffff (prio 0, i/o): xscom-core.3:0x80000000000100110000-0000000100117fff (prio 0, i/o): xscom-core.2:0x80000000000100120000-0000000100127fff (prio 0, i/o): xscom-core.1:0x80000000000100140000-0000000100147fff (prio 0, i/o): xscom-core.0:0x80000000000108000000-00000001080fffff (prio 0, i/o): xscom-quad.4:0x1000000000000108108000-000000010810ffff (prio 0, i/o): xscom-core.7:0x80000000000108110000-0000000108117fff (prio 0, i/o): xscom-core.6:0x80000000000108120000-0000000108127fff (prio 0, i/o): xscom-core.5:0x80000000000108140000-0000000108147fff (prio 0, i/o): xscom-core.4:0x8000
Quoted 1 line
Reviewed-by Joel Stanley <[email protected]>
It'd interesting to add some dummy SLW handlers to get rid of the XSCOM errors at boot and shutdown on P10 :
[ 4824.393446266,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.393588777,5] Unable to log error
[ 4824.393650582,3] XSCOM: Write failed, ret = -6
[ 4824.394124623,3] Could not set special wakeup on 0:0: Unable to write QME_SPWU_HYP. [ 4824.394368459,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.394382007,5] Unable to log error
[ 4824.394384603,3] XSCOM: Write failed, ret = -6
Thanks,
C.
Quoted 38 lines
Quoted 38 lines
--- hw/ppc/pnv_core.c | 3 +-- include/hw/ppc/pnv_xscom.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)hw/ppc/pnv_core.c +1
-2@@ -299,9 +299,8 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) }snprintf (name,sizeof (name),"xscom-core.%d" , cc->core_id); -/* TODO: check PNV_XSCOM_EX_SIZE for p10 */ pnv_xscom_region_init (&pc->xscom_regs,OBJECT (dev), pcc->xscom_ops, - pc, name,PNV_XSCOM_EX_SIZE ); + pc, name,PNV10_XSCOM_EC_SIZE );qemu_register_reset (pnv_core_reset, pc);return ;include/hw/ppc/pnv_xscom.h +1
-2@@ -133,7 +133,7 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) -#define PNV10_XSCOM_EC_SIZE 0x100000 +#define PNV10_XSCOM_EC_SIZE 0x1000#define PNV10_XSCOM_PSIHB_BASE 0x3011D00#define PNV10_XSCOM_PSIHB_SIZE 0x100 --2.40.1
Quoted 30 lines · Cédric Le Goater
Quoted 23 lines · Joel Stanley
Quoted 8 lines · Nicholas Piggin
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as
0x1000(with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.Signed-off-by Nicholas Piggin <[email protected]>Nice, that looks better:
0000000100000000-00000001000fffff (prio 0, i/o): xscom-quad.0:
0x1000000000000100108000-000000010010ffff (prio 0, i/o): xscom-core.3:0x80000000000100110000-0000000100117fff (prio 0, i/o): xscom-core.2:0x80000000000100120000-0000000100127fff (prio 0, i/o): xscom-core.1:0x80000000000100140000-0000000100147fff (prio 0, i/o): xscom-core.0:0x80000000000108000000-00000001080fffff (prio 0, i/o): xscom-quad.4:0x1000000000000108108000-000000010810ffff (prio 0, i/o): xscom-core.7:0x80000000000108110000-0000000108117fff (prio 0, i/o): xscom-core.6:0x80000000000108120000-0000000108127fff (prio 0, i/o): xscom-core.5:0x80000000000108140000-0000000108147fff (prio 0, i/o): xscom-core.4:0x8000Quoted 1 line
Reviewed-by Joel Stanley <[email protected]>It'd interesting to add some dummy SLW handlers to get rid of the XSCOM errors at boot and shutdown on P10 :
Quoted 7 lines
[ 4824.393446266,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.393588777,5] Unable to log error
[ 4824.393650582,3] XSCOM: Write failed, ret = -6
[ 4824.394124623,3] Could not set special wakeup on 0:0: Unable to writeQME_SPWU_HYP. [ 4824.394368459,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.394382007,5] Unable to log error
[ 4824.394384603,3] XSCOM: Write failed, ret = -6
Yes. I was looking at this yesterday. We need to figure out how to do the xscom addressing for the QME. It sets (different) bits in order to address a given core.
For a -smp 4 machine, the P10_QME_SPWU_HYP read comes in on these addresses:
case 0x200e883c:
case 0x200e483c:
case 0x200e283c:
case 0x200e183c:ie, the fourth nibble selects the core.
For a -smp 8 machine, the address now has bit 24 set to select the second quad, so we need to cover these addresses:
case 0x210e883c:
case 0x210e483c:
case 0x210e283c:
case 0x210e183c:I am thinking about how to map this into an address range that a model can claim.
Cheers,
Joel
PS. For reference, this is sufficient to silence xscom errors with skiboot and -M powernv10 -smp4. A different set of hacks is required for p9.
hw/ppc/pnv_xscom.c +0 -0
@@ -106,6 +106,26 @@ static uint64_t xscom_read_default(PnvChip *chip,
uint32_t pcba)
case 0x401082a:
case 0x4010828:
return 0;
+
+ /* P10_QME_SPWU_HYP */
+ case 0x200e883c:
+ case 0x200e483c:
+ case 0x200e283c:
+ case 0x200e183c:
+ return 0;
+
+ /* P10_QME_SSH_HYP */
+ case 0x200e882c:
+ case 0x200e482c:
+ case 0x200e282c:
+ case 0x200e182c:
+ return 0;
+
+ /* XPEC_P10_PCI_CPLT_CONF1 */
+ case 0x08000009:
+ case 0x09000009:
+ return 0;
+
default:
return -1;
}@@ -152,6 +172,13 @@ static bool xscom_write_default(PnvChip *chip, uint32_t pcba, uint64_t val)
case PRD_P8_IPOLL_REG_STATUS:
case PRD_P9_IPOLL_REG_MASK:
case PRD_P9_IPOLL_REG_STATUS:
+
+ /* P10_QME_SPWU_HYP */
+ case 0x200e883c:
+ case 0x200e483c:
+ case 0x200e283c:
+ case 0x200e183c:
+
return true;
default:
return false;Quoted 55 lines · Joel Stanley
Quoted 30 lines · Cédric Le Goater
Quoted 23 lines · Joel Stanley
Quoted 8 lines · Nicholas Piggin
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as
0x1000(with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.Signed-off-by Nicholas Piggin <[email protected]>Nice, that looks better:
0000000100000000-00000001000fffff (prio 0, i/o): xscom-quad.0:
0x1000000000000100108000-000000010010ffff (prio 0, i/o): xscom-core.3:0x80000000000100110000-0000000100117fff (prio 0, i/o): xscom-core.2:0x80000000000100120000-0000000100127fff (prio 0, i/o): xscom-core.1:0x80000000000100140000-0000000100147fff (prio 0, i/o): xscom-core.0:0x80000000000108000000-00000001080fffff (prio 0, i/o): xscom-quad.4:0x1000000000000108108000-000000010810ffff (prio 0, i/o): xscom-core.7:0x80000000000108110000-0000000108117fff (prio 0, i/o): xscom-core.6:0x80000000000108120000-0000000108127fff (prio 0, i/o): xscom-core.5:0x80000000000108140000-0000000108147fff (prio 0, i/o): xscom-core.4:0x8000Quoted 1 line
Reviewed-by Joel Stanley <[email protected]>It'd interesting to add some dummy SLW handlers to get rid of the XSCOM errors at boot and shutdown on P10 :
Quoted 7 lines
[ 4824.393446266,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.393588777,5] Unable to log error
[ 4824.393650582,3] XSCOM: Write failed, ret = -6
[ 4824.394124623,3] Could not set special wakeup on 0:0: Unable to writeQME_SPWU_HYP. [ 4824.394368459,3] XSCOM: write error gcid=0x0 pcb_addr=0x200e883c stat=0x0 [ 4824.394382007,5] Unable to log error
[ 4824.394384603,3] XSCOM: Write failed, ret = -6Yes. I was looking at this yesterday. We need to figure out how to do the xscom addressing for the QME. It sets (different) bits in order to address a given core.>
For a -smp 4 machine, the
P10_QME_SPWU_HYPread comes in on these addresses:case 0x200e883c: case 0x200e483c: case 0x200e283c: case 0x200e183c:ie, the fourth nibble selects the core.
For a -smp 8 machine, the address now has bit 24 set to select the second quad, so we need to cover these addresses:
Quoted 7 lines
case 0x210e883c: case 0x210e483c: case 0x210e283c: case 0x210e183c:I am thinking about how to map this into an address range that a model can claim.
OPAL should have the magic macros for XSCOM addresses. I included a few in QEMU.
Quoted 8 lines
Cheers,
Joel
PS. For reference, this is sufficient to silence xscom errors with skiboot and -M powernv10 -smp4. A different set of hacks is required for p9.
Thanks,
C.
Quoted 45 lines
hw/ppc/pnv_xscom.c +20
-0@@ -106,6 +106,26 @@ static uint64_t xscom_read_default(PnvChip *chip, uint32_t pcba)case 0x401082a :case 0x4010828 :return 0 ; + +/* P10_QME_SPWU_HYP */ +case 0x200e883c : +case 0x200e483c : +case 0x200e283c : +case 0x200e183c : +return 0 ; + +/* P10_QME_SSH_HYP */ +case 0x200e882c : +case 0x200e482c : +case 0x200e282c : +case 0x200e182c : +return 0 ; + +/* XPEC_P10_PCI_CPLT_CONF1 */ +case 0x08000009 : +case 0x09000009 : +return 0 ; +default :return -1 ;}hw/ppc/pnv_xscom.c +7
-0@@ -152,6 +172,13 @@ static bool xscom_write_default(PnvChip *chip, uint32_t pcba, uint64_t val)case PRD_P8_IPOLL_REG_STATUS :case PRD_P9_IPOLL_REG_MASK :case PRD_P9_IPOLL_REG_STATUS : + +/* P10_QME_SPWU_HYP */ +case 0x200e883c : +case 0x200e483c : +case 0x200e283c : +case 0x200e183c : +return true;default :return false;
This patch breaks make check-qtest:
$ make -j -C build && make -C build check-qtest (...) 16/44 qemu:qtest+qtest-ppc64 / qtest-ppc64/pnv-xscom-test ERROR 0.89s killed by signal 6 SIGABRT
Quoted 1 line
Quoted 1 line
Quoted 1 line
G_TEST_DBUS_DAEMON=/home/danielhb/powerpc/qemu/tests/dbus-vmstate-daemon.sh QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_BINARY=./qemu-system-ppc64 QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=231
/home/danielhb/powerpc/qemu/build/tests/qtest/pnv-xscom-test--tap -k
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― stderr:
**
ERROR:../tests/qtest/pnv-xscom-test.c:115:test_xscom_core: assertion failed (dts0 == 0x26f024f023f0000ull): (0x00000000 == 0x26f024f023f0000)
(test program exited with status code -6)
――――――――――――――――――――――――――――――――――――――――――――――――
I believe you'll need to take a look at tests/qtest/pnv-xscom-test.c as well.
Thanks,
Daniel
Quoted 40 lines · Nicholas Piggin
The P10 core xscom memory regions overlap because the size is wrong. The P10 core+L2 xscom region size is allocated as
0x1000(with some unused ranges). "EC" is used as a closer match, as "EX" includes L3 which has a disjoint xscom range that would require a different region if it were implemented.Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/pnv_core.c | 3 +-- include/hw/ppc/pnv_xscom.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)hw/ppc/pnv_core.c +1
-2@@ -299,9 +299,8 @@ static void pnv_core_realize(DeviceState *dev, Error **errp) }snprintf (name,sizeof (name),"xscom-core.%d" , cc->core_id); -/* TODO: check PNV_XSCOM_EX_SIZE for p10 */ pnv_xscom_region_init (&pc->xscom_regs,OBJECT (dev), pcc->xscom_ops, - pc, name,PNV_XSCOM_EX_SIZE ); + pc, name,PNV10_XSCOM_EC_SIZE );qemu_register_reset (pnv_core_reset, pc);return ;include/hw/ppc/pnv_xscom.h +1
-1@@ -133,7 +133,7 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_EC_BASE (core) \ ((uint64_t) PNV10_XSCOM_EQ_BASE(core) | PNV10_XSCOM_EC(core & 0x3)) -#define PNV10_XSCOM_EC_SIZE 0x100000 +#define PNV10_XSCOM_EC_SIZE 0x1000#define PNV10_XSCOM_PSIHB_BASE 0x3011D00#define PNV10_XSCOM_PSIHB_SIZE 0x100