]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/entry: Move SIE indicator flag to thread info
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 22 Jul 2024 13:41:12 +0000 (15:41 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 23 Jul 2024 14:02:31 +0000 (16:02 +0200)
CIF_SIE indicates if a thread is running in SIE context. This is the
state of a thread and not the CPU. Therefore move this indicator to
thread info.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/processor.h
arch/s390/include/asm/thread_info.h
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/entry.S

index 3063488014eb4e42687f9dba27e05e46e9bcee51..5ecd442535b9ed260a889361a63960277718d69a 100644 (file)
 
 #include <linux/bits.h>
 
-#define CIF_SIE                        0       /* CPU needs SIE exit cleanup */
 #define CIF_NOHZ_DELAY         2       /* delay HZ disable for a tick */
 #define CIF_ENABLED_WAIT       5       /* in enabled wait state */
 #define CIF_MCCK_GUEST         6       /* machine check happening in guest */
 #define CIF_DEDICATED_CPU      7       /* this CPU is dedicated */
 
-#define _CIF_SIE               BIT(CIF_SIE)
 #define _CIF_NOHZ_DELAY                BIT(CIF_NOHZ_DELAY)
 #define _CIF_ENABLED_WAIT      BIT(CIF_ENABLED_WAIT)
 #define _CIF_MCCK_GUEST                BIT(CIF_MCCK_GUEST)
index d02a709717b87a3aa141ce12ee4fabba6457660e..00ac01874a129f560270b7ef9d8d9ecaa852a964 100644 (file)
@@ -40,6 +40,7 @@ struct thread_info {
        unsigned long           flags;          /* low level flags */
        unsigned long           syscall_work;   /* SYSCALL_WORK_ flags */
        unsigned int            cpu;            /* current CPU */
+       unsigned char           sie;            /* running in SIE context */
 };
 
 /*
index 58fc6b93b475f24845d11e6b1adc85b142b6fea2..ffa0dd2dbaacba0fcdaebf0e6c36abd5ceda47c1 100644 (file)
@@ -28,6 +28,7 @@ int main(void)
        BLANK();
        /* thread info offsets */
        OFFSET(__TI_flags, task_struct, thread_info.flags);
+       OFFSET(__TI_sie, task_struct, thread_info.sie);
        BLANK();
        /* pt_regs offsets */
        OFFSET(__PT_PSW, pt_regs, psw);
index a72d6494701d9389bc5d36013859bb950d0efedf..df351622c94c7e58e2af84a9ee209b2ee5a4f7f3 100644 (file)
@@ -123,7 +123,8 @@ _LPP_OFFSET = __LC_LPP
        lg      %r9,\sie_control                # get control block pointer
        ni      __SIE_PROG0C+3(%r9),0xfe        # no longer in SIE
        lctlg   %c1,%c1,__LC_KERNEL_ASCE        # load primary asce
-       ni      __LC_CPU_FLAGS+7,255-_CIF_SIE
+       lg      %r9,__LC_CURRENT
+       mvi     __TI_sie(%r9),0
        larl    %r9,sie_exit                    # skip forward to sie_exit
        .endm
 #endif
@@ -183,15 +184,15 @@ SYM_FUNC_END(__switch_to_asm)
  */
 SYM_FUNC_START(__sie64a)
        stmg    %r6,%r14,__SF_GPRS(%r15)        # save kernel registers
-       lg      %r12,__LC_CURRENT
+       lg      %r14,__LC_CURRENT
        stg     %r2,__SF_SIE_CONTROL_PHYS(%r15) # save sie block physical..
        stg     %r3,__SF_SIE_CONTROL(%r15)      # ...and virtual addresses
        stg     %r4,__SF_SIE_SAVEAREA(%r15)     # save guest register save area
        stg     %r5,__SF_SIE_GUEST_ASCE(%r15)   # save guest asce
        xc      __SF_SIE_REASON(8,%r15),__SF_SIE_REASON(%r15) # reason code = 0
-       mvc     __SF_SIE_FLAGS(8,%r15),__TI_flags(%r12) # copy thread flags
+       mvc     __SF_SIE_FLAGS(8,%r15),__TI_flags(%r14) # copy thread flags
        lmg     %r0,%r13,0(%r4)                 # load guest gprs 0-13
-       oi      __LC_CPU_FLAGS+7,_CIF_SIE
+       mvi     __TI_sie(%r14),1
        lctlg   %c1,%c1,__SF_SIE_GUEST_ASCE(%r15) # load primary asce
        lg      %r14,__SF_SIE_CONTROL(%r15)     # get control block pointer
        oi      __SIE_PROG0C+3(%r14),1          # we are going into SIE now
@@ -211,7 +212,8 @@ SYM_FUNC_START(__sie64a)
        lg      %r14,__SF_SIE_CONTROL(%r15)     # get control block pointer
        ni      __SIE_PROG0C+3(%r14),0xfe       # no longer in SIE
        lctlg   %c1,%c1,__LC_KERNEL_ASCE        # load primary asce
-       ni      __LC_CPU_FLAGS+7,255-_CIF_SIE
+       lg      %r14,__LC_CURRENT
+       mvi     __TI_sie(%r14),0
 # some program checks are suppressing. C code (e.g. do_protection_exception)
 # will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There
 # are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable.
@@ -394,7 +396,8 @@ SYM_CODE_START(\name)
        tmhh    %r8,0x0001                      # interrupting from user ?
        jnz     1f
 #if IS_ENABLED(CONFIG_KVM)
-       TSTMSK  __LC_CPU_FLAGS,_CIF_SIE
+       lg      %r10,__LC_CURRENT
+       tm      __TI_sie(%r10),0xff
        jz      0f
        BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
        SIEEXIT __SF_SIE_CONTROL(%r15)
@@ -469,9 +472,10 @@ SYM_CODE_START(mcck_int_handler)
        TSTMSK  __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID
        jno     .Lmcck_panic
 #if IS_ENABLED(CONFIG_KVM)
-       TSTMSK  __LC_CPU_FLAGS,_CIF_SIE
+       lg      %r10,__LC_CURRENT
+       tm      __TI_sie(%r10),0xff
        jz      .Lmcck_user
-       # Need to compare the address instead of a CIF_SIE* flag.
+       # Need to compare the address instead of __TI_SIE flag.
        # Otherwise there would be a race between setting the flag
        # and entering SIE (or leaving and clearing the flag). This
        # would cause machine checks targeted at the guest to be