Re: [PATCH v6 19/22] powerpc/book3s64/hash/kuap: Enable kuap on hash
From: Christophe Leroy <hidden>
Date: 2021-10-08 09:32:37
Le 25/11/2020 à 06:16, Aneesh Kumar K.V a écrit :
quoted hunk ↗ jump to hunk
Reviewed-by: Sandipan Das <redacted> Signed-off-by: Aneesh Kumar K.V <redacted> --- arch/powerpc/mm/book3s64/pkeys.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c index f747d66cc87d..84f8664ffc47 100644 --- a/arch/powerpc/mm/book3s64/pkeys.c +++ b/arch/powerpc/mm/book3s64/pkeys.c@@ -257,7 +257,12 @@ void __init setup_kuep(bool disabled) #ifdef CONFIG_PPC_KUAP void __init setup_kuap(bool disabled) { - if (disabled || !early_radix_enabled()) + if (disabled) + return; + /* + * On hash if PKEY feature is not enabled, disable KUAP too. + */ + if (!early_radix_enabled() && !early_mmu_has_feature(MMU_FTR_PKEY))
pkey_early_init_devtree() bails out without setting MMU_FTR_PKEY with the following: /* * Only P7 and above supports SPRN_AMR update with MSR[PR] = 1 */ if (!early_cpu_has_feature(CPU_FTR_ARCH_206)) return; Why would it be impossible to do KUAP in that case ? KUAP doesn't require updating SPRN_AMR with MSR[PR] = 1
return;
if (smp_processor_id() == boot_cpuid) {