Skip to content

Commit 9bb162f

Browse files
chleroympe
authored andcommitted
powerpc/603: Fix boot failure with DEBUG_PAGEALLOC and KFENCE
Allthough kernel text is always mapped with BATs, we still have inittext mapped with pages, so TLB miss handling is required when CONFIG_DEBUG_PAGEALLOC or CONFIG_KFENCE is set. The final solution should be to set a BAT that also maps inittext but that BAT then needs to be cleared at end of init, and it will require more changes to be able to do it properly. As DEBUG_PAGEALLOC or KFENCE are debugging, performance is not a big deal so let's fix it simply for now to enable easy stable application. Fixes: 035b19a ("powerpc/32s: Always map kernel text and rodata with BATs") Cc: [email protected] # v5.11+ Reported-by: Maxime Bizon <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/aea33b4813a26bdb9378b5f273f00bd5d4abe240.1638857364.git.christophe.leroy@csgroup.eu
1 parent 26291c5 commit 9bb162f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kernel/head_book3s_32.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,14 @@ InstructionTLBMiss:
421421
*/
422422
/* Get PTE (linux-style) and check access */
423423
mfspr r3,SPRN_IMISS
424-
#ifdef CONFIG_MODULES
424+
#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
425425
lis r1, TASK_SIZE@h /* check if kernel address */
426426
cmplw 0,r1,r3
427427
#endif
428428
mfspr r2, SPRN_SDR1
429429
li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER
430430
rlwinm r2, r2, 28, 0xfffff000
431-
#ifdef CONFIG_MODULES
431+
#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
432432
bgt- 112f
433433
lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
434434
li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC

0 commit comments

Comments
 (0)