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