diff options
author | Marc Zyngier <maz@kernel.org> | 2021-02-08 09:57:12 +0000 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-02-08 12:51:26 +0000 |
commit | 8cc8a32415364e475c25277b507f06f67c47ca9a (patch) | |
tree | 2232aa234444c200b37fe8ea5522f19502a35e46 /arch/arm64/include/asm | |
parent | b161f92482426a7323884d57cbae683812909988 (diff) | |
download | lwn-8cc8a32415364e475c25277b507f06f67c47ca9a.tar.gz lwn-8cc8a32415364e475c25277b507f06f67c47ca9a.zip |
arm64: Turn the MMU-on sequence into a macro
Turning the MMU on is a popular sport in the arm64 kernel, and
we do it more than once, or even twice. As we are about to add
even more, let's turn it into a macro.
No expected functional change.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: David Brazdil <dbrazdil@google.com>
Link: https://lore.kernel.org/r/20210208095732.3267263-4-maz@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm')
-rw-r--r-- | arch/arm64/include/asm/assembler.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index bf125c591116..8cded93f99c3 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -676,6 +676,23 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU .endm /* + * Set SCTLR_EL1 to the passed value, and invalidate the local icache + * in the process. This is called when setting the MMU on. + */ +.macro set_sctlr_el1, reg + msr sctlr_el1, \reg + isb + /* + * Invalidate the local I-cache so that any instructions fetched + * speculatively from the PoC are discarded, since they may have + * been dynamically patched at the PoU. + */ + ic iallu + dsb nsh + isb +.endm + +/* * Check whether to yield to another runnable task from kernel mode NEON code * (which runs with preemption disabled). * |