powerpc/64s: IOption for MSR stored in r12
authorRohan McLure <rmclure@linux.ibm.com>
Thu, 1 Dec 2022 07:10:16 +0000 (18:10 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2022 09:46:01 +0000 (20:46 +1100)
Interrupt handlers in asm/exceptions-64s.S contain a great deal of common
code produced by the GEN_COMMON macros. Currently, at the exit point of
the macro, r12 will contain the contents of the MSR. A future patch will
cause these macros to zeroise architected registers to avoid potential
speculation influence of user data.

Provide an IOption that signals that r12 must be retained, as the
interrupt handler assumes it to hold the contents of the MSR.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221201071019.1953023-4-rmclure@linux.ibm.com
arch/powerpc/kernel/exceptions-64s.S

index ac3b0580224eeea1daa212595275422d3bf3e2bd..42b7c3212f296987dab81b901b3b36c27ccb6da3 100644 (file)
@@ -111,6 +111,7 @@ name:
 #define ISTACK         .L_ISTACK_\name\()      /* Set regular kernel stack */
 #define __ISTACK(name) .L_ISTACK_ ## name
 #define IKUAP          .L_IKUAP_\name\()       /* Do KUAP lock */
+#define IMSR_R12       .L_IMSR_R12_\name\()    /* Assumes MSR saved to r12 */
 
 #define INT_DEFINE_BEGIN(n)                                            \
 .macro int_define_ ## n name
@@ -176,6 +177,9 @@ do_define_int n
        .ifndef IKUAP
                IKUAP=1
        .endif
+       .ifndef IMSR_R12
+               IMSR_R12=0
+       .endif
 .endm
 
 /*
@@ -1751,6 +1755,7 @@ INT_DEFINE_BEGIN(fp_unavailable)
 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
        IKVM_REAL=1
 #endif
+       IMSR_R12=1
 INT_DEFINE_END(fp_unavailable)
 
 EXC_REAL_BEGIN(fp_unavailable, 0x800, 0x100)
@@ -2384,6 +2389,7 @@ INT_DEFINE_BEGIN(altivec_unavailable)
 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
        IKVM_REAL=1
 #endif
+       IMSR_R12=1
 INT_DEFINE_END(altivec_unavailable)
 
 EXC_REAL_BEGIN(altivec_unavailable, 0xf20, 0x20)
@@ -2433,6 +2439,7 @@ INT_DEFINE_BEGIN(vsx_unavailable)
 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
        IKVM_REAL=1
 #endif
+       IMSR_R12=1
 INT_DEFINE_END(vsx_unavailable)
 
 EXC_REAL_BEGIN(vsx_unavailable, 0xf40, 0x20)