aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2014-04-15 06:55:07 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-05-20 02:58:47 -0400
commitd3a73acbc26a4a81a01a35fd162973e53d0386f5 (patch)
tree5b8fd3880f3b38575b1a043f3f4f07623a633bd1 /arch/s390/kernel
parentbeef560b4cdfafb2211a856e1d722540f5151933 (diff)
s390: split TIF bits into CIF, PIF and TIF bits
The oi and ni instructions used in entry[64].S to set and clear bits in the thread-flags are not guaranteed to be atomic in regard to other CPUs. Split the TIF bits into CPU, pt_regs and thread-info specific bits. Updates on the TIF bits are done with atomic instructions, updates on CPU and pt_regs bits are done with non-atomic instructions. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/asm-offsets.c2
-rw-r--r--arch/s390/kernel/compat_signal.c2
-rw-r--r--arch/s390/kernel/entry.S87
-rw-r--r--arch/s390/kernel/entry64.S82
-rw-r--r--arch/s390/kernel/nmi.c8
-rw-r--r--arch/s390/kernel/process.c6
-rw-r--r--arch/s390/kernel/ptrace.c4
-rw-r--r--arch/s390/kernel/signal.c12
8 files changed, 105 insertions, 98 deletions
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index cc10cdd4d6a2..76c4e2f70cab 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -50,6 +50,7 @@ int main(void)
50 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code)); 50 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code));
51 DEFINE(__PT_INT_PARM, offsetof(struct pt_regs, int_parm)); 51 DEFINE(__PT_INT_PARM, offsetof(struct pt_regs, int_parm));
52 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long)); 52 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long));
53 DEFINE(__PT_FLAGS, offsetof(struct pt_regs, flags));
53 DEFINE(__PT_SIZE, sizeof(struct pt_regs)); 54 DEFINE(__PT_SIZE, sizeof(struct pt_regs));
54 BLANK(); 55 BLANK();
55 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain)); 56 DEFINE(__SF_BACKCHAIN, offsetof(struct stack_frame, back_chain));
@@ -115,6 +116,7 @@ int main(void)
115 DEFINE(__LC_SAVE_AREA_SYNC, offsetof(struct _lowcore, save_area_sync)); 116 DEFINE(__LC_SAVE_AREA_SYNC, offsetof(struct _lowcore, save_area_sync));
116 DEFINE(__LC_SAVE_AREA_ASYNC, offsetof(struct _lowcore, save_area_async)); 117 DEFINE(__LC_SAVE_AREA_ASYNC, offsetof(struct _lowcore, save_area_async));
117 DEFINE(__LC_SAVE_AREA_RESTART, offsetof(struct _lowcore, save_area_restart)); 118 DEFINE(__LC_SAVE_AREA_RESTART, offsetof(struct _lowcore, save_area_restart));
119 DEFINE(__LC_CPU_FLAGS, offsetof(struct _lowcore, cpu_flags));
118 DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw)); 120 DEFINE(__LC_RETURN_PSW, offsetof(struct _lowcore, return_psw));
119 DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw)); 121 DEFINE(__LC_RETURN_MCCK_PSW, offsetof(struct _lowcore, return_mcck_psw));
120 DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer)); 122 DEFINE(__LC_SYNC_ENTER_TIMER, offsetof(struct _lowcore, sync_enter_timer));
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 7df5ed9f44d7..f204d6920368 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -213,7 +213,7 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
213 sizeof(current->thread.fp_regs)); 213 sizeof(current->thread.fp_regs));
214 214
215 restore_fp_regs(current->thread.fp_regs.fprs); 215 restore_fp_regs(current->thread.fp_regs.fprs);
216 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 216 clear_pt_regs_flag(regs, PIF_SYSCALL); /* No longer in a system call */
217 return 0; 217 return 0;
218} 218}
219 219
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 7006bfdf5c52..18e5af848f9a 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -10,6 +10,7 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/processor.h>
13#include <asm/cache.h> 14#include <asm/cache.h>
14#include <asm/errno.h> 15#include <asm/errno.h>
15#include <asm/ptrace.h> 16#include <asm/ptrace.h>
@@ -37,18 +38,16 @@ __PT_R13 = __PT_GPRS + 524
37__PT_R14 = __PT_GPRS + 56 38__PT_R14 = __PT_GPRS + 56
38__PT_R15 = __PT_GPRS + 60 39__PT_R15 = __PT_GPRS + 60
39 40
40_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
41 _TIF_MCCK_PENDING | _TIF_PER_TRAP | _TIF_ASCE)
42_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
43 _TIF_MCCK_PENDING | _TIF_ASCE)
44_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
45 _TIF_SYSCALL_TRACEPOINT)
46_TIF_TRANSFER = (_TIF_MCCK_PENDING | _TIF_ASCE)
47
48STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 41STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
49STACK_SIZE = 1 << STACK_SHIFT 42STACK_SIZE = 1 << STACK_SHIFT
50STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE 43STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
51 44
45_TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED)
46_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
47 _TIF_SYSCALL_TRACEPOINT)
48_CIF_WORK = (_CIF_MCCK_PENDING | _CIF_ASCE)
49_PIF_WORK = (_PIF_PER_TRAP)
50
52#define BASED(name) name-system_call(%r13) 51#define BASED(name) name-system_call(%r13)
53 52
54 .macro TRACE_IRQS_ON 53 .macro TRACE_IRQS_ON
@@ -160,13 +159,7 @@ ENTRY(__switch_to)
160 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 159 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
161 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next 160 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next
162 l %r15,__THREAD_ksp(%r3) # load kernel stack of next 161 l %r15,__THREAD_ksp(%r3) # load kernel stack of next
163 lhi %r6,_TIF_TRANSFER # transfer TIF bits 162 lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
164 n %r6,__TI_flags(%r4) # isolate TIF bits
165 jz 0f
166 o %r6,__TI_flags(%r5) # set TIF bits of next
167 st %r6,__TI_flags(%r5)
168 ni __TI_flags+3(%r4),255-_TIF_TRANSFER # clear TIF bits of prev
1690: lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
170 br %r14 163 br %r14
171 164
172__critical_start: 165__critical_start:
@@ -181,6 +174,7 @@ sysc_stm:
181 stm %r8,%r15,__LC_SAVE_AREA_SYNC 174 stm %r8,%r15,__LC_SAVE_AREA_SYNC
182 l %r12,__LC_THREAD_INFO 175 l %r12,__LC_THREAD_INFO
183 l %r13,__LC_SVC_NEW_PSW+4 176 l %r13,__LC_SVC_NEW_PSW+4
177 lhi %r14,_PIF_SYSCALL
184sysc_per: 178sysc_per:
185 l %r15,__LC_KERNEL_STACK 179 l %r15,__LC_KERNEL_STACK
186 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs 180 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
@@ -190,8 +184,8 @@ sysc_vtime:
190 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC 184 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC
191 mvc __PT_PSW(8,%r11),__LC_SVC_OLD_PSW 185 mvc __PT_PSW(8,%r11),__LC_SVC_OLD_PSW
192 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC 186 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
187 st %r14,__PT_FLAGS(%r11)
193sysc_do_svc: 188sysc_do_svc:
194 oi __TI_flags+3(%r12),_TIF_SYSCALL
195 l %r10,__TI_sysc_table(%r12) # 31 bit system call table 189 l %r10,__TI_sysc_table(%r12) # 31 bit system call table
196 lh %r8,__PT_INT_CODE+2(%r11) 190 lh %r8,__PT_INT_CODE+2(%r11)
197 sla %r8,2 # shift and test for svc0 191 sla %r8,2 # shift and test for svc0
@@ -207,7 +201,7 @@ sysc_nr_ok:
207 st %r2,__PT_ORIG_GPR2(%r11) 201 st %r2,__PT_ORIG_GPR2(%r11)
208 st %r7,STACK_FRAME_OVERHEAD(%r15) 202 st %r7,STACK_FRAME_OVERHEAD(%r15)
209 l %r9,0(%r8,%r10) # get system call addr. 203 l %r9,0(%r8,%r10) # get system call addr.
210 tm __TI_flags+2(%r12),_TIF_TRACE >> 8 204 tm __TI_flags+3(%r12),_TIF_TRACE
211 jnz sysc_tracesys 205 jnz sysc_tracesys
212 basr %r14,%r9 # call sys_xxxx 206 basr %r14,%r9 # call sys_xxxx
213 st %r2,__PT_R2(%r11) # store return value 207 st %r2,__PT_R2(%r11) # store return value
@@ -217,9 +211,12 @@ sysc_return:
217sysc_tif: 211sysc_tif:
218 tm __PT_PSW+1(%r11),0x01 # returning to user ? 212 tm __PT_PSW+1(%r11),0x01 # returning to user ?
219 jno sysc_restore 213 jno sysc_restore
220 tm __TI_flags+3(%r12),_TIF_WORK_SVC 214 tm __PT_FLAGS+3(%r11),_PIF_WORK
221 jnz sysc_work # check for work 215 jnz sysc_work
222 ni __TI_flags+3(%r12),255-_TIF_SYSCALL 216 tm __TI_flags+3(%r12),_TIF_WORK
217 jnz sysc_work # check for thread work
218 tm __LC_CPU_FLAGS+3,_CIF_WORK
219 jnz sysc_work
223sysc_restore: 220sysc_restore:
224 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11) 221 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11)
225 stpt __LC_EXIT_TIMER 222 stpt __LC_EXIT_TIMER
@@ -231,17 +228,17 @@ sysc_done:
231# One of the work bits is on. Find out which one. 228# One of the work bits is on. Find out which one.
232# 229#
233sysc_work: 230sysc_work:
234 tm __TI_flags+3(%r12),_TIF_MCCK_PENDING 231 tm __LC_CPU_FLAGS+3,_CIF_MCCK_PENDING
235 jo sysc_mcck_pending 232 jo sysc_mcck_pending
236 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED 233 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED
237 jo sysc_reschedule 234 jo sysc_reschedule
238 tm __TI_flags+3(%r12),_TIF_PER_TRAP 235 tm __PT_FLAGS+3(%r11),_PIF_PER_TRAP
239 jo sysc_singlestep 236 jo sysc_singlestep
240 tm __TI_flags+3(%r12),_TIF_SIGPENDING 237 tm __TI_flags+3(%r12),_TIF_SIGPENDING
241 jo sysc_sigpending 238 jo sysc_sigpending
242 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME 239 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME
243 jo sysc_notify_resume 240 jo sysc_notify_resume
244 tm __TI_flags+3(%r12),_TIF_ASCE 241 tm __LC_CPU_FLAGS+3,_CIF_ASCE
245 jo sysc_uaccess 242 jo sysc_uaccess
246 j sysc_return # beware of critical section cleanup 243 j sysc_return # beware of critical section cleanup
247 244
@@ -254,7 +251,7 @@ sysc_reschedule:
254 br %r1 # call schedule 251 br %r1 # call schedule
255 252
256# 253#
257# _TIF_MCCK_PENDING is set, call handler 254# _CIF_MCCK_PENDING is set, call handler
258# 255#
259sysc_mcck_pending: 256sysc_mcck_pending:
260 l %r1,BASED(.Lhandle_mcck) 257 l %r1,BASED(.Lhandle_mcck)
@@ -262,10 +259,10 @@ sysc_mcck_pending:
262 br %r1 # TIF bit will be cleared by handler 259 br %r1 # TIF bit will be cleared by handler
263 260
264# 261#
265# _TIF_ASCE is set, load user space asce 262# _CIF_ASCE is set, load user space asce
266# 263#
267sysc_uaccess: 264sysc_uaccess:
268 ni __TI_flags+3(%r12),255-_TIF_ASCE 265 ni __LC_CPU_FLAGS+3,255-_CIF_ASCE
269 lctl %c1,%c1,__LC_USER_ASCE # load primary asce 266 lctl %c1,%c1,__LC_USER_ASCE # load primary asce
270 j sysc_return 267 j sysc_return
271 268
@@ -276,7 +273,7 @@ sysc_sigpending:
276 lr %r2,%r11 # pass pointer to pt_regs 273 lr %r2,%r11 # pass pointer to pt_regs
277 l %r1,BASED(.Ldo_signal) 274 l %r1,BASED(.Ldo_signal)
278 basr %r14,%r1 # call do_signal 275 basr %r14,%r1 # call do_signal
279 tm __TI_flags+3(%r12),_TIF_SYSCALL 276 tm __PT_FLAGS+3(%r11),_PIF_SYSCALL
280 jno sysc_return 277 jno sysc_return
281 lm %r2,%r7,__PT_R2(%r11) # load svc arguments 278 lm %r2,%r7,__PT_R2(%r11) # load svc arguments
282 l %r10,__TI_sysc_table(%r12) # 31 bit system call table 279 l %r10,__TI_sysc_table(%r12) # 31 bit system call table
@@ -297,10 +294,10 @@ sysc_notify_resume:
297 br %r1 # call do_notify_resume 294 br %r1 # call do_notify_resume
298 295
299# 296#
300# _TIF_PER_TRAP is set, call do_per_trap 297# _PIF_PER_TRAP is set, call do_per_trap
301# 298#
302sysc_singlestep: 299sysc_singlestep:
303 ni __TI_flags+3(%r12),255-_TIF_PER_TRAP 300 ni __PT_FLAGS+3(%r11),255-_PIF_PER_TRAP
304 lr %r2,%r11 # pass pointer to pt_regs 301 lr %r2,%r11 # pass pointer to pt_regs
305 l %r1,BASED(.Ldo_per_trap) 302 l %r1,BASED(.Ldo_per_trap)
306 la %r14,BASED(sysc_return) 303 la %r14,BASED(sysc_return)
@@ -330,7 +327,7 @@ sysc_tracego:
330 basr %r14,%r9 # call sys_xxx 327 basr %r14,%r9 # call sys_xxx
331 st %r2,__PT_R2(%r11) # store return value 328 st %r2,__PT_R2(%r11) # store return value
332sysc_tracenogo: 329sysc_tracenogo:
333 tm __TI_flags+2(%r12),_TIF_TRACE >> 8 330 tm __TI_flags+3(%r12),_TIF_TRACE
334 jz sysc_return 331 jz sysc_return
335 l %r1,BASED(.Ltrace_exit) 332 l %r1,BASED(.Ltrace_exit)
336 lr %r2,%r11 # pass pointer to pt_regs 333 lr %r2,%r11 # pass pointer to pt_regs
@@ -384,12 +381,13 @@ ENTRY(pgm_check_handler)
384 stm %r8,%r9,__PT_PSW(%r11) 381 stm %r8,%r9,__PT_PSW(%r11)
385 mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC 382 mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC
386 mvc __PT_INT_PARM_LONG(4,%r11),__LC_TRANS_EXC_CODE 383 mvc __PT_INT_PARM_LONG(4,%r11),__LC_TRANS_EXC_CODE
384 xc __PT_FLAGS(4,%r11),__PT_FLAGS(%r11)
387 tm __LC_PGM_ILC+3,0x80 # check for per exception 385 tm __LC_PGM_ILC+3,0x80 # check for per exception
388 jz 0f 386 jz 0f
389 l %r1,__TI_task(%r12) 387 l %r1,__TI_task(%r12)
390 tmh %r8,0x0001 # kernel per event ? 388 tmh %r8,0x0001 # kernel per event ?
391 jz pgm_kprobe 389 jz pgm_kprobe
392 oi __TI_flags+3(%r12),_TIF_PER_TRAP 390 oi __PT_FLAGS+3(%r11),_PIF_PER_TRAP
393 mvc __THREAD_per_address(4,%r1),__LC_PER_ADDRESS 391 mvc __THREAD_per_address(4,%r1),__LC_PER_ADDRESS
394 mvc __THREAD_per_cause(2,%r1),__LC_PER_CAUSE 392 mvc __THREAD_per_cause(2,%r1),__LC_PER_CAUSE
395 mvc __THREAD_per_paid(1,%r1),__LC_PER_PAID 393 mvc __THREAD_per_paid(1,%r1),__LC_PER_PAID
@@ -420,9 +418,9 @@ pgm_kprobe:
420# single stepped system call 418# single stepped system call
421# 419#
422pgm_svcper: 420pgm_svcper:
423 oi __TI_flags+3(%r12),_TIF_PER_TRAP
424 mvc __LC_RETURN_PSW(4),__LC_SVC_NEW_PSW 421 mvc __LC_RETURN_PSW(4),__LC_SVC_NEW_PSW
425 mvc __LC_RETURN_PSW+4(4),BASED(.Lsysc_per) 422 mvc __LC_RETURN_PSW+4(4),BASED(.Lsysc_per)
423 lhi %r14,_PIF_SYSCALL | _PIF_PER_TRAP
426 lpsw __LC_RETURN_PSW # branch to sysc_per and enable irqs 424 lpsw __LC_RETURN_PSW # branch to sysc_per and enable irqs
427 425
428/* 426/*
@@ -445,6 +443,7 @@ io_skip:
445 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC 443 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC
446 stm %r8,%r9,__PT_PSW(%r11) 444 stm %r8,%r9,__PT_PSW(%r11)
447 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 445 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
446 xc __PT_FLAGS(4,%r11),__PT_FLAGS(%r11)
448 TRACE_IRQS_OFF 447 TRACE_IRQS_OFF
449 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 448 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
450io_loop: 449io_loop:
@@ -466,8 +465,10 @@ io_return:
466 LOCKDEP_SYS_EXIT 465 LOCKDEP_SYS_EXIT
467 TRACE_IRQS_ON 466 TRACE_IRQS_ON
468io_tif: 467io_tif:
469 tm __TI_flags+3(%r12),_TIF_WORK_INT 468 tm __TI_flags+3(%r12),_TIF_WORK
470 jnz io_work # there is work to do (signals etc.) 469 jnz io_work # there is work to do (signals etc.)
470 tm __LC_CPU_FLAGS+3,_CIF_WORK
471 jnz io_work
471io_restore: 472io_restore:
472 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11) 473 mvc __LC_RETURN_PSW(8),__PT_PSW(%r11)
473 stpt __LC_EXIT_TIMER 474 stpt __LC_EXIT_TIMER
@@ -477,7 +478,7 @@ io_done:
477 478
478# 479#
479# There is work todo, find out in which context we have been interrupted: 480# There is work todo, find out in which context we have been interrupted:
480# 1) if we return to user space we can do all _TIF_WORK_INT work 481# 1) if we return to user space we can do all _TIF_WORK work
481# 2) if we return to kernel code and preemptive scheduling is enabled check 482# 2) if we return to kernel code and preemptive scheduling is enabled check
482# the preemption counter and if it is zero call preempt_schedule_irq 483# the preemption counter and if it is zero call preempt_schedule_irq
483# Before any work can be done, a switch to the kernel stack is required. 484# Before any work can be done, a switch to the kernel stack is required.
@@ -520,11 +521,9 @@ io_work_user:
520 521
521# 522#
522# One of the work bits is on. Find out which one. 523# One of the work bits is on. Find out which one.
523# Checked are: _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_NEED_RESCHED
524# and _TIF_MCCK_PENDING
525# 524#
526io_work_tif: 525io_work_tif:
527 tm __TI_flags+3(%r12),_TIF_MCCK_PENDING 526 tm __LC_CPU_FLAGS+3(%r12),_CIF_MCCK_PENDING
528 jo io_mcck_pending 527 jo io_mcck_pending
529 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED 528 tm __TI_flags+3(%r12),_TIF_NEED_RESCHED
530 jo io_reschedule 529 jo io_reschedule
@@ -532,12 +531,12 @@ io_work_tif:
532 jo io_sigpending 531 jo io_sigpending
533 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME 532 tm __TI_flags+3(%r12),_TIF_NOTIFY_RESUME
534 jo io_notify_resume 533 jo io_notify_resume
535 tm __TI_flags+3(%r12),_TIF_ASCE 534 tm __LC_CPU_FLAGS+3,_CIF_ASCE
536 jo io_uaccess 535 jo io_uaccess
537 j io_return # beware of critical section cleanup 536 j io_return # beware of critical section cleanup
538 537
539# 538#
540# _TIF_MCCK_PENDING is set, call handler 539# _CIF_MCCK_PENDING is set, call handler
541# 540#
542io_mcck_pending: 541io_mcck_pending:
543 # TRACE_IRQS_ON already done at io_return 542 # TRACE_IRQS_ON already done at io_return
@@ -547,10 +546,10 @@ io_mcck_pending:
547 j io_return 546 j io_return
548 547
549# 548#
550# _TIF_ASCE is set, load user space asce 549# _CIF_ASCE is set, load user space asce
551# 550#
552io_uaccess: 551io_uaccess:
553 ni __TI_flags+3(%r12),255-_TIF_ASCE 552 ni __LC_CPU_FLAGS+3,255-_CIF_ASCE
554 lctl %c1,%c1,__LC_USER_ASCE # load primary asce 553 lctl %c1,%c1,__LC_USER_ASCE # load primary asce
555 j io_return 554 j io_return
556 555
@@ -613,6 +612,7 @@ ext_skip:
613 stm %r8,%r9,__PT_PSW(%r11) 612 stm %r8,%r9,__PT_PSW(%r11)
614 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR 613 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR
615 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS 614 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS
615 xc __PT_FLAGS(4,%r11),__PT_FLAGS(%r11)
616 TRACE_IRQS_OFF 616 TRACE_IRQS_OFF
617 l %r1,BASED(.Ldo_IRQ) 617 l %r1,BASED(.Ldo_IRQ)
618 lr %r2,%r11 # pass pointer to pt_regs 618 lr %r2,%r11 # pass pointer to pt_regs
@@ -677,6 +677,7 @@ mcck_skip:
677 stm %r0,%r7,__PT_R0(%r11) 677 stm %r0,%r7,__PT_R0(%r11)
678 mvc __PT_R8(32,%r11),__LC_GPREGS_SAVE_AREA+32 678 mvc __PT_R8(32,%r11),__LC_GPREGS_SAVE_AREA+32
679 stm %r8,%r9,__PT_PSW(%r11) 679 stm %r8,%r9,__PT_PSW(%r11)
680 xc __PT_FLAGS(4,%r11),__PT_FLAGS(%r11)
680 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 681 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
681 l %r1,BASED(.Ldo_machine_check) 682 l %r1,BASED(.Ldo_machine_check)
682 lr %r2,%r11 # pass pointer to pt_regs 683 lr %r2,%r11 # pass pointer to pt_regs
@@ -689,7 +690,7 @@ mcck_skip:
689 la %r11,STACK_FRAME_OVERHEAD(%r15) 690 la %r11,STACK_FRAME_OVERHEAD(%r15)
690 lr %r15,%r1 691 lr %r15,%r1
691 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off 692 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
692 tm __TI_flags+3(%r12),_TIF_MCCK_PENDING 693 tm __LC_CPU_FLAGS+3,_CIF_MCCK_PENDING
693 jno mcck_return 694 jno mcck_return
694 TRACE_IRQS_OFF 695 TRACE_IRQS_OFF
695 l %r1,BASED(.Lhandle_mcck) 696 l %r1,BASED(.Lhandle_mcck)
@@ -842,6 +843,8 @@ cleanup_system_call:
842 stm %r0,%r7,__PT_R0(%r9) 843 stm %r0,%r7,__PT_R0(%r9)
843 mvc __PT_PSW(8,%r9),__LC_SVC_OLD_PSW 844 mvc __PT_PSW(8,%r9),__LC_SVC_OLD_PSW
844 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC 845 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC
846 xc __PT_FLAGS(4,%r9),__PT_FLAGS(%r9)
847 mvi __PT_FLAGS+3(%r9),_PIF_SYSCALL
845 # setup saved register 15 848 # setup saved register 15
846 st %r15,28(%r11) # r15 stack pointer 849 st %r15,28(%r11) # r15 stack pointer
847 # set new psw address and exit 850 # set new psw address and exit
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index d15e7bf6a863..c41f3f906720 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -42,13 +42,11 @@ STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
42STACK_SIZE = 1 << STACK_SHIFT 42STACK_SIZE = 1 << STACK_SHIFT
43STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE 43STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
44 44
45_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 45_TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED)
46 _TIF_MCCK_PENDING | _TIF_PER_TRAP | _TIF_ASCE) 46_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
47_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 47 _TIF_SYSCALL_TRACEPOINT)
48 _TIF_MCCK_PENDING | _TIF_ASCE) 48_CIF_WORK = (_CIF_MCCK_PENDING | _CIF_ASCE)
49_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 49_PIF_WORK = (_PIF_PER_TRAP)
50 _TIF_SYSCALL_TRACEPOINT)
51_TIF_TRANSFER = (_TIF_MCCK_PENDING | _TIF_ASCE)
52 50
53#define BASED(name) name-system_call(%r13) 51#define BASED(name) name-system_call(%r13)
54 52
@@ -190,13 +188,7 @@ ENTRY(__switch_to)
190 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 188 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
191 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next 189 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next
192 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next 190 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next
193 llill %r6,_TIF_TRANSFER # transfer TIF bits 191 lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
194 ng %r6,__TI_flags(%r4) # isolate TIF bits
195 jz 0f
196 og %r6,__TI_flags(%r5) # set TIF bits of next
197 stg %r6,__TI_flags(%r5)
198 ni __TI_flags+7(%r4),255-_TIF_TRANSFER # clear TIF bits of prev
1990: lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
200 br %r14 192 br %r14
201 193
202__critical_start: 194__critical_start:
@@ -211,6 +203,7 @@ sysc_stmg:
211 stmg %r8,%r15,__LC_SAVE_AREA_SYNC 203 stmg %r8,%r15,__LC_SAVE_AREA_SYNC
212 lg %r10,__LC_LAST_BREAK 204 lg %r10,__LC_LAST_BREAK
213 lg %r12,__LC_THREAD_INFO 205 lg %r12,__LC_THREAD_INFO
206 lghi %r14,_PIF_SYSCALL
214sysc_per: 207sysc_per:
215 lg %r15,__LC_KERNEL_STACK 208 lg %r15,__LC_KERNEL_STACK
216 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs 209 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
@@ -221,8 +214,8 @@ sysc_vtime:
221 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC 214 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
222 mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW 215 mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW
223 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC 216 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
217 stg %r14,__PT_FLAGS(%r11)
224sysc_do_svc: 218sysc_do_svc:
225 oi __TI_flags+7(%r12),_TIF_SYSCALL
226 lg %r10,__TI_sysc_table(%r12) # address of system call table 219 lg %r10,__TI_sysc_table(%r12) # address of system call table
227 llgh %r8,__PT_INT_CODE+2(%r11) 220 llgh %r8,__PT_INT_CODE+2(%r11)
228 slag %r8,%r8,2 # shift and test for svc 0 221 slag %r8,%r8,2 # shift and test for svc 0
@@ -238,7 +231,7 @@ sysc_nr_ok:
238 stg %r2,__PT_ORIG_GPR2(%r11) 231 stg %r2,__PT_ORIG_GPR2(%r11)
239 stg %r7,STACK_FRAME_OVERHEAD(%r15) 232 stg %r7,STACK_FRAME_OVERHEAD(%r15)
240 lgf %r9,0(%r8,%r10) # get system call add. 233 lgf %r9,0(%r8,%r10) # get system call add.
241 tm __TI_flags+6(%r12),_TIF_TRACE >> 8 234 tm __TI_flags+7(%r12),_TIF_TRACE
242 jnz sysc_tracesys 235 jnz sysc_tracesys
243 basr %r14,%r9 # call sys_xxxx 236 basr %r14,%r9 # call sys_xxxx
244 stg %r2,__PT_R2(%r11) # store return value 237 stg %r2,__PT_R2(%r11) # store return value
@@ -248,9 +241,12 @@ sysc_return:
248sysc_tif: 241sysc_tif:
249 tm __PT_PSW+1(%r11),0x01 # returning to user ? 242 tm __PT_PSW+1(%r11),0x01 # returning to user ?
250 jno sysc_restore 243 jno sysc_restore
251 tm __TI_flags+7(%r12),_TIF_WORK_SVC 244 tm __PT_FLAGS+7(%r11),_PIF_WORK
245 jnz sysc_work
246 tm __TI_flags+7(%r12),_TIF_WORK
252 jnz sysc_work # check for work 247 jnz sysc_work # check for work
253 ni __TI_flags+7(%r12),255-_TIF_SYSCALL 248 tm __LC_CPU_FLAGS+7,_CIF_WORK
249 jnz sysc_work
254sysc_restore: 250sysc_restore:
255 lg %r14,__LC_VDSO_PER_CPU 251 lg %r14,__LC_VDSO_PER_CPU
256 lmg %r0,%r10,__PT_R0(%r11) 252 lmg %r0,%r10,__PT_R0(%r11)
@@ -265,17 +261,17 @@ sysc_done:
265# One of the work bits is on. Find out which one. 261# One of the work bits is on. Find out which one.
266# 262#
267sysc_work: 263sysc_work:
268 tm __TI_flags+7(%r12),_TIF_MCCK_PENDING 264 tm __LC_CPU_FLAGS+7,_CIF_MCCK_PENDING
269 jo sysc_mcck_pending 265 jo sysc_mcck_pending
270 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED 266 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED
271 jo sysc_reschedule 267 jo sysc_reschedule
272 tm __TI_flags+7(%r12),_TIF_PER_TRAP 268 tm __PT_FLAGS+7(%r11),_PIF_PER_TRAP
273 jo sysc_singlestep 269 jo sysc_singlestep
274 tm __TI_flags+7(%r12),_TIF_SIGPENDING 270 tm __TI_flags+7(%r12),_TIF_SIGPENDING
275 jo sysc_sigpending 271 jo sysc_sigpending
276 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME 272 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME
277 jo sysc_notify_resume 273 jo sysc_notify_resume
278 tm __TI_flags+7(%r12),_TIF_ASCE 274 tm __LC_CPU_FLAGS+7,_CIF_ASCE
279 jo sysc_uaccess 275 jo sysc_uaccess
280 j sysc_return # beware of critical section cleanup 276 j sysc_return # beware of critical section cleanup
281 277
@@ -287,17 +283,17 @@ sysc_reschedule:
287 jg schedule 283 jg schedule
288 284
289# 285#
290# _TIF_MCCK_PENDING is set, call handler 286# _CIF_MCCK_PENDING is set, call handler
291# 287#
292sysc_mcck_pending: 288sysc_mcck_pending:
293 larl %r14,sysc_return 289 larl %r14,sysc_return
294 jg s390_handle_mcck # TIF bit will be cleared by handler 290 jg s390_handle_mcck # TIF bit will be cleared by handler
295 291
296# 292#
297# _TIF_ASCE is set, load user space asce 293# _CIF_ASCE is set, load user space asce
298# 294#
299sysc_uaccess: 295sysc_uaccess:
300 ni __TI_flags+7(%r12),255-_TIF_ASCE 296 ni __LC_CPU_FLAGS+7,255-_CIF_ASCE
301 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 297 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
302 j sysc_return 298 j sysc_return
303 299
@@ -307,7 +303,7 @@ sysc_uaccess:
307sysc_sigpending: 303sysc_sigpending:
308 lgr %r2,%r11 # pass pointer to pt_regs 304 lgr %r2,%r11 # pass pointer to pt_regs
309 brasl %r14,do_signal 305 brasl %r14,do_signal
310 tm __TI_flags+7(%r12),_TIF_SYSCALL 306 tm __PT_FLAGS+7(%r11),_PIF_SYSCALL
311 jno sysc_return 307 jno sysc_return
312 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments 308 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments
313 lg %r10,__TI_sysc_table(%r12) # address of system call table 309 lg %r10,__TI_sysc_table(%r12) # address of system call table
@@ -327,10 +323,10 @@ sysc_notify_resume:
327 jg do_notify_resume 323 jg do_notify_resume
328 324
329# 325#
330# _TIF_PER_TRAP is set, call do_per_trap 326# _PIF_PER_TRAP is set, call do_per_trap
331# 327#
332sysc_singlestep: 328sysc_singlestep:
333 ni __TI_flags+7(%r12),255-_TIF_PER_TRAP 329 ni __PT_FLAGS+7(%r11),255-_PIF_PER_TRAP
334 lgr %r2,%r11 # pass pointer to pt_regs 330 lgr %r2,%r11 # pass pointer to pt_regs
335 larl %r14,sysc_return 331 larl %r14,sysc_return
336 jg do_per_trap 332 jg do_per_trap
@@ -357,7 +353,7 @@ sysc_tracego:
357 basr %r14,%r9 # call sys_xxx 353 basr %r14,%r9 # call sys_xxx
358 stg %r2,__PT_R2(%r11) # store return value 354 stg %r2,__PT_R2(%r11) # store return value
359sysc_tracenogo: 355sysc_tracenogo:
360 tm __TI_flags+6(%r12),_TIF_TRACE >> 8 356 tm __TI_flags+7(%r12),_TIF_TRACE
361 jz sysc_return 357 jz sysc_return
362 lgr %r2,%r11 # pass pointer to pt_regs 358 lgr %r2,%r11 # pass pointer to pt_regs
363 larl %r14,sysc_return 359 larl %r14,sysc_return
@@ -416,12 +412,13 @@ ENTRY(pgm_check_handler)
416 stmg %r8,%r9,__PT_PSW(%r11) 412 stmg %r8,%r9,__PT_PSW(%r11)
417 mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC 413 mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC
418 mvc __PT_INT_PARM_LONG(8,%r11),__LC_TRANS_EXC_CODE 414 mvc __PT_INT_PARM_LONG(8,%r11),__LC_TRANS_EXC_CODE
415 xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
419 stg %r10,__PT_ARGS(%r11) 416 stg %r10,__PT_ARGS(%r11)
420 tm __LC_PGM_ILC+3,0x80 # check for per exception 417 tm __LC_PGM_ILC+3,0x80 # check for per exception
421 jz 0f 418 jz 0f
422 tmhh %r8,0x0001 # kernel per event ? 419 tmhh %r8,0x0001 # kernel per event ?
423 jz pgm_kprobe 420 jz pgm_kprobe
424 oi __TI_flags+7(%r12),_TIF_PER_TRAP 421 oi __PT_FLAGS+7(%r11),_PIF_PER_TRAP
425 mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS 422 mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS
426 mvc __THREAD_per_cause(2,%r14),__LC_PER_CAUSE 423 mvc __THREAD_per_cause(2,%r14),__LC_PER_CAUSE
427 mvc __THREAD_per_paid(1,%r14),__LC_PER_PAID 424 mvc __THREAD_per_paid(1,%r14),__LC_PER_PAID
@@ -451,10 +448,10 @@ pgm_kprobe:
451# single stepped system call 448# single stepped system call
452# 449#
453pgm_svcper: 450pgm_svcper:
454 oi __TI_flags+7(%r12),_TIF_PER_TRAP
455 mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW 451 mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW
456 larl %r14,sysc_per 452 larl %r14,sysc_per
457 stg %r14,__LC_RETURN_PSW+8 453 stg %r14,__LC_RETURN_PSW+8
454 lghi %r14,_PIF_SYSCALL | _PIF_PER_TRAP
458 lpswe __LC_RETURN_PSW # branch to sysc_per and enable irqs 455 lpswe __LC_RETURN_PSW # branch to sysc_per and enable irqs
459 456
460/* 457/*
@@ -479,6 +476,7 @@ io_skip:
479 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 476 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
480 stmg %r8,%r9,__PT_PSW(%r11) 477 stmg %r8,%r9,__PT_PSW(%r11)
481 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID 478 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
479 xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
482 TRACE_IRQS_OFF 480 TRACE_IRQS_OFF
483 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 481 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
484io_loop: 482io_loop:
@@ -499,8 +497,10 @@ io_return:
499 LOCKDEP_SYS_EXIT 497 LOCKDEP_SYS_EXIT
500 TRACE_IRQS_ON 498 TRACE_IRQS_ON
501io_tif: 499io_tif:
502 tm __TI_flags+7(%r12),_TIF_WORK_INT 500 tm __TI_flags+7(%r12),_TIF_WORK
503 jnz io_work # there is work to do (signals etc.) 501 jnz io_work # there is work to do (signals etc.)
502 tm __LC_CPU_FLAGS+7,_CIF_WORK
503 jnz io_work
504io_restore: 504io_restore:
505 lg %r14,__LC_VDSO_PER_CPU 505 lg %r14,__LC_VDSO_PER_CPU
506 lmg %r0,%r10,__PT_R0(%r11) 506 lmg %r0,%r10,__PT_R0(%r11)
@@ -513,7 +513,7 @@ io_done:
513 513
514# 514#
515# There is work todo, find out in which context we have been interrupted: 515# There is work todo, find out in which context we have been interrupted:
516# 1) if we return to user space we can do all _TIF_WORK_INT work 516# 1) if we return to user space we can do all _TIF_WORK work
517# 2) if we return to kernel code and kvm is enabled check if we need to 517# 2) if we return to kernel code and kvm is enabled check if we need to
518# modify the psw to leave SIE 518# modify the psw to leave SIE
519# 3) if we return to kernel code and preemptive scheduling is enabled check 519# 3) if we return to kernel code and preemptive scheduling is enabled check
@@ -557,11 +557,9 @@ io_work_user:
557 557
558# 558#
559# One of the work bits is on. Find out which one. 559# One of the work bits is on. Find out which one.
560# Checked are: _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_NEED_RESCHED
561# and _TIF_MCCK_PENDING
562# 560#
563io_work_tif: 561io_work_tif:
564 tm __TI_flags+7(%r12),_TIF_MCCK_PENDING 562 tm __LC_CPU_FLAGS+7,_CIF_MCCK_PENDING
565 jo io_mcck_pending 563 jo io_mcck_pending
566 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED 564 tm __TI_flags+7(%r12),_TIF_NEED_RESCHED
567 jo io_reschedule 565 jo io_reschedule
@@ -569,12 +567,12 @@ io_work_tif:
569 jo io_sigpending 567 jo io_sigpending
570 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME 568 tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME
571 jo io_notify_resume 569 jo io_notify_resume
572 tm __TI_flags+7(%r12),_TIF_ASCE 570 tm __LC_CPU_FLAGS+7,_CIF_ASCE
573 jo io_uaccess 571 jo io_uaccess
574 j io_return # beware of critical section cleanup 572 j io_return # beware of critical section cleanup
575 573
576# 574#
577# _TIF_MCCK_PENDING is set, call handler 575# _CIF_MCCK_PENDING is set, call handler
578# 576#
579io_mcck_pending: 577io_mcck_pending:
580 # TRACE_IRQS_ON already done at io_return 578 # TRACE_IRQS_ON already done at io_return
@@ -583,10 +581,10 @@ io_mcck_pending:
583 j io_return 581 j io_return
584 582
585# 583#
586# _TIF_ASCE is set, load user space asce 584# _CIF_ASCE is set, load user space asce
587# 585#
588io_uaccess: 586io_uaccess:
589 ni __TI_flags+7(%r12),255-_TIF_ASCE 587 ni __LC_CPU_FLAGS+7,255-_CIF_ASCE
590 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 588 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
591 j io_return 589 j io_return
592 590
@@ -650,6 +648,7 @@ ext_skip:
650 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR 648 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR
651 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS 649 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS
652 mvc __PT_INT_PARM_LONG(8,%r11),0(%r1) 650 mvc __PT_INT_PARM_LONG(8,%r11),0(%r1)
651 xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
653 TRACE_IRQS_OFF 652 TRACE_IRQS_OFF
654 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 653 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
655 lgr %r2,%r11 # pass pointer to pt_regs 654 lgr %r2,%r11 # pass pointer to pt_regs
@@ -716,6 +715,7 @@ mcck_skip:
716 stmg %r0,%r7,__PT_R0(%r11) 715 stmg %r0,%r7,__PT_R0(%r11)
717 mvc __PT_R8(64,%r11),0(%r14) 716 mvc __PT_R8(64,%r11),0(%r14)
718 stmg %r8,%r9,__PT_PSW(%r11) 717 stmg %r8,%r9,__PT_PSW(%r11)
718 xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
719 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 719 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
720 lgr %r2,%r11 # pass pointer to pt_regs 720 lgr %r2,%r11 # pass pointer to pt_regs
721 brasl %r14,s390_do_machine_check 721 brasl %r14,s390_do_machine_check
@@ -727,7 +727,7 @@ mcck_skip:
727 la %r11,STACK_FRAME_OVERHEAD(%r1) 727 la %r11,STACK_FRAME_OVERHEAD(%r1)
728 lgr %r15,%r1 728 lgr %r15,%r1
729 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off 729 ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
730 tm __TI_flags+7(%r12),_TIF_MCCK_PENDING 730 tm __LC_CPU_FLAGS+7,_CIF_MCCK_PENDING
731 jno mcck_return 731 jno mcck_return
732 TRACE_IRQS_OFF 732 TRACE_IRQS_OFF
733 brasl %r14,s390_handle_mcck 733 brasl %r14,s390_handle_mcck
@@ -884,6 +884,8 @@ cleanup_system_call:
884 stmg %r0,%r7,__PT_R0(%r9) 884 stmg %r0,%r7,__PT_R0(%r9)
885 mvc __PT_PSW(16,%r9),__LC_SVC_OLD_PSW 885 mvc __PT_PSW(16,%r9),__LC_SVC_OLD_PSW
886 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC 886 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC
887 xc __PT_FLAGS(8,%r9),__PT_FLAGS(%r9)
888 mvi __PT_FLAGS+7(%r9),_PIF_SYSCALL
887 # setup saved register r15 889 # setup saved register r15
888 stg %r15,56(%r11) # r15 stack pointer 890 stg %r15,56(%r11) # r15 stack pointer
889 # set new psw address and exit 891 # set new psw address and exit
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index c4c033819879..210e1285f75a 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -55,7 +55,7 @@ void s390_handle_mcck(void)
55 local_mcck_disable(); 55 local_mcck_disable();
56 mcck = __get_cpu_var(cpu_mcck); 56 mcck = __get_cpu_var(cpu_mcck);
57 memset(&__get_cpu_var(cpu_mcck), 0, sizeof(struct mcck_struct)); 57 memset(&__get_cpu_var(cpu_mcck), 0, sizeof(struct mcck_struct));
58 clear_thread_flag(TIF_MCCK_PENDING); 58 clear_cpu_flag(CIF_MCCK_PENDING);
59 local_mcck_enable(); 59 local_mcck_enable();
60 local_irq_restore(flags); 60 local_irq_restore(flags);
61 61
@@ -313,7 +313,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
313 */ 313 */
314 mcck->kill_task = 1; 314 mcck->kill_task = 1;
315 mcck->mcck_code = *(unsigned long long *) mci; 315 mcck->mcck_code = *(unsigned long long *) mci;
316 set_thread_flag(TIF_MCCK_PENDING); 316 set_cpu_flag(CIF_MCCK_PENDING);
317 } else { 317 } else {
318 /* 318 /*
319 * Couldn't restore all register contents while in 319 * Couldn't restore all register contents while in
@@ -352,12 +352,12 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
352 if (mci->cp) { 352 if (mci->cp) {
353 /* Channel report word pending */ 353 /* Channel report word pending */
354 mcck->channel_report = 1; 354 mcck->channel_report = 1;
355 set_thread_flag(TIF_MCCK_PENDING); 355 set_cpu_flag(CIF_MCCK_PENDING);
356 } 356 }
357 if (mci->w) { 357 if (mci->w) {
358 /* Warning pending */ 358 /* Warning pending */
359 mcck->warning = 1; 359 mcck->warning = 1;
360 set_thread_flag(TIF_MCCK_PENDING); 360 set_cpu_flag(CIF_MCCK_PENDING);
361 } 361 }
362 nmi_exit(); 362 nmi_exit();
363} 363}
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index dd145321d215..93b9ca42e5c0 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -64,7 +64,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
64void arch_cpu_idle(void) 64void arch_cpu_idle(void)
65{ 65{
66 local_mcck_disable(); 66 local_mcck_disable();
67 if (test_thread_flag(TIF_MCCK_PENDING)) { 67 if (test_cpu_flag(CIF_MCCK_PENDING)) {
68 local_mcck_enable(); 68 local_mcck_enable();
69 local_irq_enable(); 69 local_irq_enable();
70 return; 70 return;
@@ -76,7 +76,7 @@ void arch_cpu_idle(void)
76 76
77void arch_cpu_idle_exit(void) 77void arch_cpu_idle_exit(void)
78{ 78{
79 if (test_thread_flag(TIF_MCCK_PENDING)) 79 if (test_cpu_flag(CIF_MCCK_PENDING))
80 s390_handle_mcck(); 80 s390_handle_mcck();
81} 81}
82 82
@@ -123,7 +123,6 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
123 memset(&p->thread.per_user, 0, sizeof(p->thread.per_user)); 123 memset(&p->thread.per_user, 0, sizeof(p->thread.per_user));
124 memset(&p->thread.per_event, 0, sizeof(p->thread.per_event)); 124 memset(&p->thread.per_event, 0, sizeof(p->thread.per_event));
125 clear_tsk_thread_flag(p, TIF_SINGLE_STEP); 125 clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
126 clear_tsk_thread_flag(p, TIF_PER_TRAP);
127 /* Initialize per thread user and system timer values */ 126 /* Initialize per thread user and system timer values */
128 ti = task_thread_info(p); 127 ti = task_thread_info(p);
129 ti->user_timer = 0; 128 ti->user_timer = 0;
@@ -152,6 +151,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
152 } 151 }
153 frame->childregs = *current_pt_regs(); 152 frame->childregs = *current_pt_regs();
154 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ 153 frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */
154 frame->childregs.flags = 0;
155 if (new_stackp) 155 if (new_stackp)
156 frame->childregs.gprs[15] = new_stackp; 156 frame->childregs.gprs[15] = new_stackp;
157 157
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 1c82619eb4f7..2d716734b5b1 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -136,7 +136,7 @@ void ptrace_disable(struct task_struct *task)
136 memset(&task->thread.per_user, 0, sizeof(task->thread.per_user)); 136 memset(&task->thread.per_user, 0, sizeof(task->thread.per_user));
137 memset(&task->thread.per_event, 0, sizeof(task->thread.per_event)); 137 memset(&task->thread.per_event, 0, sizeof(task->thread.per_event));
138 clear_tsk_thread_flag(task, TIF_SINGLE_STEP); 138 clear_tsk_thread_flag(task, TIF_SINGLE_STEP);
139 clear_tsk_thread_flag(task, TIF_PER_TRAP); 139 clear_pt_regs_flag(task_pt_regs(task), PIF_PER_TRAP);
140 task->thread.per_flags = 0; 140 task->thread.per_flags = 0;
141} 141}
142 142
@@ -813,7 +813,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
813 * debugger stored an invalid system call number. Skip 813 * debugger stored an invalid system call number. Skip
814 * the system call and the system call restart handling. 814 * the system call and the system call restart handling.
815 */ 815 */
816 clear_thread_flag(TIF_SYSCALL); 816 clear_pt_regs_flag(regs, PIF_SYSCALL);
817 ret = -1; 817 ret = -1;
818 } 818 }
819 819
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index d8fd508ccd1e..42b49f9e19bf 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -113,7 +113,7 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
113 sizeof(current->thread.fp_regs)); 113 sizeof(current->thread.fp_regs));
114 114
115 restore_fp_regs(current->thread.fp_regs.fprs); 115 restore_fp_regs(current->thread.fp_regs.fprs);
116 clear_thread_flag(TIF_SYSCALL); /* No longer in a system call */ 116 clear_pt_regs_flag(regs, PIF_SYSCALL); /* No longer in a system call */
117 return 0; 117 return 0;
118} 118}
119 119
@@ -356,7 +356,7 @@ void do_signal(struct pt_regs *regs)
356 * call information. 356 * call information.
357 */ 357 */
358 current_thread_info()->system_call = 358 current_thread_info()->system_call =
359 test_thread_flag(TIF_SYSCALL) ? regs->int_code : 0; 359 test_pt_regs_flag(regs, PIF_SYSCALL) ? regs->int_code : 0;
360 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 360 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
361 361
362 if (signr > 0) { 362 if (signr > 0) {
@@ -384,7 +384,7 @@ void do_signal(struct pt_regs *regs)
384 } 384 }
385 } 385 }
386 /* No longer in a system call */ 386 /* No longer in a system call */
387 clear_thread_flag(TIF_SYSCALL); 387 clear_pt_regs_flag(regs, PIF_SYSCALL);
388 388
389 if (is_compat_task()) 389 if (is_compat_task())
390 handle_signal32(signr, &ka, &info, oldset, regs); 390 handle_signal32(signr, &ka, &info, oldset, regs);
@@ -394,7 +394,7 @@ void do_signal(struct pt_regs *regs)
394 } 394 }
395 395
396 /* No handlers present - check for system call restart */ 396 /* No handlers present - check for system call restart */
397 clear_thread_flag(TIF_SYSCALL); 397 clear_pt_regs_flag(regs, PIF_SYSCALL);
398 if (current_thread_info()->system_call) { 398 if (current_thread_info()->system_call) {
399 regs->int_code = current_thread_info()->system_call; 399 regs->int_code = current_thread_info()->system_call;
400 switch (regs->gprs[2]) { 400 switch (regs->gprs[2]) {
@@ -407,9 +407,9 @@ void do_signal(struct pt_regs *regs)
407 case -ERESTARTNOINTR: 407 case -ERESTARTNOINTR:
408 /* Restart system call with magic TIF bit. */ 408 /* Restart system call with magic TIF bit. */
409 regs->gprs[2] = regs->orig_gpr2; 409 regs->gprs[2] = regs->orig_gpr2;
410 set_thread_flag(TIF_SYSCALL); 410 set_pt_regs_flag(regs, PIF_SYSCALL);
411 if (test_thread_flag(TIF_SINGLE_STEP)) 411 if (test_thread_flag(TIF_SINGLE_STEP))
412 set_thread_flag(TIF_PER_TRAP); 412 clear_pt_regs_flag(regs, PIF_PER_TRAP);
413 break; 413 break;
414 } 414 }
415 } 415 }