aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2016-07-24 21:54:41 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-07-26 00:16:08 -0400
commit7353644fa9df875aee778a802e3d28f1e3578512 (patch)
tree68a1e96d5d7372dd843f47fa52a8fdf9aaa4fccb
parentccf5c442a1b82bf74105d72416e069607353cb82 (diff)
powerpc/mm: Fix build break when PPC_NATIVE=n
The recent commit to rework the hash MMU setup broke the build when CONFIG_PPC_NATIVE=n. Fix it by adding an IS_ENABLED() check before calling hpte_init_native(). Removing the else clause opens the possibility that we don't set any ops, which would probably lead to a strange crash later. So add a check that we correctly initialised at least one member of the struct. Fixes: 166dd7d3fbf2 ("powerpc/64: Move MMU backend selection out of platform code") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/mm/hash_utils_64.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 341632471b9d..381b5894cc99 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -931,9 +931,12 @@ void __init hash__early_init_mmu(void)
931 ps3_early_mm_init(); 931 ps3_early_mm_init();
932 else if (firmware_has_feature(FW_FEATURE_LPAR)) 932 else if (firmware_has_feature(FW_FEATURE_LPAR))
933 hpte_init_lpar(); 933 hpte_init_lpar();
934 else 934 else if IS_ENABLED(CONFIG_PPC_NATIVE)
935 hpte_init_native(); 935 hpte_init_native();
936 936
937 if (!mmu_hash_ops.hpte_insert)
938 panic("hash__early_init_mmu: No MMU hash ops defined!\n");
939
937 /* Initialize the MMU Hash table and create the linear mapping 940 /* Initialize the MMU Hash table and create the linear mapping
938 * of memory. Has to be done before SLB initialization as this is 941 * of memory. Has to be done before SLB initialization as this is
939 * currently where the page size encoding is obtained. 942 * currently where the page size encoding is obtained.