Skip to content

Commit fc8eac3

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/entry: Move SIE indicator flag to thread info
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>
1 parent 213400c commit fc8eac3

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

arch/s390/include/asm/processor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414

1515
#include <linux/bits.h>
1616

17-
#define CIF_SIE 0 /* CPU needs SIE exit cleanup */
1817
#define CIF_NOHZ_DELAY 2 /* delay HZ disable for a tick */
1918
#define CIF_ENABLED_WAIT 5 /* in enabled wait state */
2019
#define CIF_MCCK_GUEST 6 /* machine check happening in guest */
2120
#define CIF_DEDICATED_CPU 7 /* this CPU is dedicated */
2221

23-
#define _CIF_SIE BIT(CIF_SIE)
2422
#define _CIF_NOHZ_DELAY BIT(CIF_NOHZ_DELAY)
2523
#define _CIF_ENABLED_WAIT BIT(CIF_ENABLED_WAIT)
2624
#define _CIF_MCCK_GUEST BIT(CIF_MCCK_GUEST)

arch/s390/include/asm/thread_info.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct thread_info {
4040
unsigned long flags; /* low level flags */
4141
unsigned long syscall_work; /* SYSCALL_WORK_ flags */
4242
unsigned int cpu; /* current CPU */
43+
unsigned char sie; /* running in SIE context */
4344
};
4445

4546
/*

arch/s390/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ int main(void)
2828
BLANK();
2929
/* thread info offsets */
3030
OFFSET(__TI_flags, task_struct, thread_info.flags);
31+
OFFSET(__TI_sie, task_struct, thread_info.sie);
3132
BLANK();
3233
/* pt_regs offsets */
3334
OFFSET(__PT_PSW, pt_regs, psw);

arch/s390/kernel/entry.S

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ _LPP_OFFSET = __LC_LPP
123123
lg %r9,\sie_control # get control block pointer
124124
ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE
125125
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
126-
ni __LC_CPU_FLAGS+7,255-_CIF_SIE
126+
lg %r9,__LC_CURRENT
127+
mvi __TI_sie(%r9),0
127128
larl %r9,sie_exit # skip forward to sie_exit
128129
.endm
129130
#endif
@@ -183,15 +184,15 @@ SYM_FUNC_END(__switch_to_asm)
183184
*/
184185
SYM_FUNC_START(__sie64a)
185186
stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers
186-
lg %r12,__LC_CURRENT
187+
lg %r14,__LC_CURRENT
187188
stg %r2,__SF_SIE_CONTROL_PHYS(%r15) # save sie block physical..
188189
stg %r3,__SF_SIE_CONTROL(%r15) # ...and virtual addresses
189190
stg %r4,__SF_SIE_SAVEAREA(%r15) # save guest register save area
190191
stg %r5,__SF_SIE_GUEST_ASCE(%r15) # save guest asce
191192
xc __SF_SIE_REASON(8,%r15),__SF_SIE_REASON(%r15) # reason code = 0
192-
mvc __SF_SIE_FLAGS(8,%r15),__TI_flags(%r12) # copy thread flags
193+
mvc __SF_SIE_FLAGS(8,%r15),__TI_flags(%r14) # copy thread flags
193194
lmg %r0,%r13,0(%r4) # load guest gprs 0-13
194-
oi __LC_CPU_FLAGS+7,_CIF_SIE
195+
mvi __TI_sie(%r14),1
195196
lctlg %c1,%c1,__SF_SIE_GUEST_ASCE(%r15) # load primary asce
196197
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
197198
oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
@@ -211,7 +212,8 @@ SYM_FUNC_START(__sie64a)
211212
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
212213
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
213214
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
214-
ni __LC_CPU_FLAGS+7,255-_CIF_SIE
215+
lg %r14,__LC_CURRENT
216+
mvi __TI_sie(%r14),0
215217
# some program checks are suppressing. C code (e.g. do_protection_exception)
216218
# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There
217219
# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable.
@@ -394,7 +396,8 @@ SYM_CODE_START(\name)
394396
tmhh %r8,0x0001 # interrupting from user ?
395397
jnz 1f
396398
#if IS_ENABLED(CONFIG_KVM)
397-
TSTMSK __LC_CPU_FLAGS,_CIF_SIE
399+
lg %r10,__LC_CURRENT
400+
tm __TI_sie(%r10),0xff
398401
jz 0f
399402
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
400403
SIEEXIT __SF_SIE_CONTROL(%r15)
@@ -469,9 +472,10 @@ SYM_CODE_START(mcck_int_handler)
469472
TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID
470473
jno .Lmcck_panic
471474
#if IS_ENABLED(CONFIG_KVM)
472-
TSTMSK __LC_CPU_FLAGS,_CIF_SIE
475+
lg %r10,__LC_CURRENT
476+
tm __TI_sie(%r10),0xff
473477
jz .Lmcck_user
474-
# Need to compare the address instead of a CIF_SIE* flag.
478+
# Need to compare the address instead of __TI_SIE flag.
475479
# Otherwise there would be a race between setting the flag
476480
# and entering SIE (or leaving and clearing the flag). This
477481
# would cause machine checks targeted at the guest to be

0 commit comments

Comments
 (0)