Skip to content

Commit 7353644

Browse files
committed
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: 166dd7d ("powerpc/64: Move MMU backend selection out of platform code") Reported-by: Stephen Rothwell <[email protected]> Acked-by: Stephen Rothwell <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent ccf5c44 commit 7353644

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/powerpc/mm/hash_utils_64.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,12 @@ void __init hash__early_init_mmu(void)
931931
ps3_early_mm_init();
932932
else if (firmware_has_feature(FW_FEATURE_LPAR))
933933
hpte_init_lpar();
934-
else
934+
else if IS_ENABLED(CONFIG_PPC_NATIVE)
935935
hpte_init_native();
936936

937+
if (!mmu_hash_ops.hpte_insert)
938+
panic("hash__early_init_mmu: No MMU hash ops defined!\n");
939+
937940
/* Initialize the MMU Hash table and create the linear mapping
938941
* of memory. Has to be done before SLB initialization as this is
939942
* currently where the page size encoding is obtained.

0 commit comments

Comments
 (0)