misc ppc patches
cover misc ppc patches
Here's a bunch of patches that have been on the list in various forms, but haven't made it upstream yet. I would like to get them merged for 9.0 if possible. The checkstop and attn ones are bigger but they're not so important so I could defer them.
Main change is merging Ben's DEXCR patch from last year with my POWER10 pa-features patch -- his was posted first and added a POWER10 entry so I took his but updated title and changelog.
And changing the SAO and copy-paste patches to always cease advertising them, rather than depending on the host, as per discussion with David.
Thanks,
Nick
Benjamin Gray (1):
ppc/spapr: Add pa-features for POWER10 machines
Nicholas Piggin (12):
ppc: Drop support for POWER9 and POWER10 DD1 chips target/ppc: POWER10 does not have transactional memory ppc/spapr|pnv: Remove SAO from pa-features
ppc/spapr: Remove copy-paste from pa-features ppc/spapr: Adjust ibm,pa-features for POWER9
ppc/pnv: Permit ibm,pa-features set per machine variant ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits target/ppc: Prevent supervisor from modifying MSR[ME]
spapr: set MSR[ME] and MSR[FP] on client entry target/ppc: Make checkstop actually stop the system target/ppc: improve checkstop logging
target/ppc: Implement attn instruction on BookS 64-bit processors
target/ppc/cpu.h | 16 +++++- target/ppc/helper.h | 4 ++ hw/ppc/pnv.c | 104 ++++++++++++++++++++++++++++++++++----- hw/ppc/spapr.c | 63 ++++++++++++++++++++---- hw/ppc/spapr_cpu_core.c | 4 +- target/ppc/cpu-models.c | 4 -- target/ppc/cpu_init.c | 93 +++++++++++++++++++++++++++++----- target/ppc/excp_helper.c | 52 +++++++++++++++----- target/ppc/helper_regs.c | 5 ++ target/ppc/kvm.c | 11 ----- target/ppc/translate.c | 11 +++++ 11 files changed, 304 insertions(+), 63 deletions(-)
Signature · 1 line
2.42.0
PATCH 1/13 ppc: Drop support for POWER9 and POWER10 DD1 chips
The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them.
--- hw/ppc/spapr_cpu_core.c | 2 -- target/ppc/cpu-models.c | 4 ---- target/ppc/cpu_init.c | 7 ++----- target/ppc/kvm.c | 11 ----------- 4 files changed, 2 insertions(+), 22 deletions(-)
hw/ppc/spapr_cpu_core.c +0 -2
@@ -394,10 +394,8 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {DEFINE_SPAPR_CPU_CORE_TYPE ("power8_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power8e_v2.1" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power8nvl_v1.0" ), -DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.2" ), -DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v2.0" ), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"),
target/ppc/cpu-models.c +0 -4
@@ -728,14 +728,10 @@ "POWER8 v2.0") POWERPC_DEF("power8nvl_v1.0", CPU_POWERPC_POWER8NVL_v10, POWER8, "POWER8NVL v1.0") - POWERPC_DEF("power9_v1.0", CPU_POWERPC_POWER9_DD1, POWER9, - "POWER9 v1.0") POWERPC_DEF("power9_v2.0", CPU_POWERPC_POWER9_DD20, POWER9, "POWER9 v2.0") POWERPC_DEF("power9_v2.2", CPU_POWERPC_POWER9_DD22, POWER9, "POWER9 v2.2") - POWERPC_DEF("power10_v1.0", CPU_POWERPC_POWER10_DD1, POWER10, - "POWER10 v1.0") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER10, "POWER10 v2.0")#endif /* defined (TARGET_PPC64) */
target/ppc/cpu_init.c +2 -5
@@ -6350,10 +6350,7 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr, bool best)return false; } -if ((pvr &0x0f00 ) ==0x100 ) { -/* DD1.x always matches power9_v1.0 */ -return true; - }else if ((pvr &0x0f00 ) ==0x200 ) { +if ((pvr &0x0f00 ) ==0x200 ) {if ((pvr &0xf ) <2 ) {/* DD2.0, DD2.1 match power9_v2.0 */ if ((pcc->pvr &0xf ) ==0 ) {
@@ -6536,7 +6533,7 @@ static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr, bool best) }if ((pvr &0x0f00 ) == (pcc->pvr &0x0f00 )) { -/* Major DD version matches to power10_v1.0 and power10_v2.0 */ +/* Major DD version matches power10_v2.0 */ return true; }
target/ppc/kvm.c +0 -11
@@ -2369,17 +2369,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)#if defined(TARGET_PPC64 ) pcc->radix_page_info =kvmppc_get_radix_page_info (); - -if ((pcc->pvr &0xffffff00 ) ==CPU_POWERPC_POWER9_DD1 ) { -/* -* POWER9 DD1 has some bugs which make it not really ISA 3.00 -* compliant. More importantly, advertising ISA 3.00 -* architected mode may prevent guests from activating -* necessary DD1 workarounds. -*/ - pcc->pcr_supported &= ~(PCR_COMPAT_3_00 |PCR_COMPAT_2_07 - |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ); - }#endif /* defined(TARGET_PPC64) */ }
Signature · 1 line
2.42.0
Re: [PATCH 01/13] ppc: Drop support for POWER9 and POWER10 DD1 chips
Quoted 10 lines · Nicholas Piggin
The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them.
Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr_cpu_core.c | 2 -- target/ppc/cpu-models.c | 4 ---- target/ppc/cpu_init.c | 7 ++----- target/ppc/kvm.c | 11 ----------- 4 files changed, 2 insertions(+), 22 deletions(-)
Do we want to squash in removal of the macro as well?
target/ppc/cpu-models.h +0 -1
@@ -348,7 +348,6 @@ enum {CPU_POWERPC_POWER8NVL_BASE =0x004C0000 , CPU_POWERPC_POWER8NVL_v10 =0x004C0100 ,CPU_POWERPC_POWER9_BASE =0x004E0000 , -CPU_POWERPC_POWER9_DD1 =0x004E1100 ,CPU_POWERPC_POWER9_DD20 =0x004E1200 ,CPU_POWERPC_POWER9_DD22 =0x004E1202 , CPU_POWERPC_POWER10_BASE = 0x00800000,
With that,
regards,
Harsh
Quoted 82 lines
hw/ppc/spapr_cpu_core.c +0
-2@@ -394,10 +394,8 @@ static const TypeInfo spapr_cpu_core_type_infos[] = {DEFINE_SPAPR_CPU_CORE_TYPE ("power8_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power8e_v2.1" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power8nvl_v1.0" ), -DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power9_v2.2" ), -DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v1.0" ),DEFINE_SPAPR_CPU_CORE_TYPE ("power10_v2.0" ), #ifdef CONFIG_KVM DEFINE_SPAPR_CPU_CORE_TYPE("host"),target/ppc/cpu-models.c +0
-4@@ -728,14 +728,10 @@ "POWER8 v2.0") POWERPC_DEF("power8nvl_v1.0", CPU_POWERPC_POWER8NVL_v10, POWER8, "POWER8NVL v1.0") - POWERPC_DEF("power9_v1.0", CPU_POWERPC_POWER9_DD1, POWER9, - "POWER9 v1.0") POWERPC_DEF("power9_v2.0", CPU_POWERPC_POWER9_DD20, POWER9, "POWER9 v2.0") POWERPC_DEF("power9_v2.2", CPU_POWERPC_POWER9_DD22, POWER9, "POWER9 v2.2") - POWERPC_DEF("power10_v1.0", CPU_POWERPC_POWER10_DD1, POWER10, - "POWER10 v1.0") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER10, "POWER10 v2.0")#endif /* defined (TARGET_PPC64) */ target/ppc/cpu_init.c +2
-5@@ -6350,10 +6350,7 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr, bool best)return false; } -if ((pvr &0x0f00 ) ==0x100 ) { -/* DD1.x always matches power9_v1.0 */ -return true; - }else if ((pvr &0x0f00 ) ==0x200 ) { +if ((pvr &0x0f00 ) ==0x200 ) {if ((pvr &0xf ) <2 ) {/* DD2.0, DD2.1 match power9_v2.0 */ if ((pcc->pvr &0xf ) ==0 ) {@@ -6536,7 +6533,7 @@ static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr, bool best) }if ((pvr &0x0f00 ) == (pcc->pvr &0x0f00 )) { -/* Major DD version matches to power10_v1.0 and power10_v2.0 */ +/* Major DD version matches power10_v2.0 */ return true; }target/ppc/kvm.c +0
-11@@ -2369,17 +2369,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)#if defined(TARGET_PPC64 ) pcc->radix_page_info =kvmppc_get_radix_page_info (); - -if ((pcc->pvr &0xffffff00 ) ==CPU_POWERPC_POWER9_DD1 ) { -/* -* POWER9 DD1 has some bugs which make it not really ISA 3.00 -* compliant. More importantly, advertising ISA 3.00 -* architected mode may prevent guests from activating -* necessary DD1 workarounds. -*/ - pcc->pcr_supported &= ~(PCR_COMPAT_3_00 |PCR_COMPAT_2_07 - |PCR_COMPAT_2_06 |PCR_COMPAT_2_05 ); - }#endif /* defined(TARGET_PPC64) */ }
Re: [PATCH 01/13] ppc: Drop support for POWER9 and POWER10 DD1 chips
Quoted 14 lines · Harsh Prateek Bora
Quoted 10 lines · Nicholas Piggin
The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them.
Signed-off-by Nicholas Piggin <[email protected]>---
hw/ppc/spapr_cpu_core.c| 2 --
target/ppc/cpu-models.c| 4 ----
target/ppc/cpu_init.c | 7 ++-----
target/ppc/kvm.c | 11 -----------4 files changed, 2 insertions(+), 22 deletions(-)
Quoted 2 lines
Do we want to squash in removal of the macro as well?
<snip>
Actually both, correcting diff:
target/ppc/cpu-models.h +0 -2
@@ -348,11 +348,9 @@ enum {CPU_POWERPC_POWER8NVL_BASE =0x004C0000 , CPU_POWERPC_POWER8NVL_v10 =0x004C0100 ,CPU_POWERPC_POWER9_BASE =0x004E0000 , -CPU_POWERPC_POWER9_DD1 =0x004E1100 ,CPU_POWERPC_POWER9_DD20 =0x004E1200 ,CPU_POWERPC_POWER9_DD22 =0x004E1202 ,CPU_POWERPC_POWER10_BASE =0x00800000 , -CPU_POWERPC_POWER10_DD1 =0x00801100 ,CPU_POWERPC_POWER10_DD20 =0x00801200 , CPU_POWERPC_970_v22 =0x00390202 , CPU_POWERPC_970FX_v10 = 0x00391100,
Quoted 92 lines
With that,
Reviewed-by Harsh Prateek Bora <[email protected]>regards,
HarshQuoted 83 lines
hw/ppc/spapr_cpu_core.c +0
-2@@ -394,10 +394,8 @@ static const TypeInfo spapr_cpu_core_type_infos[] = { DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power8e_v2.1"), DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"), - DEFINE_SPAPR_CPU_CORE_TYPE("power9_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.2"), - DEFINE_SPAPR_CPU_CORE_TYPE("power10_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power10_v2.0"), #ifdef CONFIG_KVM
DEFINE_SPAPR_CPU_CORE_TYPE("host"),target/ppc/cpu-models.c +0
-4@@ -728,14 +728,10 @@ "POWER8 v2.0") POWERPC_DEF("power8nvl_v1.0", CPU_POWERPC_POWER8NVL_v10, POWER8, "POWER8NVL v1.0") - POWERPC_DEF("power9_v1.0", CPU_POWERPC_POWER9_DD1,POWER9 , - "POWER9 v1.0") POWERPC_DEF("power9_v2.0", CPU_POWERPC_POWER9_DD20, POWER9, "POWER9 v2.0") POWERPC_DEF("power9_v2.2", CPU_POWERPC_POWER9_DD22, POWER9, "POWER9 v2.2") - POWERPC_DEF("power10_v1.0", CPU_POWERPC_POWER10_DD1,POWER10 , - "POWER10 v1.0") POWERPC_DEF("power10_v2.0", CPU_POWERPC_POWER10_DD20, POWER10,"POWER10 v2.0")
#endif /* defined (TARGET_PPC64) */target/ppc/cpu_init.c +2
-5@@ -6350,10 +6350,7 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr, bool best) return false; } - if ((pvr & 0x0f00) == 0x100) { - /* DD1.x always matches power9_v1.0 */ - return true; - } else if ((pvr & 0x0f00) == 0x200) { + if ((pvr & 0x0f00) == 0x200) { if ((pvr & 0xf) < 2) { /* DD2.0, DD2.1 match power9_v2.0 */ if ((pcc->pvr & 0xf) == 0) {@@ -6536,7 +6533,7 @@ static bool ppc_pvr_match_power10(PowerPCCPUClass *pcc, uint32_t pvr, bool best) } if ((pvr & 0x0f00) == (pcc->pvr & 0x0f00)) { - /* Major DD version matches to power10_v1.0 and power10_v2.0 */ + /* Major DD version matches power10_v2.0 */ return true; }target/ppc/kvm.c +0
-11@@ -2369,17 +2369,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data) #if defined(TARGET_PPC64) pcc->radix_page_info = kvmppc_get_radix_page_info(); - - if ((pcc->pvr & 0xffffff00) == CPU_POWERPC_POWER9_DD1) { - /* - * POWER9 DD1 has some bugs which make it not really ISA 3.00 - * compliant. More importantly, advertising ISA 3.00 - * architected mode may prevent guests from activating - * necessary DD1 workarounds. - */ - pcc->pcr_supported &= ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 - | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); - } #endif /* defined(TARGET_PPC64) */ }
Re: [PATCH 01/13] ppc: Drop support for POWER9 and POWER10 DD1 chips
Quoted 29 lines · Harsh Prateek Bora
Quoted 14 lines · Harsh Prateek Bora
Quoted 10 lines · Nicholas Piggin
The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them.
Signed-off-by Nicholas Piggin <[email protected]>---
hw/ppc/spapr_cpu_core.c| 2 --
target/ppc/cpu-models.c| 4 ----
target/ppc/cpu_init.c | 7 ++-----
target/ppc/kvm.c | 11 -----------4 files changed, 2 insertions(+), 22 deletions(-)Quoted 2 lines
Do we want to squash in removal of the macro as well?
<snip>
Actually both, correcting diff:target/ppc/cpu-models.h +0
-0@@ -348,11 +348,9 @@ enum { CPU_POWERPC_POWER8NVL_BASE = 0x004C0000,
target/ppc/cpu-models.h enum { · line 356
Quoted 10 lines
target/ppc/cpu-models.h +0
-2CPU_POWERPC_POWER8NVL_v10 =0x004C0100 ,CPU_POWERPC_POWER9_BASE =0x004E0000 , -CPU_POWERPC_POWER9_DD1 =0x004E1100 ,CPU_POWERPC_POWER9_DD20 =0x004E1200 ,CPU_POWERPC_POWER9_DD22 =0x004E1202 ,CPU_POWERPC_POWER10_BASE =0x00800000 , -CPU_POWERPC_POWER10_DD1 =0x00801100 ,CPU_POWERPC_POWER10_DD20 =0x00801200 , CPU_POWERPC_970_v22 =0x00390202 , CPU_POWERPC_970FX_v10 = 0x00391100,
That would make sense, but we do seem to use this list as somewhat of a reference or at least historic graveyard too (note all the other CPUs we no longer support). So I was going to just leave them there.
Thanks,
Nick
Re: [PATCH 01/13] ppc: Drop support for POWER9 and POWER10 DD1 chips
Quoted 36 lines · Nicholas Piggin
Quoted 35 lines · Harsh Prateek Bora
Quoted 14 lines · Harsh Prateek Bora
Quoted 10 lines · Nicholas Piggin
The POWER9 DD1 and POWER10 DD1 chips are not public and are no longer of any use in QEMU. Remove them.
Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr_cpu_core.c | 2 -- target/ppc/cpu-models.c | 4 ---- target/ppc/cpu_init.c | 7 ++----- target/ppc/kvm.c | 11 ----------- 4 files changed, 2 insertions(+), 22 deletions(-)Quoted 2 lines
Do we want to squash in removal of the macro as well?
<snip>
Actually both, correcting diff:target/ppc/cpu-models.h +0
-1@@ -348,11 +348,9 @@ enum {CPU_POWERPC_POWER8NVL_BASE =0x004C0000 , CPU_POWERPC_POWER8NVL_v10 =0x004C0100 ,CPU_POWERPC_POWER9_BASE =0x004E0000 , -CPU_POWERPC_POWER9_DD1 =0x004E1100 ,CPU_POWERPC_POWER9_DD20 =0x004E1200 ,CPU_POWERPC_POWER9_DD22 =0x004E1202 , CPU_POWERPC_POWER10_BASE = 0x00800000,
Quoted 8 lines
target/ppc/cpu-models.h enum { · line 356
Quoted 4 lines
target/ppc/cpu-models.h +0
-1-CPU_POWERPC_POWER10_DD1 =0x00801100 ,CPU_POWERPC_POWER10_DD20 =0x00801200 , CPU_POWERPC_970_v22 =0x00390202 , CPU_POWERPC_970FX_v10 = 0x00391100,That would make sense, but we do seem to use this list as somewhat of a reference or at least historic graveyard too (note all the other CPUs we no longer support). So I was going to just leave them there.
Oh ok, in that case, it's fine.
regards,
Harsh
Quoted 3 lines
Thanks,
Nick
PATCH 2/13 target/ppc: POWER10 does not have transactional memory
In reply to Nicholas PigginPOWER10 hardware implements a degenerate transactional memory facility in POWER8/9 PCR compatibility modes to permit migration from older CPUs, but POWER10 / ISA v3.1 mode does not support it so the CPU model should not support it.
--- target/ppc/cpu_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/ppc/cpu_init.c +2 -2
@@ -6573,7 +6573,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | -PPC2_TM |PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 | +PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ; pcc->msr_mask = (1ull <<MSR_SF ) | (1ull << MSR_HV) |
@@ -6617,7 +6617,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM |POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_TM |POWERPC_FLAG_SCV ; +POWERPC_FLAG_VSX |POWERPC_FLAG_SCV ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
Signature · 1 line
2.42.0
Re: [PATCH 02/13] target/ppc: POWER10 does not have transactional memory
Hi Nick,
One query/comment below:
Quoted 24 lines · Nicholas Piggin
POWER10 hardware implements a degenerate transactional memory facility in POWER8/9 PCR compatibility modes to permit migration from older CPUs, but POWER10 / ISA v3.1 mode does not support it so the CPU model should not support it.
Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/cpu_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu_init.c +1
-1@@ -6573,7 +6573,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | -PPC2_TM |PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 | +PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ; pcc->msr_mask = (1ull <<MSR_SF ) | (1ull << MSR_HV) |
target/ppc/cpu_init.c POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) · line 6623
Quoted 8 lines
target/ppc/cpu_init.c +1
-1@@ -6617,7 +6617,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM |POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_TM |POWERPC_FLAG_SCV ; +POWERPC_FLAG_VSX |POWERPC_FLAG_SCV ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }
Shouldn't we also have below change included with this:
target/ppc/cpu_init.c +0 -1
@@ -6641,7 +6641,6 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 |PPC2_ATTN ; pcc->msr_mask = (1ull <<MSR_SF ) | (1ull <<MSR_HV ) | - (1ull <<MSR_TM ) | (1ull <<MSR_VR ) | (1ull <<MSR_VSX ) | (1ull << MSR_EE) |
Otherwise,
Re: [PATCH 02/13] target/ppc: POWER10 does not have transactional memory
Quoted 45 lines · Harsh Prateek Bora
Hi Nick,
One query/comment below:
Quoted 24 lines · Nicholas Piggin
POWER10 hardware implements a degenerate transactional memory facility in POWER8/9 PCR compatibility modes to permit migration from older CPUs, but POWER10 / ISA v3.1 mode does not support it so the CPU model should not support it.
Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/cpu_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)target/ppc/cpu_init.c +1
-1@@ -6573,7 +6573,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)PPC2_FP_TST_ISA206 |PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 |PPC2_ALTIVEC_207 |PPC2_ISA205 |PPC2_ISA207S |PPC2_FP_CVT_S64 | -PPC2_TM |PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 | +PPC2_ISA300 |PPC2_PRCNTL |PPC2_ISA310 |PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 ; pcc->msr_mask = (1ull <<MSR_SF ) | (1ull << MSR_HV) |target/ppc/cpu_init.c POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) · line 6623
Quoted 8 lines
target/ppc/cpu_init.c +1
-1@@ -6617,7 +6617,7 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) pcc->flags =POWERPC_FLAG_VRE |POWERPC_FLAG_SE |POWERPC_FLAG_BE |POWERPC_FLAG_PMM |POWERPC_FLAG_BUS_CLK |POWERPC_FLAG_CFAR | -POWERPC_FLAG_VSX |POWERPC_FLAG_TM |POWERPC_FLAG_SCV ; +POWERPC_FLAG_VSX |POWERPC_FLAG_SCV ; pcc->l1_dcache_size =0x8000 ; pcc->l1_icache_size =0x8000 ; }Shouldn't we also have below change included with this:
target/ppc/cpu_init.c +0
-0
target/ppc/cpu_init.c POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data) · line 6646
Quoted 7 lines
target/ppc/cpu_init.c +0
-1@@ -6641,7 +6641,6 @@ POWERPC_FAMILY(POWER10)(ObjectClass *oc, void *data)PPC2_MEM_LWSYNC |PPC2_BCDA_ISA206 |PPC2_ATTN ; pcc->msr_mask = (1ull <<MSR_SF ) | (1ull <<MSR_HV ) | - (1ull <<MSR_TM ) | (1ull <<MSR_VR ) | (1ull <<MSR_VSX ) | (1ull << MSR_EE) |
I think you're probably right. I'll do some testing...
Thanks,
Nick
Quoted 3 lines
Otherwise,
Reviewed-by Harsh Prateek Bora <[email protected]>
PATCH 3/13 ppc/spapr|pnv: Remove SAO from pa-features
In reply to Nicholas PigginSAO is a page table attribute that strengthens the memory ordering of accesses. QEMU with MTTCG does not implement this, so clear it in ibm,pa-features. This is an obscure feature that has been removed from POWER10 ISA v3.1, there isn't much concern with removing it.
--- hw/ppc/pnv.c | 2 +- hw/ppc/spapr.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)
hw/ppc/pnv.c +1 -1
@@ -150,7 +150,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size;const uint8_t pa_features[] = {24 ,0 , -0xf6 ,0x3f ,0xc7 ,0xc0 ,0x80 ,0xf0 , +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 };
hw/ppc/spapr.c +10 -4
@@ -234,16 +234,16 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, void *fdt, int offset) { uint8_t pa_features_206[] = { 6, 0, -0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 }; +0xf6 ,0x1f ,0xc7 ,0x00 ,0x00 ,0xc0 };uint8_t pa_features_207[] = {24 ,0 , -0xf6 ,0x1f ,0xc7 ,0xc0 ,0x80 ,0xf0 , +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 }; uint8_t pa_features_300[] = { 66, 0, /* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ - /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, SSO, 5: LE|CFAR|EB|LSQ */ - 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, /* 0 - 5 */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ + 0xf6, 0x1f, 0xc7, 0xc0, 0x00, 0xf0, /* 0 - 5 */ /* 6: DS207 */ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 - 11 */ /* 16: Vector */
@@ -284,6 +284,12 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,return ; } +/* +* SSO (SAO) ordering is supported on KVM and thread=single hosts, +* but not MTTCG, so disable it. To advertise it, a cap would have +* to be added, or support implemented for MTTCG. +*/ +if (ppc_hash64_has (cpu,PPC_HASH64_CI_LARGEPAGE )) {/* * Note: we keep CI large pages off by default because a 64K capable
Signature · 1 line
2.42.0
Re: [PATCH 03/13] ppc/spapr|pnv: Remove SAO from pa-features
Hi Nick,
One cosmetic comment, in case you are doing a re-spin:
Quoted 35 lines · Nicholas Piggin
SAO is a page table attribute that strengthens the memory ordering of accesses. QEMU with MTTCG does not implement this, so clear it in ibm,pa-features. This is an obscure feature that has been removed from POWER10 ISA v3.1, there isn't much concern with removing it.
Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/pnv.c | 2 +- hw/ppc/spapr.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-)hw/ppc/pnv.c +1
-1@@ -150,7 +150,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size;const uint8_t pa_features[] = {24 ,0 , -0xf6 ,0x3f ,0xc7 ,0xc0 ,0x80 ,0xf0 , +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 };hw/ppc/spapr.c +1
-1@@ -234,16 +234,16 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, void *fdt, int offset) { uint8_t pa_features_206[] = { 6, 0, -0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 }; +0xf6 ,0x1f ,0xc7 ,0x00 ,0x00 ,0xc0 }; uint8_t pa_features_207[] = { 24, 0,
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 245
Quoted 10 lines
hw/ppc/spapr.c +2
-3-0xf6 ,0x1f ,0xc7 ,0xc0 ,0x80 ,0xf0 , +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 };uint8_t pa_features_300[] = {66 ,0 ,/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ -/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, SSO, 5: LE|CFAR|EB|LSQ */ - 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, /* 0 - 5 */ + /* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */
Do we want to mention in comments SSO (disabled), also ..
Quoted 5 lines
hw/ppc/spapr.c +1
-0+0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ /* 6: DS207 */ 0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ /* 16: Vector */
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 292
Quoted 9 lines
hw/ppc/spapr.c +6
-0@@ -284,6 +284,12 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,return ; } +/* +* SSO (SAO) ordering is supported on KVM and thread=single hosts, +* but not MTTCG, so disable it. To advertise it, a cap would have +* to be added, or support implemented for MTTCG. +*/ +
This comment could go in the beginning where we are actually disabling it.
Otherwise,
Quoted 3 lines
hw/ppc/spapr.c +0
-0if (ppc_hash64_has (cpu,PPC_HASH64_CI_LARGEPAGE )) {/* * Note: we keep CI large pages off by default because a 64K capable
PATCH 4/13 ppc/spapr: Remove copy-paste from pa-features
In reply to Nicholas PigginTCG does not support copy/paste instructions. Remove it from ibm,pa-features. This has never been implemented under TCG or practically usable under KVM, so it won't be missed.
--- hw/ppc/spapr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +6 -2
@@ -254,8 +254,8 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ /* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ 0x80 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ -/* 36: SPR SO, 38: Copy/Paste, 40: Radix MMU */ -0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 36: SPR SO, 40: Radix MMU */ +0x80 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */
@@ -288,6 +288,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,* SSO (SAO) ordering is supported on KVM and thread=single hosts, * but not MTTCG, so disable it. To advertise it, a cap would have * to be added, or support implemented for MTTCG. +* +* Copy/paste is not supported by TCG, so it is not advertised. KVM +* can execute them but it has no accelerator drivers which are usable, +* so there isn't much need for it anyway. */ if (ppc_hash64_has (cpu,PPC_HASH64_CI_LARGEPAGE )) {
Signature · 1 line
2.42.0
Re: [PATCH 04/13] ppc/spapr: Remove copy-paste from pa-features
Hi Nick,
Quoted 2 lines · Nicholas Piggin
TCG does not support copy/paste instructions. Remove it from ibm,pa-features. This has never been implemented under TCG or
s/or/nor ?
Quoted 23 lines
practically usable under KVM, so it won't be missed.
Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)hw/ppc/spapr.c +2
-2@@ -254,8 +254,8 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ /* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ 0x80 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ -/* 36: SPR SO, 38: Copy/Paste, 40: Radix MMU */ -0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 36: SPR SO, 40: Radix MMU */ +0x80 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 295
Quoted 8 lines
hw/ppc/spapr.c +4
-0@@ -288,6 +288,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,* SSO (SAO) ordering is supported on KVM and thread=single hosts, * but not MTTCG, so disable it. To advertise it, a cap would have * to be added, or support implemented for MTTCG. +* +* Copy/paste is not supported by TCG, so it is not advertised. KVM +* can execute them but it has no accelerator drivers which are usable, +* so there isn't much need for it anyway. */
If doing a re-spin, you may consider comments on prev patch applicable above as well. Either ways, with prev typo fixed:
Quoted 2 lines
hw/ppc/spapr.c +0
-0if (ppc_hash64_has (cpu,PPC_HASH64_CI_LARGEPAGE )) {
PATCH 5/13 ppc/spapr: Adjust ibm,pa-features for POWER9
In reply to Nicholas Piggin"MMR" and "SPR SO" are not implemented in POWER9, so clear those bits. HTM is not set by default, and only later if the cap is set, so remove the comment that suggests otherwise.
--- hw/ppc/spapr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/ppc/spapr.c +5 -5
@@ -248,14 +248,14 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ /* 16: Vector */ 0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ -/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +/* 18: Vec. Scalar, 20: Vec. XOR */ 0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ -/* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ -0x80 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ -/* 36: SPR SO, 40: Radix MMU */ -0x80 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */
Signature · 1 line
2.42.0
Re: [PATCH 05/13] ppc/spapr: Adjust ibm,pa-features for POWER9
Quoted 5 lines · Nicholas Piggin
"MMR" and "SPR SO" are not implemented in POWER9, so clear those bits. HTM is not set by default, and only later if the cap is set, so remove the comment that suggests otherwise.
Signed-off-by Nicholas Piggin <[email protected]>
Quoted 28 lines
--- hw/ppc/spapr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/ppc/spapr.c +5
-5@@ -248,14 +248,14 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ /* 16: Vector */ 0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ -/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +/* 18: Vec. Scalar, 20: Vec. XOR */ 0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ /* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ -/* 30: MMR, 32: LE atomic, 34: EBB + ext EBB */ -0x80 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ -/* 36: SPR SO, 40: Radix MMU */ -0x80 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ /* 42: PM, 44: PC RA, 46: SC vec'd */ 0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ /* 48: SIMD, 50: QP BFP, 52: String */
PATCH 6/13 ppc/spapr: Add pa-features for POWER10 machines
In reply to Nicholas PigginFrom: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
hw/ppc/spapr.c +34 -0
@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ +uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ +0x80 ,0x00 ,/* 72 - 73 */ + };uint8_t *pa_features =NULL ;size_t pa_size;
@@ -280,6 +310,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, pa_features = pa_features_300; pa_size =sizeof (pa_features_300); } +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , cpu->compat_pvr)) { + pa_features = pa_features_31; + pa_size =sizeof (pa_features_31); + }if (!pa_features) {return ; }
Signature · 1 line
2.42.0
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 22 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 269
Quoted 5 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ +uint8_t pa_features_31[] = {74 ,0 ,
Nitpicking because pre-existing, all these arrays could be static const.
Quoted 42 lines
hw/ppc/spapr.c +32
-0+/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ + 0x80, 0x00, /* 72 - 73 */ + };uint8_t *pa_features =NULL ;size_t pa_size;@@ -280,6 +310,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, pa_features = pa_features_300; pa_size =sizeof (pa_features_300); } +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , cpu->compat_pvr)) { + pa_features = pa_features_31; + pa_size =sizeof (pa_features_31); + }if (!pa_features) {return ; }
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
Quoted 13 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState · line 270
Quoted 11 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ + uint8_t pa_features_31[] = { 74, 0,Nitpicking because pre-existing, all these arrays could be static const.
If we are at it then maybe also s/0x00/ 0/ because having a stream of 0x80 and 0x00 is not the most readable.
Regards,
BALATON Zoltan
Quoted 47 lines
Quoted 44 lines
hw/ppc/spapr.c +28
-0+/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ + 0x80, 0x00, /* 72 - 73 */ + };uint8_t *pa_features =NULL ;size_t pa_size; @@ -280,6 +310,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, pa_features = pa_features_300; pa_size = sizeof(pa_features_300); }+ if (ppc_check_compat(cpu,
CPU_POWERPC_LOGICAL_3_10, 0,cpu->compat_pvr)) {hw/ppc/spapr.c +3
-0+ pa_features = pa_features_31; + pa_size =sizeof (pa_features_31); + }if (!pa_features) {return ; }
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 33 lines · BALATON Zoltan
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)Quoted 13 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState · line 270
Quoted 11 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ + uint8_t pa_features_31[] = { 74, 0,Nitpicking because pre-existing, all these arrays could be static const.
Quoted 2 lines
If we are at it then maybe also s/0x00/ 0/ because having a stream of
0x80and0x00is not the most readable.
Eh, it's more readable because it aligns colums. But probably better more readable and less error prone would be like -
PA_FEATURE_SET(pa_features_31, 6, 0); /* DS207 */
PA_FEATURE_SET(pa_features_31, 18, 0); /* Vector scalar */I just didn't quite find something I like yet. I won't change style before adding the missing bits either way, but certainly would be good to clean it up after.
Thanks,
Nick
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 34 lines · Nicholas Piggin
Quoted 33 lines · BALATON Zoltan
Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/ppc/spapr.c +0
-0hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState · line 270
Quoted 6 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ + uint8_t pa_features_31[] = { 74, 0,Nitpicking because pre-existing, all these arrays could be static const.
Quoted 4 lines
Quoted 2 lines
If we are at it then maybe also s/0x00/ 0/ because having a stream of
0x80and0x00is not the most readable.Eh, it's more readable because it aligns colums.
Not sure it you've noticed the 3 spaces before the 0 replacing 0x0 that would keep alignment. But it's not something that needs to be changed just commented on it as it came up but I don't expect it to be done now on the day of the freeze. It's more important to get the already reviewed and queued patches in a pull request to not miss the release. So this comment is just for the fuuture.
Regards,
BALATON Zoltan
Quoted 14 lines
But probably better
more readable and less error prone would be like -PA_FEATURE_SET(pa_features_31, 6, 0); /* DS207 */ PA_FEATURE_SET(pa_features_31, 18, 0); /* Vector scalar */I just didn't quite find something I like yet. I won't change style before adding the missing bits either way, but certainly would be good to clean it up after.
Thanks,
Nick
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 35 lines · BALATON Zoltan
Quoted 34 lines · Nicholas Piggin
Quoted 33 lines · BALATON Zoltan
Quoted 31 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/ppc/spapr.c +0
-0hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState · line 270
Quoted 6 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ + uint8_t pa_features_31[] = { 74, 0,Nitpicking because pre-existing, all these arrays could be static const.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
If we are at it then maybe also s/0x00/ 0/ because having a stream of
0x80and0x00is not the most readable.Eh, it's more readable because it aligns colums.
Not sure it you've noticed the 3 spaces before the 0 replacing
0x0that would keep alignment.
Oh, yeah I guess that would be a more obvious zero rather than hunting for 8s. You're right.
Quoted 5 lines
But it's not something that needs to be changed just commented on it as it came up but I don't expect it to be done now on the day of the freeze. It's more important to get the already reviewed and queued patches in a pull request to not miss the release. So this comment is just for the fuuture.
Yeah we should rework it completely. Anyway thanks for taking a look.
Thanks,
Nick
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
In reply to Philippe Mathieu-DaudéQuoted 18 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
Quoted 12 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 269
Quoted 10 lines
hw/ppc/spapr.c +2
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ +uint8_t pa_features_31[] = {74 ,0 ,Nitpicking because pre-existing, all these arrays could be static const.
That's true. I was looking for a nicer way to do it, probably generate the bits with macros and share between spapr and pnv. This is just a quick dumb approach to getting the missing bits in for now.
Thanks,
Nick
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
In reply to Nicholas PigginQuoted 5 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is
s/and and/and
Quoted 38 lines
advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/ppc/spapr.c +18
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ +uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 295
Quoted 10 lines
hw/ppc/spapr.c +10
-0+0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ + /* 72: [P]HASHCHK */
Do we want to mention [P]HASHST as well in comment above ?
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 300
Quoted 5 lines
hw/ppc/spapr.c +2
-0+ 0x80, 0x00, /* 72 - 73 */ + };uint8_t *pa_features =NULL ;size_t pa_size;
In future, we may want to have helpers returning pointer to the pa_features array and corresponding size conditionally based on the required ISA support needed, instead of having local arrays bloat this routine.
For now, with cosmetic fixes,
Quoted 11 lines
hw/ppc/spapr.c +4
-0@@ -280,6 +310,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, pa_features = pa_features_300; pa_size =sizeof (pa_features_300); } +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , cpu->compat_pvr)) { + pa_features = pa_features_31; + pa_size =sizeof (pa_features_31); + }if (!pa_features) {return ; }
Re: [PATCH 06/13] ppc/spapr: Add pa-features for POWER10 machines
Quoted 53 lines · Harsh Prateek Bora
Quoted 5 lines · Nicholas Piggin
From: Benjamin Gray <[email protected]>
Add POWER10 pa-features entry.
Notably DEXCR and and [P]HASHST/[P]HASHCHK instruction support is
s/and and/and
Quoted 42 lines
advertised. Each DEXCR aspect is allocated a bit in the device tree, using the 68--71 byte range (inclusive). The functionality of the [P]HASHST/[P]HASHCHK instructions is separately declared in byte 72, bit 0 (BE).
Signed-off-by Benjamin Gray <[email protected]>[npiggin: reword title and changelog, adjust a few bits]Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)hw/ppc/spapr.c +22
-0@@ -265,6 +265,36 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,/* 60: NM atomic, 62: RNG */ 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, /* 60 - 65 */ }; +/* 3.1 removes SAO, HTM support */ +uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x1f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */
Quoted 8 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 295
Quoted 6 lines
hw/ppc/spapr.c +6
-0+0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ + /* 72: [P]HASHCHK */Do we want to mention [P]HASHST as well in comment above ?
Sure. I'll do a quick respin.
Thanks,
Nick
Quoted 27 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 300
Quoted 6 lines
hw/ppc/spapr.c +2
-0+ 0x80, 0x00, /* 72 - 73 */ + };uint8_t *pa_features =NULL ;size_t pa_size;In future, we may want to have helpers returning pointer to the
pa_featuresarray and corresponding size conditionally based on the required ISA support needed, instead of having local arrays bloat this routine.For now, with cosmetic fixes,
Reviewed-by Harsh Prateek Bora <[email protected]>Quoted 11 lines
hw/ppc/spapr.c +4
-0@@ -280,6 +310,10 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, pa_features = pa_features_300; pa_size =sizeof (pa_features_300); } +if (ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_10 ,0 , cpu->compat_pvr)) { + pa_features = pa_features_31; + pa_size =sizeof (pa_features_31); + }if (!pa_features) {return ; }
PATCH 7/13 ppc/pnv: Permit ibm, pa-features set per machine variant
In reply to Nicholas PigginThis allows different pa-features for powernv8/9/10.
--- hw/ppc/pnv.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
hw/ppc/pnv.c +29 -12
@@ -133,7 +133,7 @@ static int get_cpus_node(void *fdt)* device tree, used in XSCOM to address cores and in interrupt * servers. */ -static void pnv_dt_core (PnvChip *chip,PnvCore *pc,void *fdt) +static int pnv_dt_core (PnvChip *chip,PnvCore *pc,void *fdt) {PowerPCCPU *cpu = pc->threads[0 ];CPUState *cs =CPU (cpu);
@@ -149,11 +149,6 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)uint32_t cpufreq =1000000000 ;uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size; -const uint8_t pa_features[] = {24 ,0 , -0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 , -0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , -0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 };int offset;char *nodename;int cpus_offset =get_cpus_node (fdt);
@@ -236,15 +231,14 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) page_sizes_prop, page_sizes_prop_size))); } -_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features,sizeof (pa_features)))); -/* Build interrupt servers properties */ for (i =0 ; i < smt_threads; i++) { servers_prop[i] =cpu_to_be32 (pc->pir + i); }_FDT ((fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , servers_prop,sizeof (*servers_prop) * smt_threads))); + +return offset; } static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,
@@ -299,6 +293,17 @@ PnvChip *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb)return chip; } +/* +* Same as spapr pa_features_207 except pnv always enables CI largepages bit. +* HTM is always enabled because TCG does implement HTM, it's just a +* degenerate implementation. +*/ +static const uint8_t pa_features_207[] = {24 ,0 , +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 , +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 }; +static void pnv_chip_power8_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power8-xscom\0ibm,xscom" ;
@@ -311,8 +316,12 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); -pnv_dt_core (chip, pnv_core, fdt); +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207))));/* Interrupt Control Presenters (ICP). One per core. */ pnv_dt_icp (chip, fdt, pnv_core->pir,CPU_CORE (pnv_core)->nr_threads);
@@ -335,8 +344,12 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; -pnv_dt_core (chip, pnv_core, fdt); + offset =pnv_dt_core (chip, pnv_core, fdt); + +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207)))); }if (chip->ram_size) {
@@ -358,8 +371,12 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); -pnv_dt_core (chip, pnv_core, fdt); +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207)))); }if (chip->ram_size) {
Signature · 1 line
2.42.0
Re: [PATCH 07/13] ppc/pnv: Permit ibm,pa-features set per machine variant
Quoted 5 lines · Nicholas Piggin
This allows different pa-features for powernv8/9/10.
Cc "Cédric Le Goater" <[email protected]>Cc "Frédéric Barrat" <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
The features could be a chip class attribute instead.
Thanks,
C.
Quoted 107 lines
--- hw/ppc/pnv.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)hw/ppc/pnv.c +29
-12@@ -133,7 +133,7 @@ static int get_cpus_node(void *fdt)* device tree, used in XSCOM to address cores and in interrupt * servers. */ -static void pnv_dt_core (PnvChip *chip,PnvCore *pc,void *fdt) +static int pnv_dt_core (PnvChip *chip,PnvCore *pc,void *fdt) {PowerPCCPU *cpu = pc->threads[0 ];CPUState *cs =CPU (cpu);@@ -149,11 +149,6 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)uint32_t cpufreq =1000000000 ;uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size; -const uint8_t pa_features[] = {24 ,0 , -0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 , -0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , -0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , -0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 };int offset;char *nodename;int cpus_offset =get_cpus_node (fdt);@@ -236,15 +231,14 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) page_sizes_prop, page_sizes_prop_size))); } -_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features,sizeof (pa_features)))); -/* Build interrupt servers properties */ for (i =0 ; i < smt_threads; i++) { servers_prop[i] =cpu_to_be32 (pc->pir + i); }_FDT ((fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , servers_prop,sizeof (*servers_prop) * smt_threads))); + +return offset; } static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,@@ -299,6 +293,17 @@ PnvChip *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb)return chip; } +/* +* Same as spapr pa_features_207 except pnv always enables CI largepages bit. +* HTM is always enabled because TCG does implement HTM, it's just a +* degenerate implementation. +*/ +static const uint8_t pa_features_207[] = {24 ,0 , +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 , +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 , +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 }; +static void pnv_chip_power8_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power8-xscom\0ibm,xscom" ;@@ -311,8 +316,12 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); -pnv_dt_core (chip, pnv_core, fdt); +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207))));/* Interrupt Control Presenters (ICP). One per core. */ pnv_dt_icp (chip, fdt, pnv_core->pir,CPU_CORE (pnv_core)->nr_threads);@@ -335,8 +344,12 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; -pnv_dt_core (chip, pnv_core, fdt); + offset =pnv_dt_core (chip, pnv_core, fdt); + +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207)))); }if (chip->ram_size) {@@ -358,8 +371,12 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt)for (i =0 ; i < chip->nr_cores; i++) {PnvCore *pnv_core = chip->cores[i]; +int offset; + + offset =pnv_dt_core (chip, pnv_core, fdt); -pnv_dt_core (chip, pnv_core, fdt); +_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , + pa_features_207,sizeof (pa_features_207)))); }if (chip->ram_size) {
PATCH 8/13 ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits
In reply to Nicholas PigginCopy the pa-features arrays from spapr, adjusting slightly as described in comments.
--- hw/ppc/pnv.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-- hw/ppc/spapr.c | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)
hw/ppc/pnv.c +65 -2
@@ -332,6 +332,35 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) } } +/* +* Same as spapr pa_features_300 except pnv always enables CI largepages bit. +*/ +static const uint8_t pa_features_300[] = {66 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +}; +static void pnv_chip_power9_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power9-xscom\0ibm,xscom" ;
@@ -349,7 +378,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_300,sizeof (pa_features_300)))); }if (chip->ram_size) {
@@ -359,6 +388,40 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV9_LPCM_BASE (chip),PNV9_LPCM_SIZE ); } +/* +* Same as spapr pa_features_31 except pnv always enables CI largepages bit, +* always disables copy/paste. +*/ +static const uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ +0x80 ,0x00 ,/* 72 - 73 */ +}; +static void pnv_chip_power10_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power10-xscom\0ibm,xscom" ;
@@ -376,7 +439,7 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_31,sizeof (pa_features_31)))); }if (chip->ram_size) {
hw/ppc/spapr.c +1 -0
@@ -233,6 +233,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, PowerPCCPU *cpu, void *fdt, int offset) { +/* These should be kept in sync with pnv */ uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x00 ,0xc0 }; uint8_t pa_features_207[] = { 24, 0,
Signature · 1 line
2.42.0
Re: [PATCH 08/13] ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits
Quoted 115 lines · Nicholas Piggin
Copy the pa-features arrays from spapr, adjusting slightly as described in comments.
Cc "Cédric Le Goater" <[email protected]>Cc "Frédéric Barrat" <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/pnv.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-- hw/ppc/spapr.c | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)hw/ppc/pnv.c +65
-2@@ -332,6 +332,35 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) } } +/* +* Same as spapr pa_features_300 except pnv always enables CI largepages bit. +*/ +static const uint8_t pa_features_300[] = {66 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +}; +static void pnv_chip_power9_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power9-xscom\0ibm,xscom" ;@@ -349,7 +378,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_300,sizeof (pa_features_300)))); }if (chip->ram_size) {@@ -359,6 +388,40 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV9_LPCM_BASE (chip),PNV9_LPCM_SIZE ); } +/* +* Same as spapr pa_features_31 except pnv always enables CI largepages bit, +* always disables copy/paste. +*/ +static const uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ +0x80 ,0x00 ,/* 72 - 73 */ +}; +static void pnv_chip_power10_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power10-xscom\0ibm,xscom" ;@@ -376,7 +439,7 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_31,sizeof (pa_features_31)))); }if (chip->ram_size) {hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 236
Quoted 4 lines
hw/ppc/spapr.c +1
-0@@ -233,6 +233,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, PowerPCCPU *cpu, void *fdt, int offset) { +/* These should be kept in sync with pnv */
yes. In that case, the array definition should be moved under target/ppc/. May be under PowerPCCPUClass ?
Thanks,
C.
Quoted 3 lines
hw/ppc/spapr.c +0
-0uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x00 ,0xc0 };uint8_t pa_features_207[] = {24 ,0 ,
Re: [PATCH 08/13] ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits
Quoted 110 lines · Cédric Le Goater
Quoted 109 lines · Nicholas Piggin
Copy the pa-features arrays from spapr, adjusting slightly as described in comments.
Cc "Cédric Le Goater" <[email protected]>Cc "Frédéric Barrat" <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/pnv.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-- hw/ppc/spapr.c | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)hw/ppc/pnv.c +65
-2@@ -332,6 +332,35 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) } } +/* +* Same as spapr pa_features_300 except pnv always enables CI largepages bit. +*/ +static const uint8_t pa_features_300[] = {66 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +}; +static void pnv_chip_power9_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power9-xscom\0ibm,xscom" ;@@ -349,7 +378,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_300,sizeof (pa_features_300)))); }if (chip->ram_size) {@@ -359,6 +388,40 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV9_LPCM_BASE (chip),PNV9_LPCM_SIZE ); } +/* +* Same as spapr pa_features_31 except pnv always enables CI largepages bit, +* always disables copy/paste. +*/ +static const uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ +0x80 ,0x00 ,/* 72 - 73 */ +}; +static void pnv_chip_power10_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power10-xscom\0ibm,xscom" ;@@ -376,7 +439,7 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_31,sizeof (pa_features_31)))); }
Quoted 13 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 236
Quoted 10 lines
hw/ppc/pnv.c +0
-0if (chip->ram_size) {hw/ppc/spapr.c +1
-0@@ -233,6 +233,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, PowerPCCPU *cpu, void *fdt, int offset) { +/* These should be kept in sync with pnv */ yes. In that case, the array definition should be moved under target/ppc/. May be under PowerPCCPUClass ?
Yeah PowerPCCPUClass might be a good idea, although I'm not quite decided whether it's best to just store the arrays there, or make a list of features in another format and have a builder function to turn that into the dt array. There's also a few differences between spapr and pnv that I haven't worked out a nice way to handle yet. I have a pi-features property to add too which is similar.
So yes this is a bit ugly but we're already duplicating and open coding arrays so I'd like to just get this in to fix the missing P10 bits, and refactor it afterwards.
Thanks,
Nick
Re: [PATCH 08/13] ppc/pnv: Set POWER9, POWER10 ibm,pa-features bits
Quoted 125 lines · Nicholas Piggin
Quoted 110 lines · Cédric Le Goater
Quoted 109 lines · Nicholas Piggin
Copy the pa-features arrays from spapr, adjusting slightly as described in comments.
Cc "Cédric Le Goater" <[email protected]>Cc "Frédéric Barrat" <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- hw/ppc/pnv.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-- hw/ppc/spapr.c | 1 + 2 files changed, 66 insertions(+), 2 deletions(-)hw/ppc/pnv.c +65
-2@@ -332,6 +332,35 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) } } +/* +* Same as spapr pa_features_300 except pnv always enables CI largepages bit. +*/ +static const uint8_t pa_features_300[] = {66 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR, 22: HTM */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +}; +static void pnv_chip_power9_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power9-xscom\0ibm,xscom" ;@@ -349,7 +378,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_300,sizeof (pa_features_300)))); }if (chip->ram_size) {@@ -359,6 +388,40 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)pnv_dt_lpc (chip, fdt,0 ,PNV9_LPCM_BASE (chip),PNV9_LPCM_SIZE ); } +/* +* Same as spapr pa_features_31 except pnv always enables CI largepages bit, +* always disables copy/paste. +*/ +static const uint8_t pa_features_31[] = {74 ,0 , +/* 0: MMU|FPU|SLB|RUN|DABR|NX, 1: CILRG|fri[nzpm]|DABRX|SPRG3|SLB0|PP110 */ +/* 2: VPM|DS205|PPR|DS202|DS206, 3: LSD|URG, 5: LE|CFAR|EB|LSQ */ +0xf6 ,0x3f ,0xc7 ,0xc0 ,0x00 ,0xf0 ,/* 0 - 5 */ +/* 6: DS207 */ +0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,/* 6 - 11 */ +/* 16: Vector */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 12 - 17 */ +/* 18: Vec. Scalar, 20: Vec. XOR */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 18 - 23 */ +/* 24: Ext. Dec, 26: 64 bit ftrs, 28: PM ftrs */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 24 - 29 */ +/* 32: LE atomic, 34: EBB + ext EBB */ +0x00 ,0x00 ,0x80 ,0x00 ,0xC0 ,0x00 ,/* 30 - 35 */ +/* 40: Radix MMU */ +0x00 ,0x00 ,0x00 ,0x00 ,0x80 ,0x00 ,/* 36 - 41 */ +/* 42: PM, 44: PC RA, 46: SC vec'd */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 42 - 47 */ +/* 48: SIMD, 50: QP BFP, 52: String */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 48 - 53 */ +/* 54: DecFP, 56: DecI, 58: SHA */ +0x80 ,0x00 ,0x80 ,0x00 ,0x80 ,0x00 ,/* 54 - 59 */ +/* 60: NM atomic, 62: RNG */ +0x80 ,0x00 ,0x80 ,0x00 ,0x00 ,0x00 ,/* 60 - 65 */ +/* 68: DEXCR[SBHE|IBRTPDUS|SRAPD|NPHIE|PHIE] */ +0x00 ,0x00 ,0xce ,0x00 ,0x00 ,0x00 ,/* 66 - 71 */ +/* 72: [P]HASHCHK */ +0x80 ,0x00 ,/* 72 - 73 */ +}; +static void pnv_chip_power10_dt_populate (PnvChip *chip,void *fdt) {static const char compat[] ="ibm,power10-xscom\0ibm,xscom" ;@@ -376,7 +439,7 @@ static void pnv_chip_power10_dt_populate(PnvChip *chip, void *fdt) offset =pnv_dt_core (chip, pnv_core, fdt);_FDT ((fdt_setprop (fdt, offset,"ibm,pa-features" , - pa_features_207,sizeof (pa_features_207)))); + pa_features_31,sizeof (pa_features_31)))); }Quoted 13 lines
hw/ppc/spapr.c static void spapr_dt_pa_features(SpaprMachineState *spapr, · line 236
Quoted 10 lines
hw/ppc/pnv.c +0
-0if (chip->ram_size) {hw/ppc/spapr.c +1
-0@@ -233,6 +233,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr, PowerPCCPU *cpu, void *fdt, int offset) { +/* These should be kept in sync with pnv */ yes. In that case, the array definition should be moved under target/ppc/. May be under PowerPCCPUClass ?
Quoted 4 lines
Yeah PowerPCCPUClass might be a good idea, although I'm not quite decided whether it's best to just store the arrays there, or make a list of features in another format and have a builder function to turn that into the dt array.
That would be very nice to have. The pa_features array is cryptic and error prone.
Quoted 7 lines
There's also a few differences between
spapr and pnv that I haven't worked out a nice way to handle yet. I have a pi-features property to add too which is similar.So yes this is a bit ugly but we're already duplicating and open coding arrays so I'd like to just get this in to fix the missing P10 bits, and refactor it afterwards.
OK.
Thanks,
C.
PATCH 9/13 target/ppc: Prevent supervisor from modifying MSR[ME]
In reply to Nicholas PigginPrevent guest state modifying the MSR[ME] bit. Per ISA:
An attempt to modify MSRME in privileged but non-hypervisor state is ignored (i.e., the bit is not changed).
--- target/ppc/helper_regs.c | 5 +++++ 1 file changed, 5 insertions(+)
target/ppc/helper_regs.c +5 -0
@@ -264,6 +264,11 @@ int hreg_store_msr(CPUPPCState *env, target_ulong value, int alter_hv) value &= ~MSR_HVB ; value |= env->msr &MSR_HVB ; } +/* Attempt to modify MSR[ME] in guest state is ignored */ +if (is_book3s_arch2x (env) && !(env->msr &MSR_HVB )) { + value &= ~(1 <<MSR_ME ); + value |= env->msr & (1 <<MSR_ME ); + }if ((value ^ env->msr) & (R_MSR_IR_MASK |R_MSR_DR_MASK )) {cpu_interrupt_exittb (cs); }
Signature · 1 line
2.42.0
Re: [PATCH 09/13] target/ppc: Prevent supervisor from modifying MSR[ME]
Quoted 3 lines · Nicholas Piggin
Prevent guest state modifying the MSR[ME] bit. Per ISA:
An attempt to modify MSRME in privileged but non-hypervisor state is
s/MSRME/MSR[ME] ?
Quoted 12 lines
ignored (i.e., the bit is not changed).
Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/helper_regs.c | 5 +++++ 1 file changed, 5 insertions(+)target/ppc/helper_regs.c +0
-0
target/ppc/helper_regs.c int hreg_store_msr(CPUPPCState *env, target_ulong value, int alter_hv) · line 271
Quoted 8 lines
target/ppc/helper_regs.c +5
-0@@ -264,6 +264,11 @@ int hreg_store_msr(CPUPPCState *env, target_ulong value, int alter_hv) value &= ~MSR_HVB ; value |= env->msr &MSR_HVB ; } +/* Attempt to modify MSR[ME] in guest state is ignored */ +if (is_book3s_arch2x (env) && !(env->msr &MSR_HVB )) { + value &= ~(1 <<MSR_ME ); + value |= env->msr & (1 <<MSR_ME ); + }
Quoted 3 lines
target/ppc/helper_regs.c +0
-0if ((value ^ env->msr) & (R_MSR_IR_MASK |R_MSR_DR_MASK )) {cpu_interrupt_exittb (cs); }
Re: [PATCH 09/13] target/ppc: Prevent supervisor from modifying MSR[ME]
Quoted 8 lines · Harsh Prateek Bora
Quoted 3 lines · Nicholas Piggin
Prevent guest state modifying the MSR[ME] bit. Per ISA:
An attempt to modify MSRME in privileged but non-hypervisor state is
s/MSRME/MSR[ME] ?
Yes, thanks.
Quoted 27 lines
Quoted 13 lines
ignored (i.e., the bit is not changed).
Signed-off-by Nicholas Piggin <[email protected]>--- target/ppc/helper_regs.c | 5 +++++ 1 file changed, 5 insertions(+)target/ppc/helper_regs.c +0
-0target/ppc/helper_regs.c int hreg_store_msr(CPUPPCState *env, target_ulong value, int alter_hv) · line 271
Quoted 8 lines
target/ppc/helper_regs.c +5
-0@@ -264,6 +264,11 @@ int hreg_store_msr(CPUPPCState *env, target_ulong value, int alter_hv) value &= ~MSR_HVB ; value |= env->msr &MSR_HVB ; } +/* Attempt to modify MSR[ME] in guest state is ignored */ +if (is_book3s_arch2x (env) && !(env->msr &MSR_HVB )) { + value &= ~(1 <<MSR_ME ); + value |= env->msr & (1 <<MSR_ME ); + }Reviewed-by Harsh Prateek Bora <[email protected]>Quoted 3 lines
target/ppc/helper_regs.c +0
-0if ((value ^ env->msr) & (R_MSR_IR_MASK |R_MSR_DR_MASK )) {cpu_interrupt_exittb (cs); }
PATCH 10/13 spapr: set MSR[ME] and MSR[FP] on client entry
In reply to Nicholas PigginThe initial MSR state for PAPR specifies MSR[ME] and MSR[FP] are set.
--- hw/ppc/spapr_cpu_core.c | 2 ++ 1 file changed, 2 insertions(+)
hw/ppc/spapr_cpu_core.c +2 -0
@@ -42,6 +42,8 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu)* as 32bit (MSR_SF=0) in "8.2.1. Initial Register Values". */ env->msr &= ~(1ULL <<MSR_SF ); + env->msr |= (1ULL <<MSR_ME ) | (1ULL <<MSR_FP ); + env->spr[SPR_HIOR ] =0 ; lpcr = env->spr[SPR_LPCR ];
Signature · 1 line
2.42.0
Re: [PATCH 10/13] spapr: set MSR[ME] and MSR[FP] on client entry
Quoted 3 lines · Nicholas Piggin
The initial MSR state for PAPR specifies MSR[ME] and MSR[FP] are set.
Signed-off-by Nicholas Piggin <[email protected]>
It would be good to mention PAPR section numbers suggesting the same. Anyways,
Quoted 17 lines
--- hw/ppc/spapr_cpu_core.c | 2 ++ 1 file changed, 2 insertions(+)hw/ppc/spapr_cpu_core.c +2
-0@@ -42,6 +42,8 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu)* as 32bit (MSR_SF=0) in "8.2.1. Initial Register Values". */ env->msr &= ~(1ULL <<MSR_SF ); + env->msr |= (1ULL <<MSR_ME ) | (1ULL <<MSR_FP ); + env->spr[SPR_HIOR ] =0 ; lpcr = env->spr[SPR_LPCR ];
Re: [PATCH 10/13] spapr: set MSR[ME] and MSR[FP] on client entry
Quoted 8 lines · Harsh Prateek Bora
Quoted 3 lines · Nicholas Piggin
The initial MSR state for PAPR specifies MSR[ME] and MSR[FP] are set.
Signed-off-by Nicholas Piggin <[email protected]>It would be good to mention PAPR section numbers suggesting the same.
I'll see if I can find it and put it in a comment.
Thanks,
Nick
Quoted 21 lines
Anyways,
Reviewed-by Harsh Prateek Bora <[email protected]>Quoted 17 lines
--- hw/ppc/spapr_cpu_core.c | 2 ++ 1 file changed, 2 insertions(+)hw/ppc/spapr_cpu_core.c +2
-0@@ -42,6 +42,8 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu)* as 32bit (MSR_SF=0) in "8.2.1. Initial Register Values". */ env->msr &= ~(1ULL <<MSR_SF ); + env->msr |= (1ULL <<MSR_ME ) | (1ULL <<MSR_FP ); + env->spr[SPR_HIOR ] =0 ; lpcr = env->spr[SPR_LPCR ];
PATCH 11/13 target/ppc: Make checkstop actually stop the system
In reply to Nicholas Piggincheckstop state does not halt the system, interrupts continue to be serviced, and other CPUs run. Make it stop the machine with qemu_system_guest_panicked.
--- target/ppc/excp_helper.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
target/ppc/excp_helper.c +12 -3
@@ -19,6 +19,8 @@#include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qemu/log.h" +#include "sysemu/sysemu.h" +#include "sysemu/runstate.h" #include "cpu.h" #include "exec/exec-all.h" #include "internal.h"
@@ -432,15 +434,22 @@ static void powerpc_mcheck_checkstop(CPUPPCState *env)return ; } +/* +* This stops the machine and logs CPU state without killing QEMU +* (like cpu_abort()) so the machine can still be debugged (because +* it is often a guest error). +*/ +/* Machine check exception is not enabled. Enter checkstop state. */ fprintf (stderr,"Machine check while not allowed. " "Entering checkstop state\n" );if (qemu_log_separate ()) {qemu_log ("Machine check while not allowed. " "Entering checkstop state\n" ); - } - cs->halted =1 ; -cpu_interrupt_exittb (cs); + +qemu_system_guest_panicked (NULL ); + +cpu_loop_exit_noexc (cs); }static void powerpc_excp_40x (PowerPCCPU *cpu,int excp)
Signature · 1 line
2.42.0
PATCH 12/13 target/ppc: improve checkstop logging
In reply to Nicholas PigginChange the logging not to print to stderr as well, because a checkstop is a guest error (or perhaps a simulated machine error) rather than a QEMU error, so send it to the log.
Update the checkstop message, and log CPU registers too.
--- target/ppc/excp_helper.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
target/ppc/excp_helper.c +8 -6
@@ -429,6 +429,7 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu, target_ulong vector,static void powerpc_mcheck_checkstop (CPUPPCState *env) {CPUState *cs =env_cpu (env); +FILE *f;if (FIELD_EX64 (env->msr,MSR ,ME )) {return ;
@@ -440,12 +441,13 @@ static void powerpc_mcheck_checkstop(CPUPPCState *env)* it is often a guest error). */ -/* Machine check exception is not enabled. Enter checkstop state. */ -fprintf (stderr,"Machine check while not allowed. " -"Entering checkstop state\n" ); -if (qemu_log_separate ()) { -qemu_log ("Machine check while not allowed. " -"Entering checkstop state\n" ); + f =qemu_log_trylock (); +if (f) { +fprintf (f,"Entering checkstop state: " +"machine check with MSR[ME]=0\n" ); +cpu_dump_state (cs, f,CPU_DUMP_FPU |CPU_DUMP_CCOP ); +qemu_log_unlock (f); + }qemu_system_guest_panicked (NULL );
Signature · 1 line
2.42.0
PATCH 13/13 target/ppc: Implement attn instruction on BookS 64-bit processors
In reply to Nicholas Pigginattn is an implementation-specific instruction that on POWER (and G5/
970) can be enabled with a HID bit (disabled = illegal), and executing it causes the host processor to stop and the service processor to be notified. Generally used for debugging.
Implement attn and make it checkstop the system, which should be good enough for QEMU debugging.
--- target/ppc/cpu.h | 16 +++++++- target/ppc/helper.h | 4 ++ target/ppc/cpu_init.c | 82 +++++++++++++++++++++++++++++++++++++--- target/ppc/excp_helper.c | 59 +++++++++++++++++++---------- target/ppc/translate.c | 11 ++++++ 5 files changed, 145 insertions(+), 27 deletions(-)
target/ppc/cpu.h +15 -1
@@ -1353,6 +1353,9 @@ struct CPUArchState {/* Power management */ int (*check_pow)(CPUPPCState *env); +/* attn instruction enable */ +int (*check_attn)(CPUPPCState *env); +#if !defined(CONFIG_USER_ONLY )void *load_info;/* holds boot loading state */ #endif
@@ -1500,6 +1503,7 @@ struct PowerPCCPUClass {int n_host_threads;void (*init_proc)(CPUPPCState *env);int (*check_pow)(CPUPPCState *env); +int (*check_attn)(CPUPPCState *env); };ObjectClass *ppc_cpu_class_by_name (const char *name);
@@ -2287,6 +2291,8 @@ void ppc_compat_add_property(Object *obj, const char *name,#define HID0_NAP (1 << 22)/* pre-2.06 */ #define HID0_HILE PPC_BIT(19)/* POWER8 */ #define HID0_POWER9_HILE PPC_BIT(4) +#define HID0_ENABLE_ATTN PPC_BIT(31)/* POWER8 */ +#define HID0_POWER9_ENABLE_ATTN PPC_BIT(3)/*****************************************************************************/ /* PowerPC Instructions types definitions */
@@ -2483,6 +2489,8 @@ enum {PPC2_MEM_LWSYNC =0x0000000000200000ULL ,/* ISA 2.06 BCD assist instructions */ PPC2_BCDA_ISA206 =0x0000000000400000ULL , +/* attn instruction found in IBM POWER (including 970) */ +PPC2_ATTN =0x0000000000800000ULL , #define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ PPC2_ISA205 | PPC2_VSX207 | PPC2_PERM_ISA206 | \
@@ -2492,7 +2500,7 @@ enum {PPC2_ALTIVEC_207 |PPC2_ISA207S |PPC2_DFP | \PPC2_FP_CVT_S64 |PPC2_TM |PPC2_PM_ISA206 | \PPC2_ISA300 |PPC2_ISA310 |PPC2_MEM_LWSYNC | \ - PPC2_BCDA_ISA206) + PPC2_BCDA_ISA206 | PPC2_ATTN) };/*****************************************************************************/
@@ -2991,6 +2999,12 @@ static inline int check_pow_nocheck(CPUPPCState *env)return 1 ; } +/* attn enable check */ +static inline int check_attn_none (CPUPPCState *env) +{ +return 0 ; +} +/*****************************************************************************/ /* PowerPC implementations definitions */
target/ppc/helper.h +4 -0
@@ -819,3 +819,7 @@ DEF_HELPER_4(DSCLIQ, void, env, fprp, fprp, i32) DEF_HELPER_1(tbegin, void, env) DEF_HELPER_FLAGS_1(fixup_thrm, TCG_CALL_NO_RWG, void, env) + +#if defined(TARGET_PPC64 ) && !defined(CONFIG_USER_ONLY ) +DEF_HELPER_1(attn, noreturn, env) +#endif
target/ppc/cpu_init.c +76 -6
394 lines not on this page · raw message
target/ppc/excp_helper.c +39 -20
76 lines not on this page · raw message
target/ppc/translate.c +11 -0
@@ -6482,6 +6482,16 @@ static void gen_dform3D(DisasContext *ctx) }#if defined(TARGET_PPC64 ) +/* attn */ +static void gen_attn (DisasContext *ctx) +{ +#if defined(CONFIG_USER_ONLY ) +GEN_PRIV (ctx); +#else +gen_helper_attn (tcg_env); +#endif +} +/* brd */ static void gen_brd (DisasContext *ctx) {
@@ -6513,6 +6523,7 @@ static void gen_brh(DisasContext *ctx) static opcode_t opcodes[] = {#if defined(TARGET_PPC64 ) +GEN_HANDLER_E (attn,0x00 ,0x00 ,0x08 ,0xFFFFFDFF ,PPC_NONE ,PPC2_ATTN ),GEN_HANDLER_E (brd,0x1F ,0x1B ,0x05 ,0x0000F801 ,PPC_NONE ,PPC2_ISA310 ),GEN_HANDLER_E (brw,0x1F ,0x1B ,0x04 ,0x0000F801 ,PPC_NONE ,PPC2_ISA310 ), GEN_HANDLER_E(brh, 0x1F, 0x1B, 0x06, 0x0000F801, PPC_NONE, PPC2_ISA310),
Signature · 1 line
2.42.0
Quoted 4 lines · Nicholas Piggin
Here's a bunch of patches that have been on the list in various forms, but haven't made it upstream yet. I would like to get them merged for 9.0 if possible. The checkstop and attn ones are bigger but they're not so important so I could defer them.
Yes please! Series LGTM but I don't have enough PPC knowledge to give a proper R-b, so I'll let more familiar developers.
Regards,
Phil.