powerpc/prom: Enable Radix GTSE in cpu pa-features
PATCH 1/1 powerpc/prom: Enable Radix GTSE in cpu pa-features
From: Nicholas Piggin <[email protected]>
When '029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.")' made GTSE an MMU feature, it was enabled by default in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels where CONFIG_PPC_DT_CPU_FTRS isn't enabled.
--- arch/powerpc/kernel/prom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/prom.c +2 -1
@@ -163,7 +163,8 @@ static struct ibm_pa_feature { { .pabyte = 0, .pabit = 6, .cpu_features = CPU_FTR_NOEXECUTE }, { .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE }, #ifdef CONFIG_PPC_RADIX_MMU - { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX }, + { .pabyte = 40, .pabit = 0, + .mmu_features = (MMU_FTR_TYPE_RADIX | MMU_FTR_GTSE) }, #endif { .pabyte = 1, .pabit = 1, .invert = 1, .cpu_features = CPU_FTR_NODSISRALIGN }, { .pabyte = 5, .pabit = 0, .cpu_features = CPU_FTR_REAL_LE,
Signature · 1 line
2.26.2
Nicholas Piggin
reviewerExcerpts from Bharata B Rao's message of July 20, 2020 2:42 pm:
Quoted 7 lines
From: Nicholas Piggin <[email protected]>
When '
029ab30b4c0a("powerpc/mm: Enable radix GTSE only if supported.")' made GTSE an MMU feature, it was enabled by default in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels whereCONFIG_PPC_DT_CPU_FTRSisn't enabled.
Thanks for writing this up, I got a bit bogged down with other things.
Quoted 13 lines
Fixes 029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.")Reported-by Qian Cai <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>Signed-off-by Bharata B Rao <[email protected]>--- arch/powerpc/kernel/prom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/powerpc/kernel/prom.c +0
-0
arch/powerpc/kernel/prom.c static struct ibm_pa_feature { · line 167
Quoted 6 lines
arch/powerpc/kernel/prom.c +2
-1@@ -163,7 +163,8 @@ static struct ibm_pa_feature { { .pabyte = 0, .pabit = 6, .cpu_features = CPU_FTR_NOEXECUTE }, { .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE }, #ifdef CONFIG_PPC_RADIX_MMU - { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX }, + { .pabyte = 40, .pabit = 0, + .mmu_features = (MMU_FTR_TYPE_RADIX | MMU_FTR_GTSE) },
It might look better like this:
{ .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE },
#ifdef CONFIG_PPC_RADIX_MMU
{ .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX },
{ .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX |
MMU_FTR_GTSE },#endif
{ .pabyte = 1, .pabit = 1, .invert = 1, .cpu_features = CPU_FTR_NODSISRALIGN },
But that's bikeshedding a bit and the optional bits already put it out of alignment.
Thanks,
Nick
Quoted 20 lines · Nicholas Piggin
Excerpts from Bharata B Rao's message of July 20, 2020 2:42 pm:
arch/powerpc/kernel/prom.c static struct ibm_pa_feature { · line 167
Quoted 11 lines
arch/powerpc/kernel/prom.c +2
-1@@ -163,7 +163,8 @@ static struct ibm_pa_feature { { .pabyte = 0, .pabit = 6, .cpu_features = CPU_FTR_NOEXECUTE }, { .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE }, #ifdef CONFIG_PPC_RADIX_MMU - { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX }, + { .pabyte = 40, .pabit = 0, + .mmu_features = (MMU_FTR_TYPE_RADIX | MMU_FTR_GTSE) },It might look better like this:
{ .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE }, #ifdef CONFIG_PPC_RADIX_MMU { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX }, { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX | MMU_FTR_GTSE },
Quoted 5 lines
#endif
{ .pabyte = 1, .pabit = 1, .invert = 1, .cpu_features =CPU_FTR_NODSISRALIGN},But that's bikeshedding a bit and the optional bits already put it out of alignment.
Here it is...
From 1be7f3f8b43503740431b7bdf585e488ecdeb48f Mon Sep 17 00:00:00 2001
From: Nicholas Piggin <[email protected]>
Date: Mon, 20 Jul 2020 09:05:05 +0530
Subject: [FIX PATCH] powerpc/prom: Enable Radix GTSE in cpu pa-features
When '029ab30b4c0a ("powerpc/mm: Enable radix GTSE only if supported.")' made GTSE an MMU feature, it was enabled by default in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels if CONFIG_PPC_DT_CPU_FTRS isn't enabled.
--- arch/powerpc/kernel/prom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/prom.c +2 -1
@@ -163,7 +163,8 @@ static struct ibm_pa_feature { { .pabyte = 0, .pabit = 6, .cpu_features = CPU_FTR_NOEXECUTE }, { .pabyte = 1, .pabit = 2, .mmu_features = MMU_FTR_CI_LARGE_PAGE }, #ifdef CONFIG_PPC_RADIX_MMU - { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX }, + { .pabyte = 40, .pabit = 0, .mmu_features = MMU_FTR_TYPE_RADIX | + MMU_FTR_GTSE }, #endif { .pabyte = 1, .pabit = 1, .invert = 1, .cpu_features = CPU_FTR_NODSISRALIGN }, { .pabyte = 5, .pabit = 0, .cpu_features = CPU_FTR_REAL_LE,
Signature · 1 line
2.26.2
Michael Ellerman
AppliedQuoted 5 lines · Bharata B Rao
When '
029ab30b4c0a("powerpc/mm: Enable radix GTSE only if supported.")' made GTSE an MMU feature, it was enabled by default in powerpc-cpu-features but was missed in pa-features. This causes random memory corruption during boot of PowerNV kernels whereCONFIG_PPC_DT_CPU_FTRSisn't enabled.
Applied to powerpc/next.
[1/1] powerpc/prom: Enable Radix GTSE in cpu pa-features
https://git.kernel.org/powerpc/c/9a77c4a0a12597c661be374b8d566516c0341570
cheers