Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * S390 low-level entry points. |
| 4 | * |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 5 | * Copyright IBM Corp. 1999, 2012 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 7 | * Hartmut Penner (hp@de.ibm.com), |
| 8 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 9 | * Heiko Carstens <heiko.carstens@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Heiko Carstens | 2bc89b5 | 2008-02-05 16:50:40 +0100 | [diff] [blame] | 12 | #include <linux/init.h> |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 13 | #include <linux/linkage.h> |
Heiko Carstens | eb608fb | 2012-09-05 13:26:11 +0200 | [diff] [blame] | 14 | #include <asm/processor.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/cache.h> |
Martin Schwidefsky | 3037a52 | 2017-10-12 13:24:48 +0200 | [diff] [blame] | 16 | #include <asm/ctl_reg.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <asm/errno.h> |
| 18 | #include <asm/ptrace.h> |
| 19 | #include <asm/thread_info.h> |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 20 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/unistd.h> |
| 22 | #include <asm/page.h> |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 23 | #include <asm/sigp.h> |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame] | 24 | #include <asm/irq.h> |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 25 | #include <asm/vx-insn.h> |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 26 | #include <asm/setup.h> |
| 27 | #include <asm/nmi.h> |
Al Viro | 711f5df | 2016-01-12 13:30:03 -0500 | [diff] [blame] | 28 | #include <asm/export.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 30 | __PT_R0 = __PT_GPRS |
| 31 | __PT_R1 = __PT_GPRS + 8 |
| 32 | __PT_R2 = __PT_GPRS + 16 |
| 33 | __PT_R3 = __PT_GPRS + 24 |
| 34 | __PT_R4 = __PT_GPRS + 32 |
| 35 | __PT_R5 = __PT_GPRS + 40 |
| 36 | __PT_R6 = __PT_GPRS + 48 |
| 37 | __PT_R7 = __PT_GPRS + 56 |
| 38 | __PT_R8 = __PT_GPRS + 64 |
| 39 | __PT_R9 = __PT_GPRS + 72 |
| 40 | __PT_R10 = __PT_GPRS + 80 |
| 41 | __PT_R11 = __PT_GPRS + 88 |
| 42 | __PT_R12 = __PT_GPRS + 96 |
| 43 | __PT_R13 = __PT_GPRS + 104 |
| 44 | __PT_R14 = __PT_GPRS + 112 |
| 45 | __PT_R15 = __PT_GPRS + 120 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Heiko Carstens | 3a89038 | 2016-11-14 14:39:16 +0100 | [diff] [blame] | 47 | STACK_SHIFT = PAGE_SHIFT + THREAD_SIZE_ORDER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | STACK_SIZE = 1 << STACK_SHIFT |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 49 | STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 51 | _TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
Linus Torvalds | 76f1948 | 2017-05-02 18:24:16 -0700 | [diff] [blame] | 52 | _TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING) |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 53 | _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ |
| 54 | _TIF_SYSCALL_TRACEPOINT) |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 55 | _CIF_WORK = (_CIF_MCCK_PENDING | _CIF_ASCE_PRIMARY | \ |
| 56 | _CIF_ASCE_SECONDARY | _CIF_FPU) |
Martin Schwidefsky | 23fefe1 | 2017-06-07 14:10:24 +0200 | [diff] [blame] | 57 | _PIF_WORK = (_PIF_PER_TRAP | _PIF_SYSCALL_RESTART) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 59 | #define BASED(name) name-cleanup_critical(%r13) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 61 | .macro TRACE_IRQS_ON |
| 62 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 63 | basr %r2,%r0 |
| 64 | brasl %r14,trace_hardirqs_on_caller |
| 65 | #endif |
| 66 | .endm |
| 67 | |
| 68 | .macro TRACE_IRQS_OFF |
| 69 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 70 | basr %r2,%r0 |
| 71 | brasl %r14,trace_hardirqs_off_caller |
| 72 | #endif |
| 73 | .endm |
| 74 | |
| 75 | .macro LOCKDEP_SYS_EXIT |
| 76 | #ifdef CONFIG_LOCKDEP |
| 77 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
| 78 | jz .+10 |
| 79 | brasl %r14,lockdep_sys_exit |
| 80 | #endif |
| 81 | .endm |
| 82 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 83 | .macro CHECK_STACK stacksize,savearea |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 84 | #ifdef CONFIG_CHECK_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 85 | tml %r15,\stacksize - CONFIG_STACK_GUARD |
| 86 | lghi %r14,\savearea |
| 87 | jz stack_overflow |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 88 | #endif |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 89 | .endm |
| 90 | |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 91 | .macro SWITCH_ASYNC savearea,timer |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 92 | tmhh %r8,0x0001 # interrupting from user ? |
| 93 | jnz 1f |
| 94 | lgr %r14,%r9 |
| 95 | slg %r14,BASED(.Lcritical_start) |
| 96 | clg %r14,BASED(.Lcritical_length) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | jhe 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 98 | lghi %r11,\savearea # inside critical section, do cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | brasl %r14,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 100 | tmhh %r8,0x0001 # retest problem state after cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | jnz 1f |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 102 | 0: lg %r14,__LC_ASYNC_STACK # are we already on the async stack? |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | slgr %r14,%r15 |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 104 | srag %r14,%r14,STACK_SHIFT |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 105 | jnz 2f |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 106 | CHECK_STACK 1<<STACK_SHIFT,\savearea |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 107 | aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 108 | j 3f |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 109 | 1: UPDATE_VTIME %r14,%r15,\timer |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 110 | 2: lg %r15,__LC_ASYNC_STACK # load async stack |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 111 | 3: la %r11,STACK_FRAME_OVERHEAD(%r15) |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 112 | .endm |
| 113 | |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 114 | .macro UPDATE_VTIME w1,w2,enter_timer |
| 115 | lg \w1,__LC_EXIT_TIMER |
| 116 | lg \w2,__LC_LAST_UPDATE_TIMER |
| 117 | slg \w1,\enter_timer |
| 118 | slg \w2,__LC_EXIT_TIMER |
| 119 | alg \w1,__LC_USER_TIMER |
| 120 | alg \w2,__LC_SYSTEM_TIMER |
| 121 | stg \w1,__LC_USER_TIMER |
| 122 | stg \w2,__LC_SYSTEM_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 123 | mvc __LC_LAST_UPDATE_TIMER(8),\enter_timer |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 124 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | |
Martin Schwidefsky | 1e54622 | 2010-10-25 16:10:37 +0200 | [diff] [blame] | 126 | .macro REENABLE_IRQS |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 127 | stg %r8,__LC_RETURN_PSW |
| 128 | ni __LC_RETURN_PSW,0xbf |
| 129 | ssm __LC_RETURN_PSW |
Martin Schwidefsky | 1e54622 | 2010-10-25 16:10:37 +0200 | [diff] [blame] | 130 | .endm |
| 131 | |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 132 | .macro STCK savearea |
Heiko Carstens | d652d59 | 2012-05-14 10:35:22 +0200 | [diff] [blame] | 133 | #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 134 | .insn s,0xb27c0000,\savearea # store clock fast |
| 135 | #else |
| 136 | .insn s,0xb2050000,\savearea # store clock |
| 137 | #endif |
| 138 | .endm |
| 139 | |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 140 | /* |
| 141 | * The TSTMSK macro generates a test-under-mask instruction by |
| 142 | * calculating the memory offset for the specified mask value. |
| 143 | * Mask value can be any constant. The macro shifts the mask |
| 144 | * value to calculate the memory offset for the test-under-mask |
| 145 | * instruction. |
| 146 | */ |
| 147 | .macro TSTMSK addr, mask, size=8, bytepos=0 |
| 148 | .if (\bytepos < \size) && (\mask >> 8) |
| 149 | .if (\mask & 0xff) |
| 150 | .error "Mask exceeds byte boundary" |
| 151 | .endif |
| 152 | TSTMSK \addr, "(\mask >> 8)", \size, "(\bytepos + 1)" |
| 153 | .exitm |
| 154 | .endif |
| 155 | .ifeq \mask |
| 156 | .error "Mask must not be zero" |
| 157 | .endif |
| 158 | off = \size - \bytepos - 1 |
| 159 | tm off+\addr, \mask |
| 160 | .endm |
| 161 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 162 | .section .kprobes.text, "ax" |
Heiko Carstens | 46210c4 | 2016-06-30 12:40:25 +0200 | [diff] [blame] | 163 | .Ldummy: |
| 164 | /* |
| 165 | * This nop exists only in order to avoid that __switch_to starts at |
| 166 | * the beginning of the kprobes text section. In that case we would |
| 167 | * have several symbols at the same address. E.g. objdump would take |
| 168 | * an arbitrary symbol name when disassembling this code. |
| 169 | * With the added nop in between the __switch_to symbol is unique |
| 170 | * again. |
| 171 | */ |
| 172 | nop 0 |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | /* |
| 175 | * Scheduler resume function, called by switch_to |
| 176 | * gpr2 = (task_struct *) prev |
| 177 | * gpr3 = (task_struct *) next |
| 178 | * Returns: |
| 179 | * gpr2 = prev |
| 180 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 181 | ENTRY(__switch_to) |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 182 | stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task |
Martin Schwidefsky | 3827ec3 | 2015-07-20 10:01:46 +0200 | [diff] [blame] | 183 | lgr %r1,%r2 |
| 184 | aghi %r1,__TASK_thread # thread_struct of prev task |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 185 | lg %r5,__TASK_stack(%r3) # start of kernel stack of next |
Martin Schwidefsky | 3827ec3 | 2015-07-20 10:01:46 +0200 | [diff] [blame] | 186 | stg %r15,__THREAD_ksp(%r1) # store kernel stack of prev |
| 187 | lgr %r1,%r3 |
| 188 | aghi %r1,__TASK_thread # thread_struct of next task |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 189 | lgr %r15,%r5 |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 190 | aghi %r15,STACK_INIT # end of kernel stack of next |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 191 | stg %r3,__LC_CURRENT # store task struct of next |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 192 | stg %r15,__LC_KERNEL_STACK # store end of kernel stack |
Martin Schwidefsky | 3827ec3 | 2015-07-20 10:01:46 +0200 | [diff] [blame] | 193 | lg %r15,__THREAD_ksp(%r1) # load kernel stack of next |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 194 | mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 195 | lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 196 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_LPP |
| 197 | bzr %r14 |
| 198 | .insn s,0xb2800000,__LC_LPP # set program parameter |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | br %r14 |
| 200 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 201 | .L__critical_start: |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 202 | |
| 203 | #if IS_ENABLED(CONFIG_KVM) |
| 204 | /* |
| 205 | * sie64a calling convention: |
| 206 | * %r2 pointer to sie control block |
| 207 | * %r3 guest register save area |
| 208 | */ |
| 209 | ENTRY(sie64a) |
| 210 | stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers |
| 211 | stg %r2,__SF_EMPTY(%r15) # save control block pointer |
| 212 | stg %r3,__SF_EMPTY+8(%r15) # save guest register save area |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 213 | xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # reason code = 0 |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 214 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU # load guest fp/vx registers ? |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 215 | jno .Lsie_load_guest_gprs |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 216 | brasl %r14,load_fpu_regs # load guest fp/vx regs |
| 217 | .Lsie_load_guest_gprs: |
| 218 | lmg %r0,%r13,0(%r3) # load guest gprs 0-13 |
| 219 | lg %r14,__LC_GMAP # get gmap pointer |
| 220 | ltgr %r14,%r14 |
| 221 | jz .Lsie_gmap |
| 222 | lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce |
| 223 | .Lsie_gmap: |
| 224 | lg %r14,__SF_EMPTY(%r15) # get control block pointer |
| 225 | oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now |
| 226 | tm __SIE_PROG20+3(%r14),3 # last exit... |
| 227 | jnz .Lsie_skip |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 228 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 229 | jo .Lsie_skip # exit if fp/vx regs changed |
QingFeng Hao | c929500 | 2017-06-07 11:30:42 +0200 | [diff] [blame] | 230 | .Lsie_entry: |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 231 | sie 0(%r14) |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 232 | .Lsie_skip: |
| 233 | ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE |
| 234 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 235 | .Lsie_done: |
| 236 | # some program checks are suppressing. C code (e.g. do_protection_exception) |
Christian Borntraeger | c0e7bb3 | 2017-05-15 14:11:03 +0200 | [diff] [blame] | 237 | # will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There |
| 238 | # are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable. |
| 239 | # Other instructions between sie64a and .Lsie_done should not cause program |
| 240 | # interrupts. So lets use 3 nops as a landing pad for all possible rewinds. |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 241 | # See also .Lcleanup_sie |
Christian Borntraeger | c0e7bb3 | 2017-05-15 14:11:03 +0200 | [diff] [blame] | 242 | .Lrewind_pad6: |
| 243 | nopr 7 |
| 244 | .Lrewind_pad4: |
| 245 | nopr 7 |
| 246 | .Lrewind_pad2: |
| 247 | nopr 7 |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 248 | .globl sie_exit |
| 249 | sie_exit: |
| 250 | lg %r14,__SF_EMPTY+8(%r15) # load guest register save area |
| 251 | stmg %r0,%r13,0(%r14) # save guest gprs 0-13 |
| 252 | lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 253 | lg %r2,__SF_EMPTY+16(%r15) # return exit reason code |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 254 | br %r14 |
| 255 | .Lsie_fault: |
| 256 | lghi %r14,-EFAULT |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 257 | stg %r14,__SF_EMPTY+16(%r15) # set exit reason code |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 258 | j sie_exit |
| 259 | |
Christian Borntraeger | c0e7bb3 | 2017-05-15 14:11:03 +0200 | [diff] [blame] | 260 | EX_TABLE(.Lrewind_pad6,.Lsie_fault) |
| 261 | EX_TABLE(.Lrewind_pad4,.Lsie_fault) |
| 262 | EX_TABLE(.Lrewind_pad2,.Lsie_fault) |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 263 | EX_TABLE(sie_exit,.Lsie_fault) |
Al Viro | 711f5df | 2016-01-12 13:30:03 -0500 | [diff] [blame] | 264 | EXPORT_SYMBOL(sie64a) |
| 265 | EXPORT_SYMBOL(sie_exit) |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 266 | #endif |
| 267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | /* |
| 269 | * SVC interrupt handler routine. System calls are synchronous events and |
| 270 | * are executed with interrupts enabled. |
| 271 | */ |
| 272 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 273 | ENTRY(system_call) |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 274 | stpt __LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 275 | .Lsysc_stmg: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 276 | stmg %r8,%r15,__LC_SAVE_AREA_SYNC |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 277 | lg %r12,__LC_CURRENT |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 278 | lghi %r13,__TASK_thread |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 279 | lghi %r14,_PIF_SYSCALL |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 280 | .Lsysc_per: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 281 | lg %r15,__LC_KERNEL_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 282 | la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 283 | .Lsysc_vtime: |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 284 | UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 285 | stmg %r0,%r7,__PT_R0(%r11) |
| 286 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC |
| 287 | mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 288 | mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 289 | stg %r14,__PT_FLAGS(%r11) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 290 | .Lsysc_do_svc: |
Martin Schwidefsky | ef280c8 | 2016-11-08 12:33:38 +0100 | [diff] [blame] | 291 | # load address of system call table |
Martin Schwidefsky | ef280c8 | 2016-11-08 12:33:38 +0100 | [diff] [blame] | 292 | lg %r10,__THREAD_sysc_table(%r13,%r12) |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 293 | llgh %r8,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 294 | slag %r8,%r8,2 # shift and test for svc 0 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 295 | jnz .Lsysc_nr_ok |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | # svc 0: system call number in %r1 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 297 | llgfr %r1,%r1 # clear high word in r1 |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 298 | cghi %r1,NR_syscalls |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 299 | jnl .Lsysc_nr_ok |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 300 | sth %r1,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 301 | slag %r8,%r1,2 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 302 | .Lsysc_nr_ok: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 303 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 304 | stg %r2,__PT_ORIG_GPR2(%r11) |
| 305 | stg %r7,STACK_FRAME_OVERHEAD(%r15) |
| 306 | lgf %r9,0(%r8,%r10) # get system call add. |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 307 | TSTMSK __TI_flags(%r12),_TIF_TRACE |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 308 | jnz .Lsysc_tracesys |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 309 | basr %r14,%r9 # call sys_xxxx |
| 310 | stg %r2,__PT_R2(%r11) # store return value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 312 | .Lsysc_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 313 | LOCKDEP_SYS_EXIT |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 314 | .Lsysc_tif: |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 315 | TSTMSK __PT_FLAGS(%r11),_PIF_WORK |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 316 | jnz .Lsysc_work |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 317 | TSTMSK __TI_flags(%r12),_TIF_WORK |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 318 | jnz .Lsysc_work # check for work |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 319 | TSTMSK __LC_CPU_FLAGS,_CIF_WORK |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 320 | jnz .Lsysc_work |
| 321 | .Lsysc_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 322 | lg %r14,__LC_VDSO_PER_CPU |
| 323 | lmg %r0,%r10,__PT_R0(%r11) |
| 324 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 325 | .Lsysc_exit_timer: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 326 | stpt __LC_EXIT_TIMER |
| 327 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 328 | lmg %r11,%r15,__PT_R11(%r11) |
| 329 | lpswe __LC_RETURN_PSW |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 330 | .Lsysc_done: |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 331 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 333 | # One of the work bits is on. Find out which one. |
| 334 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 335 | .Lsysc_work: |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 336 | TSTMSK __LC_CPU_FLAGS,_CIF_MCCK_PENDING |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 337 | jo .Lsysc_mcck_pending |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 338 | TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 339 | jo .Lsysc_reschedule |
Martin Schwidefsky | 23fefe1 | 2017-06-07 14:10:24 +0200 | [diff] [blame] | 340 | TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART |
| 341 | jo .Lsysc_syscall_restart |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 342 | #ifdef CONFIG_UPROBES |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 343 | TSTMSK __TI_flags(%r12),_TIF_UPROBE |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 344 | jo .Lsysc_uprobe_notify |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 345 | #endif |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 346 | TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE |
| 347 | jo .Lsysc_guarded_storage |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 348 | TSTMSK __PT_FLAGS(%r11),_PIF_PER_TRAP |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 349 | jo .Lsysc_singlestep |
Miroslav Benes | 2f09ca6 | 2017-02-13 19:42:34 -0600 | [diff] [blame] | 350 | #ifdef CONFIG_LIVEPATCH |
| 351 | TSTMSK __TI_flags(%r12),_TIF_PATCH_PENDING |
| 352 | jo .Lsysc_patch_pending # handle live patching just before |
| 353 | # signals and possible syscall restart |
| 354 | #endif |
Martin Schwidefsky | 23fefe1 | 2017-06-07 14:10:24 +0200 | [diff] [blame] | 355 | TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART |
| 356 | jo .Lsysc_syscall_restart |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 357 | TSTMSK __TI_flags(%r12),_TIF_SIGPENDING |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 358 | jo .Lsysc_sigpending |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 359 | TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 360 | jo .Lsysc_notify_resume |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 361 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 362 | jo .Lsysc_vxrs |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 363 | TSTMSK __LC_CPU_FLAGS,(_CIF_ASCE_PRIMARY|_CIF_ASCE_SECONDARY) |
| 364 | jnz .Lsysc_asce |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 365 | j .Lsysc_return # beware of critical section cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
| 367 | # |
| 368 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 369 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 370 | .Lsysc_reschedule: |
| 371 | larl %r14,.Lsysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 372 | jg schedule |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | |
| 374 | # |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 375 | # _CIF_MCCK_PENDING is set, call handler |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 376 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 377 | .Lsysc_mcck_pending: |
| 378 | larl %r14,.Lsysc_return |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 379 | jg s390_handle_mcck # TIF bit will be cleared by handler |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 380 | |
| 381 | # |
Martin Schwidefsky | 0aaba41 | 2017-08-22 12:08:22 +0200 | [diff] [blame^] | 382 | # _CIF_ASCE_PRIMARY and/or _CIF_ASCE_SECONDARY set, load user space asce |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 383 | # |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 384 | .Lsysc_asce: |
Martin Schwidefsky | 0aaba41 | 2017-08-22 12:08:22 +0200 | [diff] [blame^] | 385 | ni __LC_CPU_FLAGS+7,255-_CIF_ASCE_SECONDARY |
| 386 | lctlg %c7,%c7,__LC_VDSO_ASCE # load secondary asce |
| 387 | TSTMSK __LC_CPU_FLAGS,_CIF_ASCE_PRIMARY |
| 388 | jz .Lsysc_return |
| 389 | #ifndef CONFIG_HAVE_MARCH_Z10_FEATURES |
| 390 | tm __LC_STFLE_FAC_LIST+3,0x10 # has MVCOS ? |
| 391 | jnz .Lsysc_set_fs_fixup |
Heiko Carstens | 606aa4a | 2017-02-17 08:12:30 +0100 | [diff] [blame] | 392 | ni __LC_CPU_FLAGS+7,255-_CIF_ASCE_PRIMARY |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 393 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
Martin Schwidefsky | 0aaba41 | 2017-08-22 12:08:22 +0200 | [diff] [blame^] | 394 | j .Lsysc_return |
| 395 | .Lsysc_set_fs_fixup: |
| 396 | #endif |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 397 | larl %r14,.Lsysc_return |
| 398 | jg set_fs_fixup |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 399 | |
| 400 | # |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 401 | # CIF_FPU is set, restore floating-point controls and floating-point registers. |
| 402 | # |
| 403 | .Lsysc_vxrs: |
| 404 | larl %r14,.Lsysc_return |
| 405 | jg load_fpu_regs |
| 406 | |
| 407 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 408 | # _TIF_SIGPENDING is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 410 | .Lsysc_sigpending: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 411 | lgr %r2,%r11 # pass pointer to pt_regs |
| 412 | brasl %r14,do_signal |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 413 | TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 414 | jno .Lsysc_return |
Martin Schwidefsky | 57d7f93 | 2016-03-22 10:54:24 +0100 | [diff] [blame] | 415 | .Lsysc_do_syscall: |
| 416 | lghi %r13,__TASK_thread |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 417 | lmg %r2,%r7,__PT_R2(%r11) # load svc arguments |
Martin Schwidefsky | 57d7f93 | 2016-03-22 10:54:24 +0100 | [diff] [blame] | 418 | lghi %r1,0 # svc 0 returns -ENOSYS |
| 419 | j .Lsysc_do_svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | |
| 421 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 422 | # _TIF_NOTIFY_RESUME is set, call do_notify_resume |
| 423 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 424 | .Lsysc_notify_resume: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 425 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 426 | larl %r14,.Lsysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 427 | jg do_notify_resume |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 428 | |
| 429 | # |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 430 | # _TIF_UPROBE is set, call uprobe_notify_resume |
| 431 | # |
| 432 | #ifdef CONFIG_UPROBES |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 433 | .Lsysc_uprobe_notify: |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 434 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 435 | larl %r14,.Lsysc_return |
Jan Willeke | 2a0a5b2 | 2014-09-22 16:39:06 +0200 | [diff] [blame] | 436 | jg uprobe_notify_resume |
| 437 | #endif |
| 438 | |
| 439 | # |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 440 | # _TIF_GUARDED_STORAGE is set, call guarded_storage_load |
| 441 | # |
| 442 | .Lsysc_guarded_storage: |
| 443 | lgr %r2,%r11 # pass pointer to pt_regs |
| 444 | larl %r14,.Lsysc_return |
| 445 | jg gs_load_bc_cb |
Linus Torvalds | 76f1948 | 2017-05-02 18:24:16 -0700 | [diff] [blame] | 446 | # |
Miroslav Benes | 2f09ca6 | 2017-02-13 19:42:34 -0600 | [diff] [blame] | 447 | # _TIF_PATCH_PENDING is set, call klp_update_patch_state |
| 448 | # |
| 449 | #ifdef CONFIG_LIVEPATCH |
| 450 | .Lsysc_patch_pending: |
| 451 | lg %r2,__LC_CURRENT # pass pointer to task struct |
| 452 | larl %r14,.Lsysc_return |
| 453 | jg klp_update_patch_state |
| 454 | #endif |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 455 | |
| 456 | # |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 457 | # _PIF_PER_TRAP is set, call do_per_trap |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 459 | .Lsysc_singlestep: |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 460 | ni __PT_FLAGS+7(%r11),255-_PIF_PER_TRAP |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 461 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 462 | larl %r14,.Lsysc_return |
Martin Schwidefsky | 5e9a269 | 2011-01-05 12:48:10 +0100 | [diff] [blame] | 463 | jg do_per_trap |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | # |
Martin Schwidefsky | 23fefe1 | 2017-06-07 14:10:24 +0200 | [diff] [blame] | 466 | # _PIF_SYSCALL_RESTART is set, repeat the current system call |
| 467 | # |
| 468 | .Lsysc_syscall_restart: |
| 469 | ni __PT_FLAGS+7(%r11),255-_PIF_SYSCALL_RESTART |
| 470 | lmg %r1,%r7,__PT_R1(%r11) # load svc arguments |
| 471 | lg %r2,__PT_ORIG_GPR2(%r11) |
| 472 | j .Lsysc_do_svc |
| 473 | |
| 474 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 475 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before |
| 476 | # and after the system call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 478 | .Lsysc_tracesys: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 479 | lgr %r2,%r11 # pass pointer to pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | la %r3,0 |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 481 | llgh %r0,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 482 | stg %r0,__PT_R2(%r11) |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 483 | brasl %r14,do_syscall_trace_enter |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | lghi %r0,NR_syscalls |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 485 | clgr %r0,%r2 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 486 | jnh .Lsysc_tracenogo |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 487 | sllg %r8,%r2,2 |
| 488 | lgf %r9,0(%r8,%r10) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 489 | .Lsysc_tracego: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 490 | lmg %r3,%r7,__PT_R3(%r11) |
| 491 | stg %r7,STACK_FRAME_OVERHEAD(%r15) |
| 492 | lg %r2,__PT_ORIG_GPR2(%r11) |
| 493 | basr %r14,%r9 # call sys_xxx |
| 494 | stg %r2,__PT_R2(%r11) # store return value |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 495 | .Lsysc_tracenogo: |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 496 | TSTMSK __TI_flags(%r12),_TIF_TRACE |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 497 | jz .Lsysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 498 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 499 | larl %r14,.Lsysc_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 500 | jg do_syscall_trace_exit |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | |
| 502 | # |
| 503 | # a new process exits the kernel with ret_from_fork |
| 504 | # |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 505 | ENTRY(ret_from_fork) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 506 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 507 | lg %r12,__LC_CURRENT |
Al Viro | 30dcb09 | 2012-10-11 15:30:14 -0400 | [diff] [blame] | 508 | brasl %r14,schedule_tail |
| 509 | TRACE_IRQS_ON |
| 510 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 511 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 512 | jne .Lsysc_tracenogo |
Al Viro | 30dcb09 | 2012-10-11 15:30:14 -0400 | [diff] [blame] | 513 | # it's a kernel thread |
| 514 | lmg %r9,%r10,__PT_R9(%r11) # load gprs |
Al Viro | 37fe5d4 | 2012-09-10 18:03:41 -0400 | [diff] [blame] | 515 | ENTRY(kernel_thread_starter) |
| 516 | la %r2,0(%r10) |
| 517 | basr %r14,%r9 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 518 | j .Lsysc_tracenogo |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | |
| 520 | /* |
| 521 | * Program check handler routine |
| 522 | */ |
| 523 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 524 | ENTRY(pgm_check_handler) |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 525 | stpt __LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 526 | stmg %r8,%r15,__LC_SAVE_AREA_SYNC |
| 527 | lg %r10,__LC_LAST_BREAK |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 528 | lg %r12,__LC_CURRENT |
Martin Schwidefsky | c771320 | 2017-10-05 08:44:26 +0200 | [diff] [blame] | 529 | lghi %r11,0 |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 530 | larl %r13,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 531 | lmg %r8,%r9,__LC_PGM_OLD_PSW |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 532 | tmhh %r8,0x0001 # test problem state bit |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 533 | jnz 2f # -> fault in user space |
| 534 | #if IS_ENABLED(CONFIG_KVM) |
Martin Schwidefsky | 0a5e2ec | 2017-10-05 08:29:47 +0200 | [diff] [blame] | 535 | # cleanup critical section for program checks in sie64a |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 536 | lgr %r14,%r9 |
| 537 | slg %r14,BASED(.Lsie_critical_start) |
| 538 | clg %r14,BASED(.Lsie_critical_length) |
| 539 | jhe 0f |
Martin Schwidefsky | 0a5e2ec | 2017-10-05 08:29:47 +0200 | [diff] [blame] | 540 | lg %r14,__SF_EMPTY(%r15) # get control block pointer |
| 541 | ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE |
| 542 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 543 | larl %r9,sie_exit # skip forward to sie_exit |
Martin Schwidefsky | c771320 | 2017-10-05 08:44:26 +0200 | [diff] [blame] | 544 | lghi %r11,_PIF_GUEST_FAULT |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 545 | #endif |
| 546 | 0: tmhh %r8,0x4000 # PER bit set in old PSW ? |
| 547 | jnz 1f # -> enabled, can't be a double fault |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 548 | tm __LC_PGM_ILC+3,0x80 # check for per exception |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 549 | jnz .Lpgm_svcper # -> single stepped svc |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 550 | 1: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 551 | aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
Martin Schwidefsky | d9fcf2a | 2017-02-28 07:42:01 +0100 | [diff] [blame] | 552 | j 4f |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 553 | 2: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 554 | lg %r15,__LC_KERNEL_STACK |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 555 | lgr %r14,%r12 |
Martin Schwidefsky | 3827ec3 | 2015-07-20 10:01:46 +0200 | [diff] [blame] | 556 | aghi %r14,__TASK_thread # pointer to thread_struct |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 557 | lghi %r13,__LC_PGM_TDB |
| 558 | tm __LC_PGM_ILC+2,0x02 # check for transaction abort |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 559 | jz 3f |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 560 | mvc __THREAD_trap_tdb(256,%r14),0(%r13) |
Martin Schwidefsky | d9fcf2a | 2017-02-28 07:42:01 +0100 | [diff] [blame] | 561 | 3: stg %r10,__THREAD_last_break(%r14) |
Martin Schwidefsky | c771320 | 2017-10-05 08:44:26 +0200 | [diff] [blame] | 562 | 4: lgr %r13,%r11 |
| 563 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 564 | stmg %r0,%r7,__PT_R0(%r11) |
| 565 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC |
| 566 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 567 | mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC |
| 568 | mvc __PT_INT_PARM_LONG(8,%r11),__LC_TRANS_EXC_CODE |
Martin Schwidefsky | c771320 | 2017-10-05 08:44:26 +0200 | [diff] [blame] | 569 | stg %r13,__PT_FLAGS(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 570 | stg %r10,__PT_ARGS(%r11) |
| 571 | tm __LC_PGM_ILC+3,0x80 # check for per exception |
Martin Schwidefsky | d9fcf2a | 2017-02-28 07:42:01 +0100 | [diff] [blame] | 572 | jz 5f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 573 | tmhh %r8,0x0001 # kernel per event ? |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 574 | jz .Lpgm_kprobe |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 575 | oi __PT_FLAGS+7(%r11),_PIF_PER_TRAP |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 576 | mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS |
Jens Freimann | 21ee7ff | 2014-02-26 16:32:46 +0100 | [diff] [blame] | 577 | mvc __THREAD_per_cause(2,%r14),__LC_PER_CODE |
| 578 | mvc __THREAD_per_paid(1,%r14),__LC_PER_ACCESS_ID |
Martin Schwidefsky | d9fcf2a | 2017-02-28 07:42:01 +0100 | [diff] [blame] | 579 | 5: REENABLE_IRQS |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 580 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Heiko Carstens | f5cdac2 | 2010-07-27 19:29:37 +0200 | [diff] [blame] | 581 | larl %r1,pgm_check_table |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 582 | llgh %r10,__PT_INT_CODE+2(%r11) |
| 583 | nill %r10,0x007f |
Heiko Carstens | b01a37a | 2012-10-18 18:10:06 +0200 | [diff] [blame] | 584 | sll %r10,2 |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 585 | je .Lpgm_return |
Heiko Carstens | b01a37a | 2012-10-18 18:10:06 +0200 | [diff] [blame] | 586 | lgf %r1,0(%r10,%r1) # load address of handler routine |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 587 | lgr %r2,%r11 # pass pointer to pt_regs |
Heiko Carstens | f5cdac2 | 2010-07-27 19:29:37 +0200 | [diff] [blame] | 588 | basr %r14,%r1 # branch to interrupt-handler |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 589 | .Lpgm_return: |
| 590 | LOCKDEP_SYS_EXIT |
| 591 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
| 592 | jno .Lsysc_restore |
Martin Schwidefsky | 57d7f93 | 2016-03-22 10:54:24 +0100 | [diff] [blame] | 593 | TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL |
| 594 | jo .Lsysc_do_syscall |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 595 | j .Lsysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | |
| 597 | # |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 598 | # PER event in supervisor state, must be kprobes |
| 599 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 600 | .Lpgm_kprobe: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 601 | REENABLE_IRQS |
| 602 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 603 | lgr %r2,%r11 # pass pointer to pt_regs |
| 604 | brasl %r14,do_per_trap |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 605 | j .Lpgm_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 606 | |
| 607 | # |
| 608 | # single stepped system call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 610 | .Lpgm_svcper: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 611 | mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW |
Martin Schwidefsky | d24b98e | 2017-02-20 09:51:36 +0100 | [diff] [blame] | 612 | lghi %r13,__TASK_thread |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 613 | larl %r14,.Lsysc_per |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 614 | stg %r14,__LC_RETURN_PSW+8 |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 615 | lghi %r14,_PIF_SYSCALL | _PIF_PER_TRAP |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 616 | lpswe __LC_RETURN_PSW # branch to .Lsysc_per and enable irqs |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 617 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | /* |
| 619 | * IO interrupt handler routine |
| 620 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 621 | ENTRY(io_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 622 | STCK __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 623 | stpt __LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 624 | stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 625 | lg %r12,__LC_CURRENT |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 626 | larl %r13,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 627 | lmg %r8,%r9,__LC_IO_OLD_PSW |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 628 | SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 629 | stmg %r0,%r7,__PT_R0(%r11) |
| 630 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC |
| 631 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 632 | mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 633 | xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11) |
Heiko Carstens | db7e007 | 2015-08-15 11:42:21 +0200 | [diff] [blame] | 634 | TSTMSK __LC_CPU_FLAGS,_CIF_IGNORE_IRQ |
| 635 | jo .Lio_restore |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 636 | TRACE_IRQS_OFF |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 637 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 638 | .Lio_loop: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 639 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame] | 640 | lghi %r3,IO_INTERRUPT |
| 641 | tm __PT_INT_CODE+8(%r11),0x80 # adapter interrupt ? |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 642 | jz .Lio_call |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame] | 643 | lghi %r3,THIN_INTERRUPT |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 644 | .Lio_call: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 645 | brasl %r14,do_IRQ |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 646 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_LPAR |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 647 | jz .Lio_return |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 648 | tpi 0 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 649 | jz .Lio_return |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 650 | mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 651 | j .Lio_loop |
| 652 | .Lio_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 653 | LOCKDEP_SYS_EXIT |
| 654 | TRACE_IRQS_ON |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 655 | .Lio_tif: |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 656 | TSTMSK __TI_flags(%r12),_TIF_WORK |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 657 | jnz .Lio_work # there is work to do (signals etc.) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 658 | TSTMSK __LC_CPU_FLAGS,_CIF_WORK |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 659 | jnz .Lio_work |
| 660 | .Lio_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 661 | lg %r14,__LC_VDSO_PER_CPU |
| 662 | lmg %r0,%r10,__PT_R0(%r11) |
| 663 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 664 | .Lio_exit_timer: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 665 | stpt __LC_EXIT_TIMER |
| 666 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 667 | lmg %r11,%r15,__PT_R11(%r11) |
| 668 | lpswe __LC_RETURN_PSW |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 669 | .Lio_done: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 671 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 672 | # There is work todo, find out in which context we have been interrupted: |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 673 | # 1) if we return to user space we can do all _TIF_WORK work |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 674 | # 2) if we return to kernel code and kvm is enabled check if we need to |
| 675 | # modify the psw to leave SIE |
| 676 | # 3) if we return to kernel code and preemptive scheduling is enabled check |
| 677 | # the preemption counter and if it is zero call preempt_schedule_irq |
| 678 | # Before any work can be done, a switch to the kernel stack is required. |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 679 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 680 | .Lio_work: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 681 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 682 | jo .Lio_work_user # yes -> do resched & signal |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 683 | #ifdef CONFIG_PREEMPT |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 684 | # check for preemptive scheduling |
Martin Schwidefsky | c360192 | 2016-10-25 12:21:44 +0200 | [diff] [blame] | 685 | icm %r0,15,__LC_PREEMPT_COUNT |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 686 | jnz .Lio_restore # preemption is disabled |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 687 | TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 688 | jno .Lio_restore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | # switch to kernel stack |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 690 | lg %r1,__PT_R15(%r11) |
| 691 | aghi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
| 692 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 693 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 694 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | lgr %r15,%r1 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 696 | # TRACE_IRQS_ON already done at .Lio_return, call |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 697 | # TRACE_IRQS_OFF to keep things symmetrical |
| 698 | TRACE_IRQS_OFF |
| 699 | brasl %r14,preempt_schedule_irq |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 700 | j .Lio_return |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 701 | #else |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 702 | j .Lio_restore |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 703 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 705 | # |
| 706 | # Need to do work before returning to userspace, switch to kernel stack |
| 707 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 708 | .Lio_work_user: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | lg %r1,__LC_KERNEL_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 710 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 711 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 712 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | lgr %r15,%r1 |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 714 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | # |
| 716 | # One of the work bits is on. Find out which one. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 718 | .Lio_work_tif: |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 719 | TSTMSK __LC_CPU_FLAGS,_CIF_MCCK_PENDING |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 720 | jo .Lio_mcck_pending |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 721 | TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 722 | jo .Lio_reschedule |
Miroslav Benes | 2f09ca6 | 2017-02-13 19:42:34 -0600 | [diff] [blame] | 723 | #ifdef CONFIG_LIVEPATCH |
| 724 | TSTMSK __TI_flags(%r12),_TIF_PATCH_PENDING |
| 725 | jo .Lio_patch_pending |
| 726 | #endif |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 727 | TSTMSK __TI_flags(%r12),_TIF_SIGPENDING |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 728 | jo .Lio_sigpending |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 729 | TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 730 | jo .Lio_notify_resume |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 731 | TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE |
| 732 | jo .Lio_guarded_storage |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 733 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 734 | jo .Lio_vxrs |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 735 | TSTMSK __LC_CPU_FLAGS,(_CIF_ASCE_PRIMARY|_CIF_ASCE_SECONDARY) |
| 736 | jnz .Lio_asce |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 737 | j .Lio_return # beware of critical section cleanup |
Christian Borntraeger | 0eaeafa | 2008-05-07 09:22:53 +0200 | [diff] [blame] | 738 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 739 | # |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 740 | # _CIF_MCCK_PENDING is set, call handler |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 741 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 742 | .Lio_mcck_pending: |
| 743 | # TRACE_IRQS_ON already done at .Lio_return |
Heiko Carstens | b771aea | 2007-07-27 12:29:18 +0200 | [diff] [blame] | 744 | brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 745 | TRACE_IRQS_OFF |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 746 | j .Lio_return |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 747 | |
| 748 | # |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 749 | # _CIF_ASCE_PRIMARY and/or CIF_ASCE_SECONDARY set, load user space asce |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 750 | # |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 751 | .Lio_asce: |
Martin Schwidefsky | 0aaba41 | 2017-08-22 12:08:22 +0200 | [diff] [blame^] | 752 | ni __LC_CPU_FLAGS+7,255-_CIF_ASCE_SECONDARY |
| 753 | lctlg %c7,%c7,__LC_VDSO_ASCE # load secondary asce |
| 754 | TSTMSK __LC_CPU_FLAGS,_CIF_ASCE_PRIMARY |
| 755 | jz .Lio_return |
| 756 | #ifndef CONFIG_HAVE_MARCH_Z10_FEATURES |
| 757 | tm __LC_STFLE_FAC_LIST+3,0x10 # has MVCOS ? |
| 758 | jnz .Lio_set_fs_fixup |
Heiko Carstens | 606aa4a | 2017-02-17 08:12:30 +0100 | [diff] [blame] | 759 | ni __LC_CPU_FLAGS+7,255-_CIF_ASCE_PRIMARY |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 760 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
Martin Schwidefsky | 0aaba41 | 2017-08-22 12:08:22 +0200 | [diff] [blame^] | 761 | j .Lio_return |
| 762 | .Lio_set_fs_fixup: |
| 763 | #endif |
Heiko Carstens | b5a882f | 2017-02-17 08:13:28 +0100 | [diff] [blame] | 764 | larl %r14,.Lio_return |
| 765 | jg set_fs_fixup |
Heiko Carstens | 457f218 | 2014-03-21 10:42:25 +0100 | [diff] [blame] | 766 | |
| 767 | # |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 768 | # CIF_FPU is set, restore floating-point controls and floating-point registers. |
| 769 | # |
| 770 | .Lio_vxrs: |
| 771 | larl %r14,.Lio_return |
| 772 | jg load_fpu_regs |
| 773 | |
| 774 | # |
Martin Schwidefsky | 916cda1 | 2016-01-26 14:10:34 +0100 | [diff] [blame] | 775 | # _TIF_GUARDED_STORAGE is set, call guarded_storage_load |
| 776 | # |
| 777 | .Lio_guarded_storage: |
| 778 | # TRACE_IRQS_ON already done at .Lio_return |
| 779 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
| 780 | lgr %r2,%r11 # pass pointer to pt_regs |
| 781 | brasl %r14,gs_load_bc_cb |
| 782 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
| 783 | TRACE_IRQS_OFF |
| 784 | j .Lio_return |
| 785 | |
| 786 | # |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 788 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 789 | .Lio_reschedule: |
| 790 | # TRACE_IRQS_ON already done at .Lio_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 791 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 792 | brasl %r14,schedule # call scheduler |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 793 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 794 | TRACE_IRQS_OFF |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 795 | j .Lio_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 796 | |
| 797 | # |
Miroslav Benes | 2f09ca6 | 2017-02-13 19:42:34 -0600 | [diff] [blame] | 798 | # _TIF_PATCH_PENDING is set, call klp_update_patch_state |
| 799 | # |
| 800 | #ifdef CONFIG_LIVEPATCH |
| 801 | .Lio_patch_pending: |
| 802 | lg %r2,__LC_CURRENT # pass pointer to task struct |
| 803 | larl %r14,.Lio_return |
| 804 | jg klp_update_patch_state |
| 805 | #endif |
| 806 | |
| 807 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 808 | # _TIF_SIGPENDING or is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 809 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 810 | .Lio_sigpending: |
| 811 | # TRACE_IRQS_ON already done at .Lio_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 812 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
| 813 | lgr %r2,%r11 # pass pointer to pt_regs |
| 814 | brasl %r14,do_signal |
| 815 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 816 | TRACE_IRQS_OFF |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 817 | j .Lio_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 818 | |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 819 | # |
| 820 | # _TIF_NOTIFY_RESUME or is set, call do_notify_resume |
| 821 | # |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 822 | .Lio_notify_resume: |
| 823 | # TRACE_IRQS_ON already done at .Lio_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 824 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
| 825 | lgr %r2,%r11 # pass pointer to pt_regs |
| 826 | brasl %r14,do_notify_resume |
| 827 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 828 | TRACE_IRQS_OFF |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 829 | j .Lio_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 830 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 831 | /* |
| 832 | * External interrupt handler routine |
| 833 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 834 | ENTRY(ext_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 835 | STCK __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 836 | stpt __LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 837 | stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 838 | lg %r12,__LC_CURRENT |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 839 | larl %r13,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 840 | lmg %r8,%r9,__LC_EXT_OLD_PSW |
Martin Schwidefsky | 2acb94f | 2015-06-22 17:28:14 +0200 | [diff] [blame] | 841 | SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 842 | stmg %r0,%r7,__PT_R0(%r11) |
| 843 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC |
| 844 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 845 | lghi %r1,__LC_EXT_PARAMS2 |
| 846 | mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR |
| 847 | mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS |
| 848 | mvc __PT_INT_PARM_LONG(8,%r11),0(%r1) |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 849 | xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11) |
Heiko Carstens | db7e007 | 2015-08-15 11:42:21 +0200 | [diff] [blame] | 850 | TSTMSK __LC_CPU_FLAGS,_CIF_IGNORE_IRQ |
| 851 | jo .Lio_restore |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 852 | TRACE_IRQS_OFF |
Michael Holzheu | 0de9db3 | 2012-05-09 16:27:35 +0200 | [diff] [blame] | 853 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 854 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame] | 855 | lghi %r3,EXT_INTERRUPT |
| 856 | brasl %r14,do_IRQ |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 857 | j .Lio_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 858 | |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 859 | /* |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 860 | * Load idle PSW. The second "half" of this function is in .Lcleanup_idle. |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 861 | */ |
| 862 | ENTRY(psw_idle) |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 863 | stg %r3,__SF_EMPTY(%r15) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 864 | larl %r1,.Lpsw_idle_lpsw+4 |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 865 | stg %r1,__SF_EMPTY+8(%r15) |
Martin Schwidefsky | 72d38b1 | 2015-09-18 16:41:36 +0200 | [diff] [blame] | 866 | #ifdef CONFIG_SMP |
| 867 | larl %r1,smp_cpu_mtid |
| 868 | llgf %r1,0(%r1) |
| 869 | ltgr %r1,%r1 |
| 870 | jz .Lpsw_idle_stcctm |
| 871 | .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+16(%r15) |
| 872 | .Lpsw_idle_stcctm: |
| 873 | #endif |
Martin Schwidefsky | 419123f | 2015-11-19 11:09:45 +0100 | [diff] [blame] | 874 | oi __LC_CPU_FLAGS+7,_CIF_ENABLED_WAIT |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 875 | STCK __CLOCK_IDLE_ENTER(%r2) |
| 876 | stpt __TIMER_IDLE_ENTER(%r2) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 877 | .Lpsw_idle_lpsw: |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 878 | lpswe __SF_EMPTY(%r15) |
| 879 | br %r14 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 880 | .Lpsw_idle_end: |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 881 | |
Hendrik Brueckner | b5510d9 | 2015-09-29 10:04:41 +0200 | [diff] [blame] | 882 | /* |
| 883 | * Store floating-point controls and floating-point or vector register |
| 884 | * depending whether the vector facility is available. A critical section |
| 885 | * cleanup assures that the registers are stored even if interrupted for |
| 886 | * some other work. The CIF_FPU flag is set to trigger a lazy restore |
| 887 | * of the register contents at return from io or a system call. |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 888 | */ |
| 889 | ENTRY(save_fpu_regs) |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 890 | lg %r2,__LC_CURRENT |
| 891 | aghi %r2,__TASK_thread |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 892 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 893 | bor %r14 |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 894 | stfpc __THREAD_FPU_fpc(%r2) |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 895 | lg %r3,__THREAD_FPU_regs(%r2) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 896 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 897 | jz .Lsave_fpu_regs_fp # no -> store FP regs |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 898 | VSTM %v0,%v15,0,%r3 # vstm 0,15,0(3) |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 899 | VSTM %v16,%v31,256,%r3 # vstm 16,31,256(3) |
| 900 | j .Lsave_fpu_regs_done # -> set CIF_FPU flag |
| 901 | .Lsave_fpu_regs_fp: |
| 902 | std 0,0(%r3) |
| 903 | std 1,8(%r3) |
| 904 | std 2,16(%r3) |
| 905 | std 3,24(%r3) |
| 906 | std 4,32(%r3) |
| 907 | std 5,40(%r3) |
| 908 | std 6,48(%r3) |
| 909 | std 7,56(%r3) |
| 910 | std 8,64(%r3) |
| 911 | std 9,72(%r3) |
| 912 | std 10,80(%r3) |
| 913 | std 11,88(%r3) |
| 914 | std 12,96(%r3) |
| 915 | std 13,104(%r3) |
| 916 | std 14,112(%r3) |
| 917 | std 15,120(%r3) |
| 918 | .Lsave_fpu_regs_done: |
| 919 | oi __LC_CPU_FLAGS+7,_CIF_FPU |
| 920 | br %r14 |
| 921 | .Lsave_fpu_regs_end: |
Al Viro | 711f5df | 2016-01-12 13:30:03 -0500 | [diff] [blame] | 922 | EXPORT_SYMBOL(save_fpu_regs) |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 923 | |
Hendrik Brueckner | b5510d9 | 2015-09-29 10:04:41 +0200 | [diff] [blame] | 924 | /* |
| 925 | * Load floating-point controls and floating-point or vector registers. |
| 926 | * A critical section cleanup assures that the register contents are |
| 927 | * loaded even if interrupted for some other work. |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 928 | * |
| 929 | * There are special calling conventions to fit into sysc and io return work: |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 930 | * %r15: <kernel stack> |
| 931 | * The function requires: |
Hendrik Brueckner | b5510d9 | 2015-09-29 10:04:41 +0200 | [diff] [blame] | 932 | * %r4 |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 933 | */ |
| 934 | load_fpu_regs: |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 935 | lg %r4,__LC_CURRENT |
| 936 | aghi %r4,__TASK_thread |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 937 | TSTMSK __LC_CPU_FLAGS,_CIF_FPU |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 938 | bnor %r14 |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 939 | lfpc __THREAD_FPU_fpc(%r4) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 940 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX |
Hendrik Brueckner | d0164ee | 2015-06-29 16:43:06 +0200 | [diff] [blame] | 941 | lg %r4,__THREAD_FPU_regs(%r4) # %r4 <- reg save area |
Hendrik Brueckner | b5510d9 | 2015-09-29 10:04:41 +0200 | [diff] [blame] | 942 | jz .Lload_fpu_regs_fp # -> no VX, load FP regs |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 943 | VLM %v0,%v15,0,%r4 |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 944 | VLM %v16,%v31,256,%r4 |
| 945 | j .Lload_fpu_regs_done |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 946 | .Lload_fpu_regs_fp: |
| 947 | ld 0,0(%r4) |
| 948 | ld 1,8(%r4) |
| 949 | ld 2,16(%r4) |
| 950 | ld 3,24(%r4) |
| 951 | ld 4,32(%r4) |
| 952 | ld 5,40(%r4) |
| 953 | ld 6,48(%r4) |
| 954 | ld 7,56(%r4) |
| 955 | ld 8,64(%r4) |
| 956 | ld 9,72(%r4) |
| 957 | ld 10,80(%r4) |
| 958 | ld 11,88(%r4) |
| 959 | ld 12,96(%r4) |
| 960 | ld 13,104(%r4) |
| 961 | ld 14,112(%r4) |
| 962 | ld 15,120(%r4) |
| 963 | .Lload_fpu_regs_done: |
| 964 | ni __LC_CPU_FLAGS+7,255-_CIF_FPU |
| 965 | br %r14 |
| 966 | .Lload_fpu_regs_end: |
| 967 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 968 | .L__critical_end: |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 969 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 970 | /* |
| 971 | * Machine check handler routines |
| 972 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 973 | ENTRY(mcck_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 974 | STCK __LC_MCCK_CLOCK |
Martin Schwidefsky | 3037a52 | 2017-10-12 13:24:48 +0200 | [diff] [blame] | 975 | la %r1,4095 # validate r1 |
| 976 | spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # validate cpu timer |
| 977 | sckc __LC_CLOCK_COMPARATOR # validate comparator |
| 978 | lam %a0,%a15,__LC_AREGS_SAVE_AREA-4095(%r1) # validate acrs |
| 979 | lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# validate gprs |
Heiko Carstens | d5c352c | 2016-11-08 11:08:26 +0100 | [diff] [blame] | 980 | lg %r12,__LC_CURRENT |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 981 | larl %r13,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 982 | lmg %r8,%r9,__LC_MCK_OLD_PSW |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 983 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_SYSTEM_DAMAGE |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 984 | jo .Lmcck_panic # yes -> rest of mcck code invalid |
Martin Schwidefsky | 3037a52 | 2017-10-12 13:24:48 +0200 | [diff] [blame] | 985 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_CR_VALID |
| 986 | jno .Lmcck_panic # control registers invalid -> panic |
| 987 | la %r14,4095 |
| 988 | lctlg %c0,%c15,__LC_CREGS_SAVE_AREA-4095(%r14) # validate ctl regs |
| 989 | ptlb |
Vasily Gorbik | 2a2d7bef | 2017-10-27 12:44:48 +0200 | [diff] [blame] | 990 | lg %r11,__LC_MCESAD-4095(%r14) # extended machine check save area |
Martin Schwidefsky | 3037a52 | 2017-10-12 13:24:48 +0200 | [diff] [blame] | 991 | nill %r11,0xfc00 # MCESA_ORIGIN_MASK |
| 992 | TSTMSK __LC_CREGS_SAVE_AREA+16-4095(%r14),CR2_GUARDED_STORAGE |
| 993 | jno 0f |
| 994 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_GS_VALID |
| 995 | jno 0f |
| 996 | .insn rxy,0xe3000000004d,0,__MCESA_GS_SAVE_AREA(%r11) # LGSC |
| 997 | 0: l %r14,__LC_FP_CREG_SAVE_AREA-4095(%r14) |
| 998 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_FC_VALID |
| 999 | jo 0f |
| 1000 | sr %r14,%r14 |
| 1001 | 0: sfpc %r14 |
| 1002 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX |
| 1003 | jo 0f |
| 1004 | lghi %r14,__LC_FPREGS_SAVE_AREA |
| 1005 | ld %f0,0(%r14) |
| 1006 | ld %f1,8(%r14) |
| 1007 | ld %f2,16(%r14) |
| 1008 | ld %f3,24(%r14) |
| 1009 | ld %f4,32(%r14) |
| 1010 | ld %f5,40(%r14) |
| 1011 | ld %f6,48(%r14) |
| 1012 | ld %f7,56(%r14) |
| 1013 | ld %f8,64(%r14) |
| 1014 | ld %f9,72(%r14) |
| 1015 | ld %f10,80(%r14) |
| 1016 | ld %f11,88(%r14) |
| 1017 | ld %f12,96(%r14) |
| 1018 | ld %f13,104(%r14) |
| 1019 | ld %f14,112(%r14) |
| 1020 | ld %f15,120(%r14) |
| 1021 | j 1f |
| 1022 | 0: VLM %v0,%v15,0,%r11 |
| 1023 | VLM %v16,%v31,256,%r11 |
| 1024 | 1: lghi %r14,__LC_CPU_TIMER_SAVE_AREA |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1025 | mvc __LC_MCCK_ENTER_TIMER(8),0(%r14) |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 1026 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_CPU_TIMER_VALID |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1027 | jo 3f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 1028 | la %r14,__LC_SYNC_ENTER_TIMER |
| 1029 | clc 0(8,%r14),__LC_ASYNC_ENTER_TIMER |
| 1030 | jl 0f |
| 1031 | la %r14,__LC_ASYNC_ENTER_TIMER |
| 1032 | 0: clc 0(8,%r14),__LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1033 | jl 1f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 1034 | la %r14,__LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1035 | 1: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER |
| 1036 | jl 2f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 1037 | la %r14,__LC_LAST_UPDATE_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1038 | 2: spt 0(%r14) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 1039 | mvc __LC_MCCK_ENTER_TIMER(8),0(%r14) |
Martin Schwidefsky | 3037a52 | 2017-10-12 13:24:48 +0200 | [diff] [blame] | 1040 | 3: TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_MWP_VALID |
| 1041 | jno .Lmcck_panic |
| 1042 | tmhh %r8,0x0001 # interrupting from user ? |
| 1043 | jnz 4f |
| 1044 | TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID |
| 1045 | jno .Lmcck_panic |
| 1046 | 4: SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+64,__LC_MCCK_ENTER_TIMER |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1047 | .Lmcck_skip: |
Martin Schwidefsky | 6551fbd | 2013-02-28 16:28:41 +0100 | [diff] [blame] | 1048 | lghi %r14,__LC_GPREGS_SAVE_AREA+64 |
| 1049 | stmg %r0,%r7,__PT_R0(%r11) |
| 1050 | mvc __PT_R8(64,%r11),0(%r14) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1051 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 1052 | xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1053 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 1054 | lgr %r2,%r11 # pass pointer to pt_regs |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 1055 | brasl %r14,s390_do_machine_check |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1056 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1057 | jno .Lmcck_return |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 1058 | lg %r1,__LC_KERNEL_STACK # switch to kernel stack |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1059 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 1060 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 1061 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 1062 | lgr %r15,%r1 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1063 | ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off |
Hendrik Brueckner | 83abeff | 2015-10-01 17:02:48 +0200 | [diff] [blame] | 1064 | TSTMSK __LC_CPU_FLAGS,_CIF_MCCK_PENDING |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1065 | jno .Lmcck_return |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 1066 | TRACE_IRQS_OFF |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 1067 | brasl %r14,s390_handle_mcck |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 1068 | TRACE_IRQS_ON |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1069 | .Lmcck_return: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1070 | lg %r14,__LC_VDSO_PER_CPU |
| 1071 | lmg %r0,%r10,__PT_R0(%r11) |
| 1072 | mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 1073 | tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? |
| 1074 | jno 0f |
| 1075 | stpt __LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1076 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 1077 | 0: lmg %r11,%r15,__PT_R11(%r11) |
| 1078 | lpswe __LC_RETURN_MCCK_PSW |
| 1079 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1080 | .Lmcck_panic: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1081 | lg %r15,__LC_PANIC_STACK |
Martin Schwidefsky | ce4dda3 | 2016-12-02 13:29:22 +0100 | [diff] [blame] | 1082 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1083 | j .Lmcck_skip |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1084 | |
Michael Holzheu | 7dd6b33 | 2011-08-03 16:44:19 +0200 | [diff] [blame] | 1085 | # |
| 1086 | # PSW restart interrupt handler |
| 1087 | # |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1088 | ENTRY(restart_int_handler) |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 1089 | TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_LPP |
| 1090 | jz 0f |
| 1091 | .insn s,0xb2800000,__LC_LPP |
| 1092 | 0: stg %r15,__LC_SAVE_AREA_RESTART |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1093 | lg %r15,__LC_RESTART_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1094 | aghi %r15,-__PT_SIZE # create pt_regs on stack |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1095 | xc 0(__PT_SIZE,%r15),0(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1096 | stmg %r0,%r14,__PT_R0(%r15) |
| 1097 | mvc __PT_R15(8,%r15),__LC_SAVE_AREA_RESTART |
| 1098 | mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1099 | aghi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack |
| 1100 | xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15) |
Heiko Carstens | fbe7656 | 2012-06-05 09:59:52 +0200 | [diff] [blame] | 1101 | lg %r1,__LC_RESTART_FN # load fn, parm & source cpu |
| 1102 | lg %r2,__LC_RESTART_DATA |
| 1103 | lg %r3,__LC_RESTART_SOURCE |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1104 | ltgr %r3,%r3 # test source cpu address |
| 1105 | jm 1f # negative -> skip source stop |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 1106 | 0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1107 | brc 10,0b # wait for status stored |
| 1108 | 1: basr %r14,%r1 # call function |
| 1109 | stap __SF_EMPTY(%r15) # store cpu address |
| 1110 | llgh %r3,__SF_EMPTY(%r15) |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 1111 | 2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 1112 | brc 2,2b |
| 1113 | 3: j 3b |
Michael Holzheu | 7dd6b33 | 2011-08-03 16:44:19 +0200 | [diff] [blame] | 1114 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 1115 | .section .kprobes.text, "ax" |
| 1116 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1117 | #ifdef CONFIG_CHECK_STACK |
| 1118 | /* |
| 1119 | * The synchronous or the asynchronous stack overflowed. We are dead. |
| 1120 | * No need to properly save the registers, we are going to panic anyway. |
| 1121 | * Setup a pt_regs so that show_trace can provide a good call trace. |
| 1122 | */ |
| 1123 | stack_overflow: |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 1124 | lg %r15,__LC_PANIC_STACK # change to panic stack |
| 1125 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1126 | stmg %r0,%r7,__PT_R0(%r11) |
| 1127 | stmg %r8,%r9,__PT_PSW(%r11) |
| 1128 | mvc __PT_R8(64,%r11),0(%r14) |
| 1129 | stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1130 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 1131 | lgr %r2,%r11 # pass pointer to pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1132 | jg kernel_stack_overflow |
| 1133 | #endif |
| 1134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1135 | cleanup_critical: |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 1136 | #if IS_ENABLED(CONFIG_KVM) |
| 1137 | clg %r9,BASED(.Lcleanup_table_sie) # .Lsie_gmap |
| 1138 | jl 0f |
| 1139 | clg %r9,BASED(.Lcleanup_table_sie+8)# .Lsie_done |
| 1140 | jl .Lcleanup_sie |
| 1141 | #endif |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1142 | clg %r9,BASED(.Lcleanup_table) # system_call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1143 | jl 0f |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1144 | clg %r9,BASED(.Lcleanup_table+8) # .Lsysc_do_svc |
| 1145 | jl .Lcleanup_system_call |
| 1146 | clg %r9,BASED(.Lcleanup_table+16) # .Lsysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | jl 0f |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1148 | clg %r9,BASED(.Lcleanup_table+24) # .Lsysc_restore |
| 1149 | jl .Lcleanup_sysc_tif |
| 1150 | clg %r9,BASED(.Lcleanup_table+32) # .Lsysc_done |
| 1151 | jl .Lcleanup_sysc_restore |
| 1152 | clg %r9,BASED(.Lcleanup_table+40) # .Lio_tif |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 1153 | jl 0f |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1154 | clg %r9,BASED(.Lcleanup_table+48) # .Lio_restore |
| 1155 | jl .Lcleanup_io_tif |
| 1156 | clg %r9,BASED(.Lcleanup_table+56) # .Lio_done |
| 1157 | jl .Lcleanup_io_restore |
| 1158 | clg %r9,BASED(.Lcleanup_table+64) # psw_idle |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1159 | jl 0f |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1160 | clg %r9,BASED(.Lcleanup_table+72) # .Lpsw_idle_end |
| 1161 | jl .Lcleanup_idle |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1162 | clg %r9,BASED(.Lcleanup_table+80) # save_fpu_regs |
| 1163 | jl 0f |
| 1164 | clg %r9,BASED(.Lcleanup_table+88) # .Lsave_fpu_regs_end |
| 1165 | jl .Lcleanup_save_fpu_regs |
| 1166 | clg %r9,BASED(.Lcleanup_table+96) # load_fpu_regs |
| 1167 | jl 0f |
| 1168 | clg %r9,BASED(.Lcleanup_table+104) # .Lload_fpu_regs_end |
| 1169 | jl .Lcleanup_load_fpu_regs |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1170 | 0: br %r14 |
| 1171 | |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 1172 | .align 8 |
| 1173 | .Lcleanup_table: |
| 1174 | .quad system_call |
| 1175 | .quad .Lsysc_do_svc |
| 1176 | .quad .Lsysc_tif |
| 1177 | .quad .Lsysc_restore |
| 1178 | .quad .Lsysc_done |
| 1179 | .quad .Lio_tif |
| 1180 | .quad .Lio_restore |
| 1181 | .quad .Lio_done |
| 1182 | .quad psw_idle |
| 1183 | .quad .Lpsw_idle_end |
| 1184 | .quad save_fpu_regs |
| 1185 | .quad .Lsave_fpu_regs_end |
| 1186 | .quad load_fpu_regs |
| 1187 | .quad .Lload_fpu_regs_end |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 1188 | |
| 1189 | #if IS_ENABLED(CONFIG_KVM) |
| 1190 | .Lcleanup_table_sie: |
| 1191 | .quad .Lsie_gmap |
| 1192 | .quad .Lsie_done |
| 1193 | |
| 1194 | .Lcleanup_sie: |
QingFeng Hao | c929500 | 2017-06-07 11:30:42 +0200 | [diff] [blame] | 1195 | cghi %r11,__LC_SAVE_AREA_ASYNC #Is this in normal interrupt? |
| 1196 | je 1f |
| 1197 | slg %r9,BASED(.Lsie_crit_mcck_start) |
| 1198 | clg %r9,BASED(.Lsie_crit_mcck_length) |
| 1199 | jh 1f |
| 1200 | oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST |
| 1201 | 1: lg %r9,__SF_EMPTY(%r15) # get control block pointer |
Christian Borntraeger | e22cf8c | 2015-10-06 18:06:15 +0200 | [diff] [blame] | 1202 | ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 1203 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 1204 | larl %r9,sie_exit # skip forward to sie_exit |
| 1205 | br %r14 |
| 1206 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1207 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1208 | .Lcleanup_system_call: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1209 | # check if stpt has been executed |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1210 | clg %r9,BASED(.Lcleanup_system_call_insn) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1211 | jh 0f |
| 1212 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1213 | cghi %r11,__LC_SAVE_AREA_ASYNC |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 1214 | je 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1215 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 1216 | 0: # check if stmg has been executed |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1217 | clg %r9,BASED(.Lcleanup_system_call_insn+8) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1218 | jh 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1219 | mvc __LC_SAVE_AREA_SYNC(64),0(%r11) |
| 1220 | 0: # check if base register setup + TIF bit load has been done |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1221 | clg %r9,BASED(.Lcleanup_system_call_insn+16) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1222 | jhe 0f |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 1223 | # set up saved register r12 task struct pointer |
| 1224 | stg %r12,32(%r11) |
| 1225 | # set up saved register r13 __TASK_thread offset |
| 1226 | mvc 40(8,%r11),BASED(.Lcleanup_system_call_const) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1227 | 0: # check if the user time update has been done |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1228 | clg %r9,BASED(.Lcleanup_system_call_insn+24) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1229 | jh 0f |
| 1230 | lg %r15,__LC_EXIT_TIMER |
| 1231 | slg %r15,__LC_SYNC_ENTER_TIMER |
| 1232 | alg %r15,__LC_USER_TIMER |
| 1233 | stg %r15,__LC_USER_TIMER |
| 1234 | 0: # check if the system time update has been done |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1235 | clg %r9,BASED(.Lcleanup_system_call_insn+32) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1236 | jh 0f |
| 1237 | lg %r15,__LC_LAST_UPDATE_TIMER |
| 1238 | slg %r15,__LC_EXIT_TIMER |
| 1239 | alg %r15,__LC_SYSTEM_TIMER |
| 1240 | stg %r15,__LC_SYSTEM_TIMER |
| 1241 | 0: # update accounting time stamp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1242 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 1243 | # set up saved register r11 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1244 | lg %r15,__LC_KERNEL_STACK |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 1245 | la %r9,STACK_FRAME_OVERHEAD(%r15) |
| 1246 | stg %r9,24(%r11) # r11 pt_regs pointer |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1247 | # fill pt_regs |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 1248 | mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC |
| 1249 | stmg %r0,%r7,__PT_R0(%r9) |
| 1250 | mvc __PT_PSW(16,%r9),__LC_SVC_OLD_PSW |
| 1251 | mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC |
Martin Schwidefsky | d3a73ac | 2014-04-15 12:55:07 +0200 | [diff] [blame] | 1252 | xc __PT_FLAGS(8,%r9),__PT_FLAGS(%r9) |
| 1253 | mvi __PT_FLAGS+7(%r9),_PIF_SYSCALL |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1254 | # setup saved register r15 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1255 | stg %r15,56(%r11) # r15 stack pointer |
| 1256 | # set new psw address and exit |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1257 | larl %r9,.Lsysc_do_svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1258 | br %r14 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1259 | .Lcleanup_system_call_insn: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1260 | .quad system_call |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1261 | .quad .Lsysc_stmg |
| 1262 | .quad .Lsysc_per |
Martin Schwidefsky | a359bb1 | 2015-06-22 17:27:48 +0200 | [diff] [blame] | 1263 | .quad .Lsysc_vtime+36 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1264 | .quad .Lsysc_vtime+42 |
Martin Schwidefsky | 34525e1 | 2017-01-25 12:54:17 +0100 | [diff] [blame] | 1265 | .Lcleanup_system_call_const: |
| 1266 | .quad __TASK_thread |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1267 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1268 | .Lcleanup_sysc_tif: |
| 1269 | larl %r9,.Lsysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1270 | br %r14 |
| 1271 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1272 | .Lcleanup_sysc_restore: |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1273 | # check if stpt has been executed |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1274 | clg %r9,BASED(.Lcleanup_sysc_restore_insn) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1275 | jh 0f |
| 1276 | mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER |
| 1277 | cghi %r11,__LC_SAVE_AREA_ASYNC |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 1278 | je 0f |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1279 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 1280 | 0: clg %r9,BASED(.Lcleanup_sysc_restore_insn+8) |
| 1281 | je 1f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1282 | lg %r9,24(%r11) # get saved pointer to pt_regs |
| 1283 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
| 1284 | mvc 0(64,%r11),__PT_R8(%r9) |
| 1285 | lmg %r0,%r7,__PT_R0(%r9) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1286 | 1: lmg %r8,%r9,__LC_RETURN_PSW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1287 | br %r14 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1288 | .Lcleanup_sysc_restore_insn: |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1289 | .quad .Lsysc_exit_timer |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1290 | .quad .Lsysc_done - 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1291 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1292 | .Lcleanup_io_tif: |
| 1293 | larl %r9,.Lio_tif |
Martin Schwidefsky | 176b180 | 2010-04-09 13:43:00 +0200 | [diff] [blame] | 1294 | br %r14 |
| 1295 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1296 | .Lcleanup_io_restore: |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1297 | # check if stpt has been executed |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1298 | clg %r9,BASED(.Lcleanup_io_restore_insn) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1299 | jh 0f |
| 1300 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 1301 | 0: clg %r9,BASED(.Lcleanup_io_restore_insn+8) |
| 1302 | je 1f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1303 | lg %r9,24(%r11) # get saved r11 pointer to pt_regs |
| 1304 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1305 | mvc 0(64,%r11),__PT_R8(%r9) |
| 1306 | lmg %r0,%r7,__PT_R0(%r9) |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1307 | 1: lmg %r8,%r9,__LC_RETURN_PSW |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1308 | br %r14 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1309 | .Lcleanup_io_restore_insn: |
Martin Schwidefsky | 07a63cb | 2017-05-02 13:36:00 +0200 | [diff] [blame] | 1310 | .quad .Lio_exit_timer |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1311 | .quad .Lio_done - 4 |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1312 | |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1313 | .Lcleanup_idle: |
Martin Schwidefsky | 419123f | 2015-11-19 11:09:45 +0100 | [diff] [blame] | 1314 | ni __LC_CPU_FLAGS+7,255-_CIF_ENABLED_WAIT |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1315 | # copy interrupt clock & cpu timer |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1316 | mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_INT_CLOCK |
| 1317 | mvc __TIMER_IDLE_EXIT(8,%r2),__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1318 | cghi %r11,__LC_SAVE_AREA_ASYNC |
| 1319 | je 0f |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1320 | mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK |
| 1321 | mvc __TIMER_IDLE_EXIT(8,%r2),__LC_MCCK_ENTER_TIMER |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1322 | 0: # check if stck & stpt have been executed |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1323 | clg %r9,BASED(.Lcleanup_idle_insn) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1324 | jhe 1f |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1325 | mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2) |
| 1326 | mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2) |
Martin Schwidefsky | 72d38b1 | 2015-09-18 16:41:36 +0200 | [diff] [blame] | 1327 | 1: # calculate idle cycles |
| 1328 | #ifdef CONFIG_SMP |
| 1329 | clg %r9,BASED(.Lcleanup_idle_insn) |
| 1330 | jl 3f |
| 1331 | larl %r1,smp_cpu_mtid |
| 1332 | llgf %r1,0(%r1) |
| 1333 | ltgr %r1,%r1 |
| 1334 | jz 3f |
| 1335 | .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15) |
| 1336 | larl %r3,mt_cycles |
| 1337 | ag %r3,__LC_PERCPU_OFFSET |
| 1338 | la %r4,__SF_EMPTY+16(%r15) |
| 1339 | 2: lg %r0,0(%r3) |
| 1340 | slg %r0,0(%r4) |
| 1341 | alg %r0,64(%r4) |
| 1342 | stg %r0,0(%r3) |
| 1343 | la %r3,8(%r3) |
| 1344 | la %r4,8(%r4) |
| 1345 | brct %r1,2b |
| 1346 | #endif |
| 1347 | 3: # account system time going idle |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1348 | lg %r9,__LC_STEAL_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1349 | alg %r9,__CLOCK_IDLE_ENTER(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1350 | slg %r9,__LC_LAST_UPDATE_CLOCK |
| 1351 | stg %r9,__LC_STEAL_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1352 | mvc __LC_LAST_UPDATE_CLOCK(8),__CLOCK_IDLE_EXIT(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1353 | lg %r9,__LC_SYSTEM_TIMER |
| 1354 | alg %r9,__LC_LAST_UPDATE_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1355 | slg %r9,__TIMER_IDLE_ENTER(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1356 | stg %r9,__LC_SYSTEM_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 1357 | mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1358 | # prepare return psw |
Martin Schwidefsky | 0587d40 | 2013-08-23 14:45:58 +0200 | [diff] [blame] | 1359 | nihh %r8,0xfcfd # clear irq & wait state bits |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1360 | lg %r9,48(%r11) # return from psw_idle |
| 1361 | br %r14 |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1362 | .Lcleanup_idle_insn: |
| 1363 | .quad .Lpsw_idle_lpsw |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 1364 | |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1365 | .Lcleanup_save_fpu_regs: |
Martin Schwidefsky | e370e47 | 2016-03-10 09:52:55 +0100 | [diff] [blame] | 1366 | larl %r9,save_fpu_regs |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1367 | br %r14 |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1368 | |
| 1369 | .Lcleanup_load_fpu_regs: |
Martin Schwidefsky | e370e47 | 2016-03-10 09:52:55 +0100 | [diff] [blame] | 1370 | larl %r9,load_fpu_regs |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1371 | br %r14 |
Hendrik Brueckner | 9977e88 | 2015-06-10 12:53:42 +0200 | [diff] [blame] | 1372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1373 | /* |
| 1374 | * Integer constants |
| 1375 | */ |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1376 | .align 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1377 | .Lcritical_start: |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1378 | .quad .L__critical_start |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 1379 | .Lcritical_length: |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1380 | .quad .L__critical_end - .L__critical_start |
Heiko Carstens | 61aa488 | 2013-11-01 10:08:20 +0100 | [diff] [blame] | 1381 | #if IS_ENABLED(CONFIG_KVM) |
Martin Schwidefsky | d0fc410 | 2015-06-22 17:26:40 +0200 | [diff] [blame] | 1382 | .Lsie_critical_start: |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1383 | .quad .Lsie_gmap |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 1384 | .Lsie_critical_length: |
Martin Schwidefsky | 86ed42f | 2014-12-03 17:00:08 +0100 | [diff] [blame] | 1385 | .quad .Lsie_done - .Lsie_gmap |
QingFeng Hao | c929500 | 2017-06-07 11:30:42 +0200 | [diff] [blame] | 1386 | .Lsie_crit_mcck_start: |
| 1387 | .quad .Lsie_entry |
| 1388 | .Lsie_crit_mcck_length: |
| 1389 | .quad .Lsie_skip - .Lsie_entry |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 1390 | #endif |
| 1391 | |
Heiko Carstens | a876cb3 | 2015-02-13 14:44:29 +0100 | [diff] [blame] | 1392 | .section .rodata, "a" |
| 1393 | #define SYSCALL(esame,emu) .long esame |
Heiko Carstens | 9bf1226 | 2009-06-12 10:26:47 +0200 | [diff] [blame] | 1394 | .globl sys_call_table |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1395 | sys_call_table: |
| 1396 | #include "syscalls.S" |
| 1397 | #undef SYSCALL |
| 1398 | |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 1399 | #ifdef CONFIG_COMPAT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1400 | |
Heiko Carstens | a876cb3 | 2015-02-13 14:44:29 +0100 | [diff] [blame] | 1401 | #define SYSCALL(esame,emu) .long emu |
Martin Schwidefsky | 6164988 | 2013-04-24 12:58:39 +0200 | [diff] [blame] | 1402 | .globl sys_call_table_emu |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1403 | sys_call_table_emu: |
| 1404 | #include "syscalls.S" |
| 1405 | #undef SYSCALL |
| 1406 | #endif |