OSDN Git Service

arm64: asm: Provide set_sctlr_el2 macro
authorQuentin Perret <qperret@google.com>
Fri, 19 Mar 2021 10:01:24 +0000 (10:01 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 19 Mar 2021 12:01:21 +0000 (12:01 +0000)
We will soon need to turn the EL2 stage 1 MMU on and off in nVHE
protected mode, so refactor the set_sctlr_el1 macro to make it usable
for that purpose.

Acked-by: Will Deacon <will@kernel.org>
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210319100146.1149909-17-qperret@google.com
arch/arm64/include/asm/assembler.h

index ca31594..fb651c1 100644 (file)
@@ -676,11 +676,11 @@ USER(\label, ic   ivau, \tmp2)                    // invalidate I line PoU
        .endm
 
 /*
- * Set SCTLR_EL1 to the passed value, and invalidate the local icache
+ * Set SCTLR_ELx to the @reg 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
+.macro set_sctlr, sreg, reg
+       msr     \sreg, \reg
        isb
        /*
         * Invalidate the local I-cache so that any instructions fetched
@@ -692,6 +692,14 @@ USER(\label, ic    ivau, \tmp2)                    // invalidate I line PoU
        isb
 .endm
 
+.macro set_sctlr_el1, reg
+       set_sctlr sctlr_el1, \reg
+.endm
+
+.macro set_sctlr_el2, reg
+       set_sctlr sctlr_el2, \reg
+.endm
+
 /*
  * Check whether to yield to another runnable task from kernel mode NEON code
  * (which runs with preemption disabled).