Revert "arm64: entry: Free up another register on kpti's tramp_exit path"
authorChristian Hoffmann <chrmhoffmann@gmail.com>
Tue, 7 Feb 2023 21:12:53 +0000 (22:12 +0100)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:27:08 +0000 (09:27 +0100)
This reverts commit a212d166a9d7c35e56ba11f15d6706eee3dd499b.

Change-Id: If3cc91ff73fce3af22768516835a7050958571ed

arch/arm64/kernel/entry.S

index 8e00c6b4074a2169a3504b964d94524199e64edf..a07d4ffb6465d596b5af5bd664237e54a1aa672b 100644 (file)
@@ -311,9 +311,6 @@ alternative_else_nop_endif
        ldp     x24, x25, [sp, #16 * 12]
        ldp     x26, x27, [sp, #16 * 13]
        ldp     x28, x29, [sp, #16 * 14]
-
-       .if     \el == 0
-alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
        ldr     lr, [sp, #S_LR]
 #ifdef CONFIG_AMLOGIC_VMAP
        /* restore context sp and per-cpu vmap stack */
@@ -328,11 +325,12 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
        .endif
 #endif /* CONFIG_AMLOGIC_VMAP */
        add     sp, sp, #S_FRAME_SIZE           // restore sp
-       eret
-alternative_else_nop_endif
+
+       .if     \el == 0
+alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
        bne     4f
-       msr     far_el1, x29
+       msr     far_el1, x30
        tramp_alias     x30, tramp_exit_native, x29
        br      x30
 4:
@@ -340,8 +338,6 @@ alternative_else_nop_endif
        br      x30
 #endif
        .else
-       ldr     lr, [sp, #S_LR]
-       add     sp, sp, #S_FRAME_SIZE           // restore sp
        eret
        .endif
        .endm
@@ -1185,12 +1181,10 @@ alternative_endif
        ldr     x30, [x30, x29]
 
        msr     vbar_el1, x30
-       ldr     lr, [sp, #S_LR]
-       tramp_unmap_kernel      x29
+       tramp_unmap_kernel      x30
        .if     \regsize == 64
-       mrs     x29, far_el1
+       mrs     x30, far_el1
        .endif
-       add     sp, sp, #S_FRAME_SIZE           // restore sp
        eret
        .endm