powerpc/32s: Fix boot failure with DEBUG_PAGEALLOC without KASAN.
authorChristophe Leroy <christophe.leroy@c-s.fr>
Wed, 14 Aug 2019 10:02:20 +0000 (10:02 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 20 Aug 2019 11:22:13 +0000 (21:22 +1000)
When KASAN is selected, the definitive hash table has to be
set up later, but there is already an early temporary one.

When KASAN is not selected, there is no early hash table,
so the setup of the definitive hash table cannot be delayed.

Fixes: 72f208c6a8f7 ("powerpc/32s: move hash code patching out of MMU_init_hw()")
Cc: stable@vger.kernel.org # v5.2+
Reported-by: Jonathan Neuschafer <j.neuschaefer@gmx.net>
Tested-by: Jonathan Neuschafer <j.neuschaefer@gmx.net>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b7860c5e1e784d6b96ba67edf47dd6cbc2e78ab6.1565776892.git.christophe.leroy@c-s.fr
arch/powerpc/kernel/head_32.S
arch/powerpc/mm/book3s32/mmu.c

index f255e22184b48b5737e2bbaeab79e19b05ef3cd1..c8b4f7ed318c48c1af926ab313b81d2cfc6ec1a9 100644 (file)
@@ -897,9 +897,11 @@ start_here:
        bl      machine_init
        bl      __save_cpu_setup
        bl      MMU_init
+#ifdef CONFIG_KASAN
 BEGIN_MMU_FTR_SECTION
        bl      MMU_init_hw_patch
 END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
+#endif
 
 /*
  * Go back to running unmapped so we can load up new values
index e249fbf6b9c344e23a08fc199b6789bfc35b3c5b..8d68f03bf5a409138c33a7fabb35b3d38a7ee0ee 100644 (file)
@@ -358,6 +358,15 @@ void __init MMU_init_hw(void)
        hash_mb2 = hash_mb = 32 - LG_HPTEG_SIZE - lg_n_hpteg;
        if (lg_n_hpteg > 16)
                hash_mb2 = 16 - LG_HPTEG_SIZE;
+
+       /*
+        * When KASAN is selected, there is already an early temporary hash
+        * table and the switch to the final hash table is done later.
+        */
+       if (IS_ENABLED(CONFIG_KASAN))
+               return;
+
+       MMU_init_hw_patch();
 }
 
 void __init MMU_init_hw_patch(void)