summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/sleep.S
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-01-24 19:51:58 +0100
committerArd Biesheuvel <ardb@kernel.org>2022-01-24 20:37:55 +0100
commit8b806b82bc804ce8d254ea87d48eaa390451eac4 (patch)
tree8a05ac7a6856c676aadd6508efc443fff0850ddb /arch/arm/kernel/sleep.S
parent5fe41793bc78d9bb47fea37d1a16984ad6cf294b (diff)
ARM: mm: switch to swapper_pg_dir early for vmap'ed stack
When onlining a CPU, switch to swapper_pg_dir as soon as possible so that it is guaranteed that the vmap'ed stack is mapped before it is used. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'arch/arm/kernel/sleep.S')
-rw-r--r--arch/arm/kernel/sleep.S7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
index f909baf17912..a86a1d4f3461 100644
--- a/arch/arm/kernel/sleep.S
+++ b/arch/arm/kernel/sleep.S
@@ -119,6 +119,13 @@ ENTRY(cpu_resume_mmu)
ENDPROC(cpu_resume_mmu)
.popsection
cpu_resume_after_mmu:
+#if defined(CONFIG_VMAP_STACK) && !defined(CONFIG_ARM_LPAE)
+ @ Before using the vmap'ed stack, we have to switch to swapper_pg_dir
+ @ as the ID map does not cover the vmalloc region.
+ mrc p15, 0, ip, c2, c0, 1 @ read TTBR1
+ mcr p15, 0, ip, c2, c0, 0 @ set TTBR0
+ instr_sync
+#endif
bl cpu_init @ restore the und/abt/irq banked regs
mov r0, #0 @ return zero on success
ldmfd sp!, {r4 - r11, pc}