License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 17:07:57 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* S390 low-level entry points.
|
|
|
|
*
|
2012-07-20 13:15:04 +04:00
|
|
|
* Copyright IBM Corp. 1999, 2012
|
2005-04-17 02:20:36 +04:00
|
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
|
2006-09-28 18:56:37 +04:00
|
|
|
* Hartmut Penner (hp@de.ibm.com),
|
|
|
|
* Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
|
2005-06-26 01:55:30 +04:00
|
|
|
* Heiko Carstens <heiko.carstens@de.ibm.com>
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
|
2008-02-05 18:50:40 +03:00
|
|
|
#include <linux/init.h>
|
2011-07-24 12:48:19 +04:00
|
|
|
#include <linux/linkage.h>
|
2018-03-26 16:27:36 +03:00
|
|
|
#include <asm/alternative-asm.h>
|
2012-09-05 15:26:11 +04:00
|
|
|
#include <asm/processor.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/cache.h>
|
2017-10-12 14:24:48 +03:00
|
|
|
#include <asm/ctl_reg.h>
|
2018-02-19 13:27:09 +03:00
|
|
|
#include <asm/dwarf.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/errno.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/thread_info.h>
|
2005-09-09 22:57:26 +04:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/unistd.h>
|
|
|
|
#include <asm/page.h>
|
2012-06-04 17:05:43 +04:00
|
|
|
#include <asm/sigp.h>
|
2013-06-27 11:01:09 +04:00
|
|
|
#include <asm/irq.h>
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
#include <asm/vx-insn.h>
|
2015-10-01 18:02:48 +03:00
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/nmi.h>
|
2016-01-12 21:30:03 +03:00
|
|
|
#include <asm/export.h>
|
2018-04-20 17:49:46 +03:00
|
|
|
#include <asm/nospec-insn.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2011-12-27 14:27:15 +04:00
|
|
|
__PT_R0 = __PT_GPRS
|
|
|
|
__PT_R1 = __PT_GPRS + 8
|
|
|
|
__PT_R2 = __PT_GPRS + 16
|
|
|
|
__PT_R3 = __PT_GPRS + 24
|
|
|
|
__PT_R4 = __PT_GPRS + 32
|
|
|
|
__PT_R5 = __PT_GPRS + 40
|
|
|
|
__PT_R6 = __PT_GPRS + 48
|
|
|
|
__PT_R7 = __PT_GPRS + 56
|
|
|
|
__PT_R8 = __PT_GPRS + 64
|
|
|
|
__PT_R9 = __PT_GPRS + 72
|
|
|
|
__PT_R10 = __PT_GPRS + 80
|
|
|
|
__PT_R11 = __PT_GPRS + 88
|
|
|
|
__PT_R12 = __PT_GPRS + 96
|
|
|
|
__PT_R13 = __PT_GPRS + 104
|
|
|
|
__PT_R14 = __PT_GPRS + 112
|
|
|
|
__PT_R15 = __PT_GPRS + 120
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2016-11-14 16:39:16 +03:00
|
|
|
STACK_SHIFT = PAGE_SHIFT + THREAD_SIZE_ORDER
|
2005-04-17 02:20:36 +04:00
|
|
|
STACK_SIZE = 1 << STACK_SHIFT
|
2013-04-24 12:20:43 +04:00
|
|
|
STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2014-09-22 18:39:06 +04:00
|
|
|
_TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
|
2020-10-10 00:34:12 +03:00
|
|
|
_TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING | \
|
|
|
|
_TIF_NOTIFY_SIGNAL)
|
2014-04-15 14:55:07 +04:00
|
|
|
_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
|
|
|
|
_TIF_SYSCALL_TRACEPOINT)
|
2020-11-16 10:06:40 +03:00
|
|
|
_CIF_WORK = (_CIF_FPU)
|
2017-06-07 15:10:24 +03:00
|
|
|
_PIF_WORK = (_PIF_PER_TRAP | _PIF_SYSCALL_RESTART)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2018-03-26 16:23:33 +03:00
|
|
|
_LPP_OFFSET = __LC_LPP
|
|
|
|
|
2006-07-03 11:24:46 +04:00
|
|
|
.macro TRACE_IRQS_ON
|
2011-12-27 14:27:15 +04:00
|
|
|
#ifdef CONFIG_TRACE_IRQFLAGS
|
2010-05-17 12:00:02 +04:00
|
|
|
basr %r2,%r0
|
|
|
|
brasl %r14,trace_hardirqs_on_caller
|
2011-12-27 14:27:15 +04:00
|
|
|
#endif
|
2006-07-03 11:24:46 +04:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro TRACE_IRQS_OFF
|
2011-12-27 14:27:15 +04:00
|
|
|
#ifdef CONFIG_TRACE_IRQFLAGS
|
2010-05-17 12:00:02 +04:00
|
|
|
basr %r2,%r0
|
|
|
|
brasl %r14,trace_hardirqs_off_caller
|
2007-11-20 13:13:32 +03:00
|
|
|
#endif
|
2011-12-27 14:27:15 +04:00
|
|
|
.endm
|
2007-11-20 13:13:32 +03:00
|
|
|
|
|
|
|
.macro LOCKDEP_SYS_EXIT
|
2011-12-27 14:27:15 +04:00
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
tm __PT_PSW+1(%r11),0x01 # returning to user ?
|
|
|
|
jz .+10
|
2007-11-20 13:13:32 +03:00
|
|
|
brasl %r14,lockdep_sys_exit
|
2006-07-03 11:24:46 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
.endm
|
|
|
|
|
2017-09-12 17:37:33 +03:00
|
|
|
.macro CHECK_STACK savearea
|
2006-06-29 16:58:05 +04:00
|
|
|
#ifdef CONFIG_CHECK_STACK
|
2017-09-12 17:37:33 +03:00
|
|
|
tml %r15,STACK_SIZE - CONFIG_STACK_GUARD
|
2011-12-27 14:27:15 +04:00
|
|
|
lghi %r14,\savearea
|
|
|
|
jz stack_overflow
|
2006-06-29 16:58:05 +04:00
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2020-11-16 10:06:41 +03:00
|
|
|
.macro DEBUG_USER_ASCE
|
|
|
|
#ifdef CONFIG_DEBUG_USER_ASCE
|
|
|
|
brasl %r14,debug_user_asce
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2017-09-12 17:37:33 +03:00
|
|
|
.macro CHECK_VMAP_STACK savearea,oklabel
|
|
|
|
#ifdef CONFIG_VMAP_STACK
|
|
|
|
lgr %r14,%r15
|
|
|
|
nill %r14,0x10000 - STACK_SIZE
|
|
|
|
oill %r14,STACK_INIT
|
|
|
|
clg %r14,__LC_KERNEL_STACK
|
|
|
|
je \oklabel
|
|
|
|
clg %r14,__LC_ASYNC_STACK
|
|
|
|
je \oklabel
|
|
|
|
clg %r14,__LC_NODAT_STACK
|
|
|
|
je \oklabel
|
|
|
|
clg %r14,__LC_RESTART_STACK
|
|
|
|
je \oklabel
|
|
|
|
lghi %r14,\savearea
|
|
|
|
j stack_overflow
|
|
|
|
#else
|
|
|
|
j \oklabel
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2020-12-06 12:47:47 +03:00
|
|
|
.macro SWITCH_ASYNC savearea,timer,clock
|
2011-12-27 14:27:15 +04:00
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
2020-12-04 00:03:32 +03:00
|
|
|
jnz 4f
|
2020-02-20 14:09:36 +03:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r14,%r9
|
2020-02-20 14:09:36 +03:00
|
|
|
larl %r13,.Lsie_gmap
|
|
|
|
slgr %r14,%r13
|
|
|
|
lghi %r13,.Lsie_done - .Lsie_gmap
|
|
|
|
clgr %r14,%r13
|
|
|
|
jhe 0f
|
2011-12-27 14:27:15 +04:00
|
|
|
lghi %r11,\savearea # inside critical section, do cleanup
|
2020-02-20 14:09:36 +03:00
|
|
|
brasl %r14,.Lcleanup_sie
|
|
|
|
#endif
|
|
|
|
0: larl %r13,.Lpsw_idle_exit
|
|
|
|
cgr %r13,%r9
|
2020-12-04 00:03:32 +03:00
|
|
|
jne 3f
|
2020-02-20 14:09:36 +03:00
|
|
|
|
2020-12-04 00:03:32 +03:00
|
|
|
larl %r1,smp_cpu_mtid
|
|
|
|
llgf %r1,0(%r1)
|
|
|
|
ltgr %r1,%r1
|
|
|
|
jz 2f # no SMT, skip mt_cycles calculation
|
|
|
|
.insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15)
|
|
|
|
larl %r3,mt_cycles
|
|
|
|
ag %r3,__LC_PERCPU_OFFSET
|
|
|
|
la %r4,__SF_EMPTY+16(%r15)
|
|
|
|
1: lg %r0,0(%r3)
|
|
|
|
slg %r0,0(%r4)
|
|
|
|
alg %r0,64(%r4)
|
|
|
|
stg %r0,0(%r3)
|
|
|
|
la %r3,8(%r3)
|
|
|
|
la %r4,8(%r4)
|
|
|
|
brct %r1,1b
|
|
|
|
|
2020-12-06 12:47:47 +03:00
|
|
|
2: mvc __CLOCK_IDLE_EXIT(8,%r2), \clock
|
|
|
|
mvc __TIMER_IDLE_EXIT(8,%r2), \timer
|
2020-02-20 14:09:36 +03:00
|
|
|
# account system time going idle
|
|
|
|
ni __LC_CPU_FLAGS+7,255-_CIF_ENABLED_WAIT
|
|
|
|
|
|
|
|
lg %r13,__LC_STEAL_TIMER
|
|
|
|
alg %r13,__CLOCK_IDLE_ENTER(%r2)
|
|
|
|
slg %r13,__LC_LAST_UPDATE_CLOCK
|
|
|
|
stg %r13,__LC_STEAL_TIMER
|
|
|
|
|
|
|
|
mvc __LC_LAST_UPDATE_CLOCK(8),__CLOCK_IDLE_EXIT(%r2)
|
|
|
|
|
|
|
|
lg %r13,__LC_SYSTEM_TIMER
|
|
|
|
alg %r13,__LC_LAST_UPDATE_TIMER
|
|
|
|
slg %r13,__TIMER_IDLE_ENTER(%r2)
|
|
|
|
stg %r13,__LC_SYSTEM_TIMER
|
|
|
|
mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2)
|
|
|
|
|
|
|
|
nihh %r8,0xfcfd # clear wait state and irq bits
|
2020-12-04 00:03:32 +03:00
|
|
|
3: lg %r14,__LC_ASYNC_STACK # are we already on the target stack?
|
2005-04-17 02:20:36 +04:00
|
|
|
slgr %r14,%r15
|
2015-06-22 18:28:14 +03:00
|
|
|
srag %r14,%r14,STACK_SHIFT
|
2020-12-04 00:03:32 +03:00
|
|
|
jnz 5f
|
2017-09-12 17:37:33 +03:00
|
|
|
CHECK_STACK \savearea
|
2013-04-24 12:20:43 +04:00
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
2020-12-04 00:03:32 +03:00
|
|
|
j 6f
|
|
|
|
4: UPDATE_VTIME %r14,%r15,\timer
|
2018-01-16 09:36:46 +03:00
|
|
|
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2020-12-04 00:03:32 +03:00
|
|
|
5: lg %r15,__LC_ASYNC_STACK # load async stack
|
|
|
|
6: la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2006-09-28 18:56:37 +04:00
|
|
|
.endm
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2015-06-22 18:27:48 +03:00
|
|
|
.macro UPDATE_VTIME w1,w2,enter_timer
|
|
|
|
lg \w1,__LC_EXIT_TIMER
|
|
|
|
lg \w2,__LC_LAST_UPDATE_TIMER
|
|
|
|
slg \w1,\enter_timer
|
|
|
|
slg \w2,__LC_EXIT_TIMER
|
|
|
|
alg \w1,__LC_USER_TIMER
|
|
|
|
alg \w2,__LC_SYSTEM_TIMER
|
|
|
|
stg \w1,__LC_USER_TIMER
|
|
|
|
stg \w2,__LC_SYSTEM_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __LC_LAST_UPDATE_TIMER(8),\enter_timer
|
2005-04-17 02:20:36 +04:00
|
|
|
.endm
|
|
|
|
|
2020-02-20 14:09:36 +03:00
|
|
|
.macro RESTORE_SM_CLEAR_PER
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r8,__LC_RETURN_PSW
|
|
|
|
ni __LC_RETURN_PSW,0xbf
|
|
|
|
ssm __LC_RETURN_PSW
|
2010-10-25 18:10:37 +04:00
|
|
|
.endm
|
|
|
|
|
2020-02-20 14:09:36 +03:00
|
|
|
.macro ENABLE_INTS
|
|
|
|
stosm __SF_EMPTY(%r15),3
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ENABLE_INTS_TRACE
|
|
|
|
TRACE_IRQS_ON
|
|
|
|
ENABLE_INTS
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro DISABLE_INTS
|
|
|
|
stnsm __SF_EMPTY(%r15),0xfc
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro DISABLE_INTS_TRACE
|
|
|
|
DISABLE_INTS
|
|
|
|
TRACE_IRQS_OFF
|
|
|
|
.endm
|
|
|
|
|
2012-05-09 18:27:39 +04:00
|
|
|
.macro STCK savearea
|
2012-05-14 12:35:22 +04:00
|
|
|
#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
|
2012-05-09 18:27:39 +04:00
|
|
|
.insn s,0xb27c0000,\savearea # store clock fast
|
|
|
|
#else
|
|
|
|
.insn s,0xb2050000,\savearea # store clock
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2015-10-01 18:02:48 +03:00
|
|
|
/*
|
|
|
|
* The TSTMSK macro generates a test-under-mask instruction by
|
|
|
|
* calculating the memory offset for the specified mask value.
|
|
|
|
* Mask value can be any constant. The macro shifts the mask
|
|
|
|
* value to calculate the memory offset for the test-under-mask
|
|
|
|
* instruction.
|
|
|
|
*/
|
|
|
|
.macro TSTMSK addr, mask, size=8, bytepos=0
|
|
|
|
.if (\bytepos < \size) && (\mask >> 8)
|
|
|
|
.if (\mask & 0xff)
|
|
|
|
.error "Mask exceeds byte boundary"
|
|
|
|
.endif
|
|
|
|
TSTMSK \addr, "(\mask >> 8)", \size, "(\bytepos + 1)"
|
|
|
|
.exitm
|
|
|
|
.endif
|
|
|
|
.ifeq \mask
|
|
|
|
.error "Mask must not be zero"
|
|
|
|
.endif
|
|
|
|
off = \size - \bytepos - 1
|
|
|
|
tm off+\addr, \mask
|
|
|
|
.endm
|
|
|
|
|
2018-01-16 09:11:45 +03:00
|
|
|
.macro BPOFF
|
2018-03-26 16:27:36 +03:00
|
|
|
ALTERNATIVE "", ".long 0xb2e8c000", 82
|
2018-01-16 09:11:45 +03:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPON
|
2018-03-26 16:27:36 +03:00
|
|
|
ALTERNATIVE "", ".long 0xb2e8d000", 82
|
2018-01-16 09:11:45 +03:00
|
|
|
.endm
|
|
|
|
|
2018-01-16 09:36:46 +03:00
|
|
|
.macro BPENTER tif_ptr,tif_mask
|
2018-03-26 16:27:36 +03:00
|
|
|
ALTERNATIVE "TSTMSK \tif_ptr,\tif_mask; jz .+8; .long 0xb2e8d000", \
|
|
|
|
"", 82
|
2018-01-16 09:36:46 +03:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPEXIT tif_ptr,tif_mask
|
|
|
|
TSTMSK \tif_ptr,\tif_mask
|
2018-03-26 16:27:36 +03:00
|
|
|
ALTERNATIVE "jz .+8; .long 0xb2e8c000", \
|
|
|
|
"jnz .+8; .long 0xb2e8d000", 82
|
2018-01-16 09:36:46 +03:00
|
|
|
.endm
|
|
|
|
|
2018-04-20 17:49:46 +03:00
|
|
|
GEN_BR_THUNK %r9
|
|
|
|
GEN_BR_THUNK %r14
|
|
|
|
GEN_BR_THUNK %r14,%r11
|
2018-01-26 14:46:47 +03:00
|
|
|
|
2011-01-05 14:47:25 +03:00
|
|
|
.section .kprobes.text, "ax"
|
2016-06-30 13:40:25 +03:00
|
|
|
.Ldummy:
|
|
|
|
/*
|
|
|
|
* This nop exists only in order to avoid that __switch_to starts at
|
|
|
|
* the beginning of the kprobes text section. In that case we would
|
|
|
|
* have several symbols at the same address. E.g. objdump would take
|
|
|
|
* an arbitrary symbol name when disassembling this code.
|
|
|
|
* With the added nop in between the __switch_to symbol is unique
|
|
|
|
* again.
|
|
|
|
*/
|
|
|
|
nop 0
|
2011-01-05 14:47:25 +03:00
|
|
|
|
2018-01-16 09:11:45 +03:00
|
|
|
ENTRY(__bpon)
|
|
|
|
.globl __bpon
|
|
|
|
BPON
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(__bpon)
|
2018-01-16 09:11:45 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Scheduler resume function, called by switch_to
|
|
|
|
* gpr2 = (task_struct *) prev
|
|
|
|
* gpr3 = (task_struct *) next
|
|
|
|
* Returns:
|
|
|
|
* gpr2 = prev
|
|
|
|
*/
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(__switch_to)
|
2012-05-15 11:20:06 +04:00
|
|
|
stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
|
2017-11-16 16:54:04 +03:00
|
|
|
lghi %r4,__TASK_stack
|
|
|
|
lghi %r1,__TASK_thread
|
2018-10-26 16:29:59 +03:00
|
|
|
llill %r5,STACK_INIT
|
2017-11-16 16:54:04 +03:00
|
|
|
stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev
|
2018-10-26 16:29:59 +03:00
|
|
|
lg %r15,0(%r4,%r3) # start of kernel stack of next
|
|
|
|
agr %r15,%r5 # end of kernel stack of next
|
2012-05-15 11:20:06 +04:00
|
|
|
stg %r3,__LC_CURRENT # store task struct of next
|
|
|
|
stg %r15,__LC_KERNEL_STACK # store end of kernel stack
|
2017-11-16 16:54:04 +03:00
|
|
|
lg %r15,__THREAD_ksp(%r1,%r3) # load kernel stack of next
|
|
|
|
aghi %r3,__TASK_pid
|
|
|
|
mvc __LC_CURRENT_PID(4,%r0),0(%r3) # store pid of next
|
2014-04-15 14:55:07 +04:00
|
|
|
lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
|
2018-03-26 16:23:33 +03:00
|
|
|
ALTERNATIVE "", ".insn s,0xb2800000,_LPP_OFFSET", 40
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(__switch_to)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2015-06-22 18:26:40 +03:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
/*
|
|
|
|
* sie64a calling convention:
|
|
|
|
* %r2 pointer to sie control block
|
|
|
|
* %r3 guest register save area
|
|
|
|
*/
|
|
|
|
ENTRY(sie64a)
|
|
|
|
stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers
|
2018-01-16 09:36:46 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2018-03-20 15:33:43 +03:00
|
|
|
stg %r2,__SF_SIE_CONTROL(%r15) # save control block pointer
|
|
|
|
stg %r3,__SF_SIE_SAVEAREA(%r15) # save guest register save area
|
|
|
|
xc __SF_SIE_REASON(8,%r15),__SF_SIE_REASON(%r15) # reason code = 0
|
|
|
|
mvc __SF_SIE_FLAGS(8,%r15),__TI_flags(%r12) # copy thread flags
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU # load guest fp/vx registers ?
|
2015-06-22 18:26:40 +03:00
|
|
|
jno .Lsie_load_guest_gprs
|
|
|
|
brasl %r14,load_fpu_regs # load guest fp/vx regs
|
|
|
|
.Lsie_load_guest_gprs:
|
|
|
|
lmg %r0,%r13,0(%r3) # load guest gprs 0-13
|
|
|
|
lg %r14,__LC_GMAP # get gmap pointer
|
|
|
|
ltgr %r14,%r14
|
|
|
|
jz .Lsie_gmap
|
|
|
|
lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
|
|
|
|
.Lsie_gmap:
|
2018-03-20 15:33:43 +03:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-06-22 18:26:40 +03:00
|
|
|
oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
|
|
|
|
tm __SIE_PROG20+3(%r14),3 # last exit...
|
|
|
|
jnz .Lsie_skip
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
|
2015-06-22 18:26:40 +03:00
|
|
|
jo .Lsie_skip # exit if fp/vx regs changed
|
2018-03-20 15:33:43 +03:00
|
|
|
BPEXIT __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2017-06-07 12:30:42 +03:00
|
|
|
.Lsie_entry:
|
2015-06-22 18:26:40 +03:00
|
|
|
sie 0(%r14)
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2018-03-20 15:33:43 +03:00
|
|
|
BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2015-06-22 18:26:40 +03:00
|
|
|
.Lsie_skip:
|
|
|
|
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2015-06-22 18:26:40 +03:00
|
|
|
.Lsie_done:
|
|
|
|
# some program checks are suppressing. C code (e.g. do_protection_exception)
|
2017-05-15 15:11:03 +03:00
|
|
|
# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There
|
|
|
|
# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable.
|
|
|
|
# Other instructions between sie64a and .Lsie_done should not cause program
|
|
|
|
# interrupts. So lets use 3 nops as a landing pad for all possible rewinds.
|
2015-06-22 18:26:40 +03:00
|
|
|
# See also .Lcleanup_sie
|
2017-05-15 15:11:03 +03:00
|
|
|
.Lrewind_pad6:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad4:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad2:
|
|
|
|
nopr 7
|
2015-06-22 18:26:40 +03:00
|
|
|
.globl sie_exit
|
|
|
|
sie_exit:
|
2018-03-20 15:33:43 +03:00
|
|
|
lg %r14,__SF_SIE_SAVEAREA(%r15) # load guest register save area
|
2015-06-22 18:26:40 +03:00
|
|
|
stmg %r0,%r13,0(%r14) # save guest gprs 0-13
|
2018-01-16 15:27:30 +03:00
|
|
|
xgr %r0,%r0 # clear guest registers to
|
|
|
|
xgr %r1,%r1 # prevent speculative use
|
|
|
|
xgr %r2,%r2
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
2015-06-22 18:26:40 +03:00
|
|
|
lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
|
2018-03-20 15:33:43 +03:00
|
|
|
lg %r2,__SF_SIE_REASON(%r15) # return exit reason code
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
2015-06-22 18:26:40 +03:00
|
|
|
.Lsie_fault:
|
|
|
|
lghi %r14,-EFAULT
|
2018-03-20 15:33:43 +03:00
|
|
|
stg %r14,__SF_SIE_REASON(%r15) # set exit reason code
|
2015-06-22 18:26:40 +03:00
|
|
|
j sie_exit
|
|
|
|
|
2017-05-15 15:11:03 +03:00
|
|
|
EX_TABLE(.Lrewind_pad6,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad4,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad2,.Lsie_fault)
|
2015-06-22 18:26:40 +03:00
|
|
|
EX_TABLE(sie_exit,.Lsie_fault)
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(sie64a)
|
2016-01-12 21:30:03 +03:00
|
|
|
EXPORT_SYMBOL(sie64a)
|
|
|
|
EXPORT_SYMBOL(sie_exit)
|
2015-06-22 18:26:40 +03:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* SVC interrupt handler routine. System calls are synchronous events and
|
2020-07-07 15:07:53 +03:00
|
|
|
* are entered with interrupts disabled.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(system_call)
|
2008-12-25 15:39:25 +03:00
|
|
|
stpt __LC_SYNC_ENTER_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2016-11-08 13:08:26 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2014-04-15 14:55:07 +04:00
|
|
|
lghi %r14,_PIF_SYSCALL
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_per:
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2020-06-17 18:30:28 +03:00
|
|
|
lghi %r13,__TASK_thread
|
2011-12-27 14:27:15 +04:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
|
2017-01-25 14:54:17 +03:00
|
|
|
UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER
|
2018-01-16 09:36:46 +03:00
|
|
|
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
|
|
|
|
mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW
|
2011-12-27 14:27:18 +04:00
|
|
|
mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
|
2014-04-15 14:55:07 +04:00
|
|
|
stg %r14,__PT_FLAGS(%r11)
|
2020-12-04 19:56:57 +03:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-02-20 14:09:36 +03:00
|
|
|
ENABLE_INTS
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_do_svc:
|
2018-03-05 22:18:47 +03:00
|
|
|
# clear user controlled register to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
2016-11-08 14:33:38 +03:00
|
|
|
# load address of system call table
|
|
|
|
lg %r10,__THREAD_sysc_table(%r13,%r12)
|
2011-12-27 14:27:18 +04:00
|
|
|
llgh %r8,__PT_INT_CODE+2(%r11)
|
2019-02-03 23:36:13 +03:00
|
|
|
slag %r8,%r8,3 # shift and test for svc 0
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lsysc_nr_ok
|
2005-04-17 02:20:36 +04:00
|
|
|
# svc 0: system call number in %r1
|
2011-12-27 14:27:15 +04:00
|
|
|
llgfr %r1,%r1 # clear high word in r1
|
2020-03-06 15:19:34 +03:00
|
|
|
sth %r1,__PT_INT_CODE+2(%r11)
|
2010-05-17 12:00:05 +04:00
|
|
|
cghi %r1,NR_syscalls
|
2014-12-03 19:00:08 +03:00
|
|
|
jnl .Lsysc_nr_ok
|
2019-02-03 23:36:13 +03:00
|
|
|
slag %r8,%r1,3
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_nr_ok:
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r2,__PT_ORIG_GPR2(%r11)
|
|
|
|
stg %r7,STACK_FRAME_OVERHEAD(%r15)
|
2019-02-03 23:36:13 +03:00
|
|
|
lg %r9,0(%r8,%r10) # get system call add.
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_TRACE
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lsysc_tracesys
|
2018-04-20 17:49:46 +03:00
|
|
|
BASR_EX %r14,%r9 # call sys_xxxx
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r2,__PT_R2(%r11) # store return value
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_return:
|
2018-06-30 11:54:15 +03:00
|
|
|
#ifdef CONFIG_DEBUG_RSEQ
|
|
|
|
lgr %r2,%r11
|
|
|
|
brasl %r14,rseq_syscall
|
|
|
|
#endif
|
2010-05-17 12:00:02 +04:00
|
|
|
LOCKDEP_SYS_EXIT
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_tif:
|
2020-11-03 18:55:43 +03:00
|
|
|
DISABLE_INTS
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_WORK
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lsysc_work
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_WORK
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lsysc_work # check for work
|
2020-11-16 10:06:41 +03:00
|
|
|
DEBUG_USER_ASCE
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2018-01-16 09:36:46 +03:00
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2020-02-20 14:09:36 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS, _CIF_FPU
|
|
|
|
jz .Lsysc_skip_fpu
|
|
|
|
brasl %r14,load_fpu_regs
|
|
|
|
.Lsysc_skip_fpu:
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
|
|
|
|
stpt __LC_EXIT_TIMER
|
2020-02-20 14:09:36 +03:00
|
|
|
lmg %r0,%r15,__PT_R0(%r11)
|
|
|
|
b __LC_RETURN_LPSWE
|
2007-11-20 13:13:32 +03:00
|
|
|
|
2010-05-17 12:00:01 +04:00
|
|
|
#
|
|
|
|
# One of the work bits is on. Find out which one.
|
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_work:
|
2020-11-03 18:55:43 +03:00
|
|
|
ENABLE_INTS
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lsysc_reschedule
|
2017-06-07 15:10:24 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART
|
|
|
|
jo .Lsysc_syscall_restart
|
2014-09-22 18:39:06 +04:00
|
|
|
#ifdef CONFIG_UPROBES
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_UPROBE
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lsysc_uprobe_notify
|
2014-09-22 18:39:06 +04:00
|
|
|
#endif
|
2016-01-26 16:10:34 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE
|
|
|
|
jo .Lsysc_guarded_storage
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_PER_TRAP
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lsysc_singlestep
|
2017-02-14 04:42:34 +03:00
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
|
|
TSTMSK __TI_flags(%r12),_TIF_PATCH_PENDING
|
|
|
|
jo .Lsysc_patch_pending # handle live patching just before
|
|
|
|
# signals and possible syscall restart
|
|
|
|
#endif
|
2017-06-07 15:10:24 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART
|
|
|
|
jo .Lsysc_syscall_restart
|
2020-10-10 00:34:12 +03:00
|
|
|
TSTMSK __TI_flags(%r12),(_TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL)
|
|
|
|
jnz .Lsysc_sigpending
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lsysc_notify_resume
|
2020-02-20 14:09:36 +03:00
|
|
|
j .Lsysc_return
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# _TIF_NEED_RESCHED is set, call schedule
|
2006-09-28 18:56:37 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_reschedule:
|
|
|
|
larl %r14,.Lsysc_return
|
2011-12-27 14:27:15 +04:00
|
|
|
jg schedule
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#
|
2008-04-30 11:53:08 +04:00
|
|
|
# _TIF_SIGPENDING is set, call do_signal
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_sigpending:
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,do_signal
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL
|
2014-12-03 19:00:08 +03:00
|
|
|
jno .Lsysc_return
|
2016-03-22 12:54:24 +03:00
|
|
|
.Lsysc_do_syscall:
|
|
|
|
lghi %r13,__TASK_thread
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r2,%r7,__PT_R2(%r11) # load svc arguments
|
2016-03-22 12:54:24 +03:00
|
|
|
lghi %r1,0 # svc 0 returns -ENOSYS
|
|
|
|
j .Lsysc_do_svc
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-10-10 23:33:20 +04:00
|
|
|
#
|
|
|
|
# _TIF_NOTIFY_RESUME is set, call do_notify_resume
|
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_notify_resume:
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2014-12-03 19:00:08 +03:00
|
|
|
larl %r14,.Lsysc_return
|
2011-12-27 14:27:15 +04:00
|
|
|
jg do_notify_resume
|
2008-10-10 23:33:20 +04:00
|
|
|
|
2014-09-22 18:39:06 +04:00
|
|
|
#
|
|
|
|
# _TIF_UPROBE is set, call uprobe_notify_resume
|
|
|
|
#
|
|
|
|
#ifdef CONFIG_UPROBES
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_uprobe_notify:
|
2014-09-22 18:39:06 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2014-12-03 19:00:08 +03:00
|
|
|
larl %r14,.Lsysc_return
|
2014-09-22 18:39:06 +04:00
|
|
|
jg uprobe_notify_resume
|
|
|
|
#endif
|
|
|
|
|
2016-01-26 16:10:34 +03:00
|
|
|
#
|
|
|
|
# _TIF_GUARDED_STORAGE is set, call guarded_storage_load
|
|
|
|
#
|
|
|
|
.Lsysc_guarded_storage:
|
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
larl %r14,.Lsysc_return
|
|
|
|
jg gs_load_bc_cb
|
2017-02-14 04:42:34 +03:00
|
|
|
#
|
|
|
|
# _TIF_PATCH_PENDING is set, call klp_update_patch_state
|
|
|
|
#
|
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
|
|
.Lsysc_patch_pending:
|
|
|
|
lg %r2,__LC_CURRENT # pass pointer to task struct
|
|
|
|
larl %r14,.Lsysc_return
|
|
|
|
jg klp_update_patch_state
|
|
|
|
#endif
|
2016-01-26 16:10:34 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-04-15 14:55:07 +04:00
|
|
|
# _PIF_PER_TRAP is set, call do_per_trap
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_singlestep:
|
2014-04-15 14:55:07 +04:00
|
|
|
ni __PT_FLAGS+7(%r11),255-_PIF_PER_TRAP
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2014-12-03 19:00:08 +03:00
|
|
|
larl %r14,.Lsysc_return
|
2011-01-05 14:48:10 +03:00
|
|
|
jg do_per_trap
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2017-06-07 15:10:24 +03:00
|
|
|
#
|
|
|
|
# _PIF_SYSCALL_RESTART is set, repeat the current system call
|
|
|
|
#
|
|
|
|
.Lsysc_syscall_restart:
|
|
|
|
ni __PT_FLAGS+7(%r11),255-_PIF_SYSCALL_RESTART
|
|
|
|
lmg %r1,%r7,__PT_R1(%r11) # load svc arguments
|
|
|
|
lg %r2,__PT_ORIG_GPR2(%r11)
|
|
|
|
j .Lsysc_do_svc
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2008-10-10 23:33:20 +04:00
|
|
|
# call tracehook_report_syscall_entry/tracehook_report_syscall_exit before
|
|
|
|
# and after the system call
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_tracesys:
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2005-04-17 02:20:36 +04:00
|
|
|
la %r3,0
|
2011-12-27 14:27:18 +04:00
|
|
|
llgh %r0,__PT_INT_CODE+2(%r11)
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r0,__PT_R2(%r11)
|
2008-10-10 23:33:20 +04:00
|
|
|
brasl %r14,do_syscall_trace_enter
|
2005-04-17 02:20:36 +04:00
|
|
|
lghi %r0,NR_syscalls
|
2008-10-10 23:33:20 +04:00
|
|
|
clgr %r0,%r2
|
2014-12-03 19:00:08 +03:00
|
|
|
jnh .Lsysc_tracenogo
|
2019-02-03 23:36:13 +03:00
|
|
|
sllg %r8,%r2,3
|
|
|
|
lg %r9,0(%r8,%r10)
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r3,%r7,__PT_R3(%r11)
|
|
|
|
stg %r7,STACK_FRAME_OVERHEAD(%r15)
|
|
|
|
lg %r2,__PT_ORIG_GPR2(%r11)
|
2018-04-20 17:49:46 +03:00
|
|
|
BASR_EX %r14,%r9 # call sys_xxx
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r2,__PT_R2(%r11) # store return value
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lsysc_tracenogo:
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_TRACE
|
2014-12-03 19:00:08 +03:00
|
|
|
jz .Lsysc_return
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2014-12-03 19:00:08 +03:00
|
|
|
larl %r14,.Lsysc_return
|
2008-10-10 23:33:20 +04:00
|
|
|
jg do_syscall_trace_exit
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(system_call)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# a new process exits the kernel with ret_from_fork
|
|
|
|
#
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(ret_from_fork)
|
2011-12-27 14:27:15 +04:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2016-11-08 13:08:26 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2012-09-11 02:03:41 +04:00
|
|
|
brasl %r14,schedule_tail
|
2012-10-11 23:30:14 +04:00
|
|
|
tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ?
|
2014-12-03 19:00:08 +03:00
|
|
|
jne .Lsysc_tracenogo
|
2012-10-11 23:30:14 +04:00
|
|
|
# it's a kernel thread
|
|
|
|
lmg %r9,%r10,__PT_R9(%r11) # load gprs
|
2019-01-17 12:02:22 +03:00
|
|
|
la %r2,0(%r10)
|
|
|
|
BASR_EX %r14,%r9
|
|
|
|
j .Lsysc_tracenogo
|
|
|
|
ENDPROC(ret_from_fork)
|
|
|
|
|
2012-09-11 02:03:41 +04:00
|
|
|
ENTRY(kernel_thread_starter)
|
|
|
|
la %r2,0(%r10)
|
2018-04-20 17:49:46 +03:00
|
|
|
BASR_EX %r14,%r9
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lsysc_tracenogo
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(kernel_thread_starter)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Program check handler routine
|
|
|
|
*/
|
|
|
|
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(pgm_check_handler)
|
2008-12-25 15:39:25 +03:00
|
|
|
stpt __LC_SYNC_ENTER_TIMER
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
|
|
|
lg %r10,__LC_LAST_BREAK
|
2020-01-22 15:38:22 +03:00
|
|
|
srag %r11,%r10,12
|
|
|
|
jnz 0f
|
|
|
|
/* if __LC_LAST_BREAK is < 4096, it contains one of
|
|
|
|
* the lpswe addresses in lowcore. Set it to 1 (initial state)
|
|
|
|
* to prevent leaking that address to userspace.
|
|
|
|
*/
|
|
|
|
lghi %r10,1
|
|
|
|
0: lg %r12,__LC_CURRENT
|
2017-10-05 09:44:26 +03:00
|
|
|
lghi %r11,0
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r8,%r9,__LC_PGM_OLD_PSW
|
2020-11-16 10:06:40 +03:00
|
|
|
tmhh %r8,0x0001 # coming from user space?
|
|
|
|
jno .Lpgm_skip_asce
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
j 3f
|
|
|
|
.Lpgm_skip_asce:
|
2015-06-22 18:26:40 +03:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2017-10-05 09:29:47 +03:00
|
|
|
# cleanup critical section for program checks in sie64a
|
2015-06-22 18:26:40 +03:00
|
|
|
lgr %r14,%r9
|
2020-02-20 14:09:36 +03:00
|
|
|
larl %r13,.Lsie_gmap
|
|
|
|
slgr %r14,%r13
|
|
|
|
lghi %r13,.Lsie_done - .Lsie_gmap
|
|
|
|
clgr %r14,%r13
|
2020-01-22 15:38:22 +03:00
|
|
|
jhe 1f
|
2018-03-20 15:33:43 +03:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2017-10-05 09:29:47 +03:00
|
|
|
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2017-10-05 09:29:47 +03:00
|
|
|
larl %r9,sie_exit # skip forward to sie_exit
|
2017-10-05 09:44:26 +03:00
|
|
|
lghi %r11,_PIF_GUEST_FAULT
|
2015-06-22 18:26:40 +03:00
|
|
|
#endif
|
2020-01-22 15:38:22 +03:00
|
|
|
1: tmhh %r8,0x4000 # PER bit set in old PSW ?
|
|
|
|
jnz 2f # -> enabled, can't be a double fault
|
2011-12-27 14:27:15 +04:00
|
|
|
tm __LC_PGM_ILC+3,0x80 # check for per exception
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lpgm_svcper # -> single stepped svc
|
2020-01-22 15:38:22 +03:00
|
|
|
2: CHECK_STACK __LC_SAVE_AREA_SYNC
|
2013-04-24 12:20:43 +04:00
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
2020-01-22 15:38:22 +03:00
|
|
|
# CHECK_VMAP_STACK branches to stack_overflow or 5f
|
|
|
|
CHECK_VMAP_STACK __LC_SAVE_AREA_SYNC,5f
|
|
|
|
3: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER
|
2018-01-16 09:36:46 +03:00
|
|
|
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2011-12-27 14:27:15 +04:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
2016-11-08 13:08:26 +03:00
|
|
|
lgr %r14,%r12
|
2015-07-20 11:01:46 +03:00
|
|
|
aghi %r14,__TASK_thread # pointer to thread_struct
|
2012-07-31 13:03:04 +04:00
|
|
|
lghi %r13,__LC_PGM_TDB
|
|
|
|
tm __LC_PGM_ILC+2,0x02 # check for transaction abort
|
2020-01-22 15:38:22 +03:00
|
|
|
jz 4f
|
2012-07-31 13:03:04 +04:00
|
|
|
mvc __THREAD_trap_tdb(256,%r14),0(%r13)
|
2020-01-22 15:38:22 +03:00
|
|
|
4: stg %r10,__THREAD_last_break(%r14)
|
|
|
|
5: lgr %r13,%r11
|
2017-10-05 09:44:26 +03:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 15:27:30 +03:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r2,%r2
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2011-12-27 14:27:18 +04:00
|
|
|
mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC
|
|
|
|
mvc __PT_INT_PARM_LONG(8,%r11),__LC_TRANS_EXC_CODE
|
2017-10-05 09:44:26 +03:00
|
|
|
stg %r13,__PT_FLAGS(%r11)
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r10,__PT_ARGS(%r11)
|
|
|
|
tm __LC_PGM_ILC+3,0x80 # check for per exception
|
2020-01-22 15:38:22 +03:00
|
|
|
jz 6f
|
2011-12-27 14:27:15 +04:00
|
|
|
tmhh %r8,0x0001 # kernel per event ?
|
2014-12-03 19:00:08 +03:00
|
|
|
jz .Lpgm_kprobe
|
2014-04-15 14:55:07 +04:00
|
|
|
oi __PT_FLAGS+7(%r11),_PIF_PER_TRAP
|
2012-07-31 13:03:04 +04:00
|
|
|
mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS
|
2014-02-26 19:32:46 +04:00
|
|
|
mvc __THREAD_per_cause(2,%r14),__LC_PER_CODE
|
|
|
|
mvc __THREAD_per_paid(1,%r14),__LC_PER_ACCESS_ID
|
2020-12-04 19:56:57 +03:00
|
|
|
6: xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
RESTORE_SM_CLEAR_PER
|
2010-07-27 21:29:37 +04:00
|
|
|
larl %r1,pgm_check_table
|
2011-12-27 14:27:18 +04:00
|
|
|
llgh %r10,__PT_INT_CODE+2(%r11)
|
|
|
|
nill %r10,0x007f
|
2019-02-03 23:36:13 +03:00
|
|
|
sll %r10,3
|
2015-06-22 18:27:48 +03:00
|
|
|
je .Lpgm_return
|
2019-02-03 23:36:13 +03:00
|
|
|
lg %r9,0(%r10,%r1) # load address of handler routine
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2018-04-20 17:49:46 +03:00
|
|
|
BASR_EX %r14,%r9 # branch to interrupt-handler
|
2015-06-22 18:27:48 +03:00
|
|
|
.Lpgm_return:
|
|
|
|
LOCKDEP_SYS_EXIT
|
|
|
|
tm __PT_PSW+1(%r11),0x01 # returning to user ?
|
2020-11-11 20:46:26 +03:00
|
|
|
jno .Lpgm_restore
|
2016-03-22 12:54:24 +03:00
|
|
|
TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL
|
|
|
|
jo .Lsysc_do_syscall
|
2015-06-22 18:27:48 +03:00
|
|
|
j .Lsysc_tif
|
2020-11-11 20:46:26 +03:00
|
|
|
.Lpgm_restore:
|
|
|
|
DISABLE_INTS
|
|
|
|
TSTMSK __LC_CPU_FLAGS, _CIF_FPU
|
|
|
|
jz .Lpgm_skip_fpu
|
|
|
|
brasl %r14,load_fpu_regs
|
|
|
|
.Lpgm_skip_fpu:
|
|
|
|
mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
|
|
|
|
stpt __LC_EXIT_TIMER
|
|
|
|
lmg %r0,%r15,__PT_R0(%r11)
|
|
|
|
b __LC_RETURN_LPSWE
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#
|
2011-12-27 14:27:15 +04:00
|
|
|
# PER event in supervisor state, must be kprobes
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lpgm_kprobe:
|
2011-12-27 14:27:15 +04:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-12-04 19:56:57 +03:00
|
|
|
RESTORE_SM_CLEAR_PER
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,do_per_trap
|
2015-06-22 18:27:48 +03:00
|
|
|
j .Lpgm_return
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-09-20 17:58:39 +04:00
|
|
|
#
|
2011-12-27 14:27:15 +04:00
|
|
|
# single stepped system call
|
2006-09-20 17:58:39 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lpgm_svcper:
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW
|
2014-12-03 19:00:08 +03:00
|
|
|
larl %r14,.Lsysc_per
|
2011-12-27 14:27:15 +04:00
|
|
|
stg %r14,__LC_RETURN_PSW+8
|
2014-04-15 14:55:07 +04:00
|
|
|
lghi %r14,_PIF_SYSCALL | _PIF_PER_TRAP
|
2020-02-20 14:09:36 +03:00
|
|
|
lpswe __LC_RETURN_PSW # branch to .Lsysc_per
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(pgm_check_handler)
|
2006-09-20 17:58:39 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* IO interrupt handler routine
|
|
|
|
*/
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(io_int_handler)
|
2012-05-09 18:27:39 +04:00
|
|
|
STCK __LC_INT_CLOCK
|
2008-12-31 17:11:41 +03:00
|
|
|
stpt __LC_ASYNC_ENTER_TIMER
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
|
2016-11-08 13:08:26 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r8,%r9,__LC_IO_OLD_PSW
|
2020-12-06 12:47:47 +03:00
|
|
|
SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER,__LC_INT_CLOCK
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 15:27:30 +03:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r2,%r2
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r10,%r10
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2020-11-16 10:06:40 +03:00
|
|
|
tm __PT_PSW+1(%r11),0x01 # coming from user space?
|
|
|
|
jno .Lio_skip_asce
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
.Lio_skip_asce:
|
2013-06-17 16:54:02 +04:00
|
|
|
mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
|
2014-04-15 14:55:07 +04:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2011-12-27 14:27:15 +04:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-12-04 20:01:22 +03:00
|
|
|
TRACE_IRQS_OFF
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_loop:
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2013-06-27 11:01:09 +04:00
|
|
|
lghi %r3,IO_INTERRUPT
|
|
|
|
tm __PT_INT_CODE+8(%r11),0x80 # adapter interrupt ?
|
2014-12-03 19:00:08 +03:00
|
|
|
jz .Lio_call
|
2013-06-27 11:01:09 +04:00
|
|
|
lghi %r3,THIN_INTERRUPT
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_call:
|
2011-12-27 14:27:15 +04:00
|
|
|
brasl %r14,do_IRQ
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_LPAR
|
2014-12-03 19:00:08 +03:00
|
|
|
jz .Lio_return
|
2013-06-17 16:54:02 +04:00
|
|
|
tpi 0
|
2014-12-03 19:00:08 +03:00
|
|
|
jz .Lio_return
|
2013-06-17 16:54:02 +04:00
|
|
|
mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_loop
|
|
|
|
.Lio_return:
|
2010-05-17 12:00:02 +04:00
|
|
|
LOCKDEP_SYS_EXIT
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_WORK
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lio_work # there is work to do (signals etc.)
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_WORK
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lio_work
|
|
|
|
.Lio_restore:
|
2020-02-20 14:09:36 +03:00
|
|
|
TRACE_IRQS_ON
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
|
2018-01-16 09:11:45 +03:00
|
|
|
tm __PT_PSW+1(%r11),0x01 # returning to user ?
|
|
|
|
jno .Lio_exit_kernel
|
2020-11-16 10:06:41 +03:00
|
|
|
DEBUG_USER_ASCE
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2018-01-16 09:36:46 +03:00
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2011-12-27 14:27:15 +04:00
|
|
|
stpt __LC_EXIT_TIMER
|
2018-01-16 09:11:45 +03:00
|
|
|
.Lio_exit_kernel:
|
2020-02-20 14:09:36 +03:00
|
|
|
lmg %r0,%r15,__PT_R0(%r11)
|
|
|
|
b __LC_RETURN_LPSWE
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_done:
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-05-07 11:22:52 +04:00
|
|
|
#
|
2010-05-17 12:00:01 +04:00
|
|
|
# There is work todo, find out in which context we have been interrupted:
|
2014-04-15 14:55:07 +04:00
|
|
|
# 1) if we return to user space we can do all _TIF_WORK work
|
2010-05-17 12:00:01 +04:00
|
|
|
# 2) if we return to kernel code and kvm is enabled check if we need to
|
|
|
|
# modify the psw to leave SIE
|
|
|
|
# 3) if we return to kernel code and preemptive scheduling is enabled check
|
|
|
|
# the preemption counter and if it is zero call preempt_schedule_irq
|
|
|
|
# Before any work can be done, a switch to the kernel stack is required.
|
2008-05-07 11:22:52 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_work:
|
2011-12-27 14:27:15 +04:00
|
|
|
tm __PT_PSW+1(%r11),0x01 # returning to user ?
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lio_work_user # yes -> do resched & signal
|
2019-10-15 22:18:04 +03:00
|
|
|
#ifdef CONFIG_PREEMPTION
|
2008-05-07 11:22:52 +04:00
|
|
|
# check for preemptive scheduling
|
2016-10-25 13:21:44 +03:00
|
|
|
icm %r0,15,__LC_PREEMPT_COUNT
|
2014-12-03 19:00:08 +03:00
|
|
|
jnz .Lio_restore # preemption is disabled
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED
|
2014-12-03 19:00:08 +03:00
|
|
|
jno .Lio_restore
|
2005-04-17 02:20:36 +04:00
|
|
|
# switch to kernel stack
|
2011-12-27 14:27:15 +04:00
|
|
|
lg %r1,__PT_R15(%r11)
|
|
|
|
aghi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
|
|
|
mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
|
|
|
|
xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1)
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r1)
|
2005-04-17 02:20:36 +04:00
|
|
|
lgr %r15,%r1
|
2010-05-17 12:00:02 +04:00
|
|
|
brasl %r14,preempt_schedule_irq
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2010-05-17 12:00:02 +04:00
|
|
|
#else
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_restore
|
2010-05-17 12:00:02 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-05-17 12:00:01 +04:00
|
|
|
#
|
|
|
|
# Need to do work before returning to userspace, switch to kernel stack
|
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_work_user:
|
2005-04-17 02:20:36 +04:00
|
|
|
lg %r1,__LC_KERNEL_STACK
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
|
|
|
|
xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1)
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r1)
|
2005-04-17 02:20:36 +04:00
|
|
|
lgr %r15,%r1
|
2010-05-17 12:00:01 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
|
|
|
# One of the work bits is on. Find out which one.
|
|
|
|
#
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_NEED_RESCHED
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lio_reschedule
|
2017-02-14 04:42:34 +03:00
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
|
|
TSTMSK __TI_flags(%r12),_TIF_PATCH_PENDING
|
|
|
|
jo .Lio_patch_pending
|
|
|
|
#endif
|
2020-10-10 00:34:12 +03:00
|
|
|
TSTMSK __TI_flags(%r12),(_TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL)
|
|
|
|
jnz .Lio_sigpending
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lio_notify_resume
|
2016-01-26 16:10:34 +03:00
|
|
|
TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE
|
|
|
|
jo .Lio_guarded_storage
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
jo .Lio_vxrs
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2005-06-26 01:55:30 +04:00
|
|
|
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
#
|
|
|
|
# CIF_FPU is set, restore floating-point controls and floating-point registers.
|
|
|
|
#
|
|
|
|
.Lio_vxrs:
|
|
|
|
larl %r14,.Lio_return
|
|
|
|
jg load_fpu_regs
|
|
|
|
|
2016-01-26 16:10:34 +03:00
|
|
|
#
|
|
|
|
# _TIF_GUARDED_STORAGE is set, call guarded_storage_load
|
|
|
|
#
|
|
|
|
.Lio_guarded_storage:
|
2020-02-20 14:09:36 +03:00
|
|
|
ENABLE_INTS_TRACE
|
2016-01-26 16:10:34 +03:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,gs_load_bc_cb
|
2020-02-20 14:09:36 +03:00
|
|
|
DISABLE_INTS_TRACE
|
2016-01-26 16:10:34 +03:00
|
|
|
j .Lio_return
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
|
|
|
# _TIF_NEED_RESCHED is set, call schedule
|
2006-09-28 18:56:37 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_reschedule:
|
2020-02-20 14:09:36 +03:00
|
|
|
ENABLE_INTS_TRACE
|
2006-09-28 18:56:37 +04:00
|
|
|
brasl %r14,schedule # call scheduler
|
2020-02-20 14:09:36 +03:00
|
|
|
DISABLE_INTS_TRACE
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2017-02-14 04:42:34 +03:00
|
|
|
#
|
|
|
|
# _TIF_PATCH_PENDING is set, call klp_update_patch_state
|
|
|
|
#
|
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
|
|
.Lio_patch_pending:
|
|
|
|
lg %r2,__LC_CURRENT # pass pointer to task struct
|
|
|
|
larl %r14,.Lio_return
|
|
|
|
jg klp_update_patch_state
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2008-04-30 11:53:08 +04:00
|
|
|
# _TIF_SIGPENDING or is set, call do_signal
|
2005-04-17 02:20:36 +04:00
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_sigpending:
|
2020-02-20 14:09:36 +03:00
|
|
|
ENABLE_INTS_TRACE
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,do_signal
|
2020-02-20 14:09:36 +03:00
|
|
|
DISABLE_INTS_TRACE
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-10-10 23:33:20 +04:00
|
|
|
#
|
|
|
|
# _TIF_NOTIFY_RESUME or is set, call do_notify_resume
|
|
|
|
#
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lio_notify_resume:
|
2020-02-20 14:09:36 +03:00
|
|
|
ENABLE_INTS_TRACE
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,do_notify_resume
|
2020-02-20 14:09:36 +03:00
|
|
|
DISABLE_INTS_TRACE
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(io_int_handler)
|
2008-10-10 23:33:20 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* External interrupt handler routine
|
|
|
|
*/
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(ext_int_handler)
|
2012-05-09 18:27:39 +04:00
|
|
|
STCK __LC_INT_CLOCK
|
2008-12-31 17:11:41 +03:00
|
|
|
stpt __LC_ASYNC_ENTER_TIMER
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
|
2016-11-08 13:08:26 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r8,%r9,__LC_EXT_OLD_PSW
|
2020-12-06 12:47:47 +03:00
|
|
|
SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_ENTER_TIMER,__LC_INT_CLOCK
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 15:27:30 +03:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r2,%r2
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r10,%r10
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2020-11-16 10:06:40 +03:00
|
|
|
tm __PT_PSW+1(%r11),0x01 # coming from user space?
|
|
|
|
jno .Lext_skip_asce
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
.Lext_skip_asce:
|
2013-06-17 16:54:02 +04:00
|
|
|
lghi %r1,__LC_EXT_PARAMS2
|
|
|
|
mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR
|
|
|
|
mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS
|
|
|
|
mvc __PT_INT_PARM_LONG(8,%r11),0(%r1)
|
2014-04-15 14:55:07 +04:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2012-05-09 18:27:35 +04:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-12-04 20:01:22 +03:00
|
|
|
TRACE_IRQS_OFF
|
2011-12-27 14:27:15 +04:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2013-06-27 11:01:09 +04:00
|
|
|
lghi %r3,EXT_INTERRUPT
|
|
|
|
brasl %r14,do_IRQ
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lio_return
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(ext_int_handler)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2012-03-11 19:59:27 +04:00
|
|
|
/*
|
2020-02-20 14:09:36 +03:00
|
|
|
* Load idle PSW.
|
2012-03-11 19:59:27 +04:00
|
|
|
*/
|
|
|
|
ENTRY(psw_idle)
|
2012-07-20 13:15:08 +04:00
|
|
|
stg %r3,__SF_EMPTY(%r15)
|
2020-02-20 14:09:36 +03:00
|
|
|
larl %r1,.Lpsw_idle_exit
|
2012-03-11 19:59:27 +04:00
|
|
|
stg %r1,__SF_EMPTY+8(%r15)
|
2015-09-18 17:41:36 +03:00
|
|
|
larl %r1,smp_cpu_mtid
|
|
|
|
llgf %r1,0(%r1)
|
|
|
|
ltgr %r1,%r1
|
|
|
|
jz .Lpsw_idle_stcctm
|
|
|
|
.insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+16(%r15)
|
|
|
|
.Lpsw_idle_stcctm:
|
2015-11-19 13:09:45 +03:00
|
|
|
oi __LC_CPU_FLAGS+7,_CIF_ENABLED_WAIT
|
2018-01-16 09:11:45 +03:00
|
|
|
BPON
|
2012-07-20 13:15:08 +04:00
|
|
|
STCK __CLOCK_IDLE_ENTER(%r2)
|
|
|
|
stpt __TIMER_IDLE_ENTER(%r2)
|
2012-03-11 19:59:27 +04:00
|
|
|
lpswe __SF_EMPTY(%r15)
|
2020-02-20 14:09:36 +03:00
|
|
|
.Lpsw_idle_exit:
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(psw_idle)
|
2012-03-11 19:59:27 +04:00
|
|
|
|
2015-09-29 11:04:41 +03:00
|
|
|
/*
|
|
|
|
* Store floating-point controls and floating-point or vector register
|
|
|
|
* depending whether the vector facility is available. A critical section
|
|
|
|
* cleanup assures that the registers are stored even if interrupted for
|
|
|
|
* some other work. The CIF_FPU flag is set to trigger a lazy restore
|
|
|
|
* of the register contents at return from io or a system call.
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
*/
|
|
|
|
ENTRY(save_fpu_regs)
|
2020-02-20 14:09:36 +03:00
|
|
|
stnsm __SF_EMPTY(%r15),0xfc
|
2015-06-29 17:43:06 +03:00
|
|
|
lg %r2,__LC_CURRENT
|
|
|
|
aghi %r2,__TASK_thread
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
|
2018-01-26 14:46:47 +03:00
|
|
|
jo .Lsave_fpu_regs_exit
|
2015-06-29 17:43:06 +03:00
|
|
|
stfpc __THREAD_FPU_fpc(%r2)
|
|
|
|
lg %r3,__THREAD_FPU_regs(%r2)
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
jz .Lsave_fpu_regs_fp # no -> store FP regs
|
|
|
|
VSTM %v0,%v15,0,%r3 # vstm 0,15,0(3)
|
|
|
|
VSTM %v16,%v31,256,%r3 # vstm 16,31,256(3)
|
|
|
|
j .Lsave_fpu_regs_done # -> set CIF_FPU flag
|
|
|
|
.Lsave_fpu_regs_fp:
|
|
|
|
std 0,0(%r3)
|
|
|
|
std 1,8(%r3)
|
|
|
|
std 2,16(%r3)
|
|
|
|
std 3,24(%r3)
|
|
|
|
std 4,32(%r3)
|
|
|
|
std 5,40(%r3)
|
|
|
|
std 6,48(%r3)
|
|
|
|
std 7,56(%r3)
|
|
|
|
std 8,64(%r3)
|
|
|
|
std 9,72(%r3)
|
|
|
|
std 10,80(%r3)
|
|
|
|
std 11,88(%r3)
|
|
|
|
std 12,96(%r3)
|
|
|
|
std 13,104(%r3)
|
|
|
|
std 14,112(%r3)
|
|
|
|
std 15,120(%r3)
|
|
|
|
.Lsave_fpu_regs_done:
|
|
|
|
oi __LC_CPU_FLAGS+7,_CIF_FPU
|
2018-01-26 14:46:47 +03:00
|
|
|
.Lsave_fpu_regs_exit:
|
2020-02-20 14:09:36 +03:00
|
|
|
ssm __SF_EMPTY(%r15)
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
.Lsave_fpu_regs_end:
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(save_fpu_regs)
|
2016-01-12 21:30:03 +03:00
|
|
|
EXPORT_SYMBOL(save_fpu_regs)
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
|
2015-09-29 11:04:41 +03:00
|
|
|
/*
|
|
|
|
* Load floating-point controls and floating-point or vector registers.
|
|
|
|
* A critical section cleanup assures that the register contents are
|
|
|
|
* loaded even if interrupted for some other work.
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
*
|
|
|
|
* There are special calling conventions to fit into sysc and io return work:
|
|
|
|
* %r15: <kernel stack>
|
|
|
|
* The function requires:
|
2015-09-29 11:04:41 +03:00
|
|
|
* %r4
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
*/
|
|
|
|
load_fpu_regs:
|
2020-11-20 16:17:52 +03:00
|
|
|
stnsm __SF_EMPTY(%r15),0xfc
|
2015-06-29 17:43:06 +03:00
|
|
|
lg %r4,__LC_CURRENT
|
|
|
|
aghi %r4,__TASK_thread
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
|
2018-01-26 14:46:47 +03:00
|
|
|
jno .Lload_fpu_regs_exit
|
2015-06-29 17:43:06 +03:00
|
|
|
lfpc __THREAD_FPU_fpc(%r4)
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX
|
2015-06-29 17:43:06 +03:00
|
|
|
lg %r4,__THREAD_FPU_regs(%r4) # %r4 <- reg save area
|
2015-09-29 11:04:41 +03:00
|
|
|
jz .Lload_fpu_regs_fp # -> no VX, load FP regs
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
VLM %v0,%v15,0,%r4
|
|
|
|
VLM %v16,%v31,256,%r4
|
|
|
|
j .Lload_fpu_regs_done
|
|
|
|
.Lload_fpu_regs_fp:
|
|
|
|
ld 0,0(%r4)
|
|
|
|
ld 1,8(%r4)
|
|
|
|
ld 2,16(%r4)
|
|
|
|
ld 3,24(%r4)
|
|
|
|
ld 4,32(%r4)
|
|
|
|
ld 5,40(%r4)
|
|
|
|
ld 6,48(%r4)
|
|
|
|
ld 7,56(%r4)
|
|
|
|
ld 8,64(%r4)
|
|
|
|
ld 9,72(%r4)
|
|
|
|
ld 10,80(%r4)
|
|
|
|
ld 11,88(%r4)
|
|
|
|
ld 12,96(%r4)
|
|
|
|
ld 13,104(%r4)
|
|
|
|
ld 14,112(%r4)
|
|
|
|
ld 15,120(%r4)
|
|
|
|
.Lload_fpu_regs_done:
|
|
|
|
ni __LC_CPU_FLAGS+7,255-_CIF_FPU
|
2018-01-26 14:46:47 +03:00
|
|
|
.Lload_fpu_regs_exit:
|
2020-11-20 16:17:52 +03:00
|
|
|
ssm __SF_EMPTY(%r15)
|
2018-04-20 17:49:46 +03:00
|
|
|
BR_EX %r14
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
.Lload_fpu_regs_end:
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(load_fpu_regs)
|
s390/kernel: lazy restore fpu registers
Improve the save and restore behavior of FPU register contents to use the
vector extension within the kernel.
The kernel does not use floating-point or vector registers and, therefore,
saving and restoring the FPU register contents are performed for handling
signals or switching processes only. To prepare for using vector
instructions and vector registers within the kernel, enhance the save
behavior and implement a lazy restore at return to user space from a
system call or interrupt.
To implement the lazy restore, the save_fpu_regs() sets a CPU information
flag, CIF_FPU, to indicate that the FPU registers must be restored.
Saving and setting CIF_FPU is performed in an atomic fashion to be
interrupt-safe. When the kernel wants to use the vector extension or
wants to change the FPU register state for a task during signal handling,
the save_fpu_regs() must be called first. The CIF_FPU flag is also set at
process switch. At return to user space, the FPU state is restored. In
particular, the FPU state includes the floating-point or vector register
contents, as well as, vector-enablement and floating-point control. The
FPU state restore and clearing CIF_FPU is also performed in an atomic
fashion.
For KVM, the restore of the FPU register state is performed when restoring
the general-purpose guest registers before the SIE instructions is started.
Because the path towards the SIE instruction is interruptible, the CIF_FPU
flag must be checked again right before going into SIE. If set, the guest
registers must be reloaded again by re-entering the outer SIE loop. This
is the same behavior as if the SIE critical section is interrupted.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-06-10 13:53:42 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Machine check handler routines
|
|
|
|
*/
|
2011-07-24 12:48:19 +04:00
|
|
|
ENTRY(mcck_int_handler)
|
2012-05-09 18:27:39 +04:00
|
|
|
STCK __LC_MCCK_CLOCK
|
2018-01-16 09:11:45 +03:00
|
|
|
BPOFF
|
2017-10-12 14:24:48 +03:00
|
|
|
la %r1,4095 # validate r1
|
|
|
|
spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # validate cpu timer
|
|
|
|
sckc __LC_CLOCK_COMPARATOR # validate comparator
|
|
|
|
lam %a0,%a15,__LC_AREGS_SAVE_AREA-4095(%r1) # validate acrs
|
|
|
|
lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# validate gprs
|
2016-11-08 13:08:26 +03:00
|
|
|
lg %r12,__LC_CURRENT
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r8,%r9,__LC_MCK_OLD_PSW
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_SYSTEM_DAMAGE
|
2014-12-03 19:00:08 +03:00
|
|
|
jo .Lmcck_panic # yes -> rest of mcck code invalid
|
2017-10-12 14:24:48 +03:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_CR_VALID
|
|
|
|
jno .Lmcck_panic # control registers invalid -> panic
|
|
|
|
la %r14,4095
|
|
|
|
lctlg %c0,%c15,__LC_CREGS_SAVE_AREA-4095(%r14) # validate ctl regs
|
|
|
|
ptlb
|
2017-10-27 13:44:48 +03:00
|
|
|
lg %r11,__LC_MCESAD-4095(%r14) # extended machine check save area
|
2017-10-12 14:24:48 +03:00
|
|
|
nill %r11,0xfc00 # MCESA_ORIGIN_MASK
|
|
|
|
TSTMSK __LC_CREGS_SAVE_AREA+16-4095(%r14),CR2_GUARDED_STORAGE
|
|
|
|
jno 0f
|
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_GS_VALID
|
|
|
|
jno 0f
|
|
|
|
.insn rxy,0xe3000000004d,0,__MCESA_GS_SAVE_AREA(%r11) # LGSC
|
|
|
|
0: l %r14,__LC_FP_CREG_SAVE_AREA-4095(%r14)
|
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_FC_VALID
|
|
|
|
jo 0f
|
|
|
|
sr %r14,%r14
|
|
|
|
0: sfpc %r14
|
|
|
|
TSTMSK __LC_MACHINE_FLAGS,MACHINE_FLAG_VX
|
|
|
|
jo 0f
|
|
|
|
lghi %r14,__LC_FPREGS_SAVE_AREA
|
|
|
|
ld %f0,0(%r14)
|
|
|
|
ld %f1,8(%r14)
|
|
|
|
ld %f2,16(%r14)
|
|
|
|
ld %f3,24(%r14)
|
|
|
|
ld %f4,32(%r14)
|
|
|
|
ld %f5,40(%r14)
|
|
|
|
ld %f6,48(%r14)
|
|
|
|
ld %f7,56(%r14)
|
|
|
|
ld %f8,64(%r14)
|
|
|
|
ld %f9,72(%r14)
|
|
|
|
ld %f10,80(%r14)
|
|
|
|
ld %f11,88(%r14)
|
|
|
|
ld %f12,96(%r14)
|
|
|
|
ld %f13,104(%r14)
|
|
|
|
ld %f14,112(%r14)
|
|
|
|
ld %f15,120(%r14)
|
|
|
|
j 1f
|
|
|
|
0: VLM %v0,%v15,0,%r11
|
|
|
|
VLM %v16,%v31,256,%r11
|
|
|
|
1: lghi %r14,__LC_CPU_TIMER_SAVE_AREA
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2015-10-01 18:02:48 +03:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_CPU_TIMER_VALID
|
2011-12-27 14:27:15 +04:00
|
|
|
jo 3f
|
2006-06-29 16:58:05 +04:00
|
|
|
la %r14,__LC_SYNC_ENTER_TIMER
|
|
|
|
clc 0(8,%r14),__LC_ASYNC_ENTER_TIMER
|
|
|
|
jl 0f
|
|
|
|
la %r14,__LC_ASYNC_ENTER_TIMER
|
|
|
|
0: clc 0(8,%r14),__LC_EXIT_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
jl 1f
|
2006-06-29 16:58:05 +04:00
|
|
|
la %r14,__LC_EXIT_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
1: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER
|
|
|
|
jl 2f
|
2006-06-29 16:58:05 +04:00
|
|
|
la %r14,__LC_LAST_UPDATE_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
2: spt 0(%r14)
|
2010-05-17 12:00:03 +04:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2017-10-12 14:24:48 +03:00
|
|
|
3: TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_MWP_VALID
|
|
|
|
jno .Lmcck_panic
|
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
|
|
|
jnz 4f
|
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID
|
|
|
|
jno .Lmcck_panic
|
2017-09-12 17:37:33 +03:00
|
|
|
4: ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
|
2020-12-06 12:47:47 +03:00
|
|
|
SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+64,__LC_MCCK_ENTER_TIMER,__LC_MCCK_CLOCK
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lmcck_skip:
|
2013-02-28 19:28:41 +04:00
|
|
|
lghi %r14,__LC_GPREGS_SAVE_AREA+64
|
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 15:27:30 +03:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r2,%r2
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r10,%r10
|
2013-02-28 19:28:41 +04:00
|
|
|
mvc __PT_R8(64,%r11),0(%r14)
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2020-11-16 10:06:40 +03:00
|
|
|
la %r14,4095
|
|
|
|
mvc __PT_CR1(8,%r11),__LC_CREGS_SAVE_AREA-4095+8(%r14)
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2014-04-15 14:55:07 +04:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2011-12-27 14:27:15 +04:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2005-06-26 01:55:30 +04:00
|
|
|
brasl %r14,s390_do_machine_check
|
2020-02-20 14:09:36 +03:00
|
|
|
cghi %r2,0
|
|
|
|
je .Lmcck_return
|
2005-06-26 01:55:30 +04:00
|
|
|
lg %r1,__LC_KERNEL_STACK # switch to kernel stack
|
2011-12-27 14:27:15 +04:00
|
|
|
mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
|
|
|
|
xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1)
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r1)
|
2005-06-26 01:55:30 +04:00
|
|
|
lgr %r15,%r1
|
2006-07-03 11:24:46 +04:00
|
|
|
TRACE_IRQS_OFF
|
2005-06-26 01:55:30 +04:00
|
|
|
brasl %r14,s390_handle_mcck
|
2006-07-03 11:24:46 +04:00
|
|
|
TRACE_IRQS_ON
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lmcck_return:
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__PT_CR1(%r11)
|
2011-12-27 14:27:15 +04:00
|
|
|
lmg %r0,%r10,__PT_R0(%r11)
|
|
|
|
mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW
|
2006-06-29 16:58:05 +04:00
|
|
|
tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
|
|
|
|
jno 0f
|
2018-01-16 09:36:46 +03:00
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2006-06-29 16:58:05 +04:00
|
|
|
stpt __LC_EXIT_TIMER
|
2011-12-27 14:27:15 +04:00
|
|
|
0: lmg %r11,%r15,__PT_R11(%r11)
|
2020-01-22 15:38:22 +03:00
|
|
|
b __LC_RETURN_MCCK_LPSWE
|
2011-12-27 14:27:15 +04:00
|
|
|
|
2014-12-03 19:00:08 +03:00
|
|
|
.Lmcck_panic:
|
2017-09-12 17:37:33 +03:00
|
|
|
lg %r15,__LC_NODAT_STACK
|
2016-12-02 15:29:22 +03:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2014-12-03 19:00:08 +03:00
|
|
|
j .Lmcck_skip
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(mcck_int_handler)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2011-08-03 18:44:19 +04:00
|
|
|
#
|
|
|
|
# PSW restart interrupt handler
|
|
|
|
#
|
2012-03-11 19:59:26 +04:00
|
|
|
ENTRY(restart_int_handler)
|
2018-03-26 16:23:33 +03:00
|
|
|
ALTERNATIVE "", ".insn s,0xb2800000,_LPP_OFFSET", 40
|
|
|
|
stg %r15,__LC_SAVE_AREA_RESTART
|
2012-03-11 19:59:26 +04:00
|
|
|
lg %r15,__LC_RESTART_STACK
|
2017-09-12 17:37:33 +03:00
|
|
|
xc STACK_FRAME_OVERHEAD(__PT_SIZE,%r15),STACK_FRAME_OVERHEAD(%r15)
|
|
|
|
stmg %r0,%r14,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
|
|
|
mvc STACK_FRAME_OVERHEAD+__PT_R15(8,%r15),__LC_SAVE_AREA_RESTART
|
|
|
|
mvc STACK_FRAME_OVERHEAD+__PT_PSW(16,%r15),__LC_RST_OLD_PSW
|
2012-03-11 19:59:26 +04:00
|
|
|
xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
|
2012-06-05 11:59:52 +04:00
|
|
|
lg %r1,__LC_RESTART_FN # load fn, parm & source cpu
|
|
|
|
lg %r2,__LC_RESTART_DATA
|
|
|
|
lg %r3,__LC_RESTART_SOURCE
|
2012-03-11 19:59:26 +04:00
|
|
|
ltgr %r3,%r3 # test source cpu address
|
|
|
|
jm 1f # negative -> skip source stop
|
2012-06-04 17:05:43 +04:00
|
|
|
0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
|
2012-03-11 19:59:26 +04:00
|
|
|
brc 10,0b # wait for status stored
|
|
|
|
1: basr %r14,%r1 # call function
|
|
|
|
stap __SF_EMPTY(%r15) # store cpu address
|
|
|
|
llgh %r3,__SF_EMPTY(%r15)
|
2012-06-04 17:05:43 +04:00
|
|
|
2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
|
2012-03-11 19:59:26 +04:00
|
|
|
brc 2,2b
|
|
|
|
3: j 3b
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(restart_int_handler)
|
2011-08-03 18:44:19 +04:00
|
|
|
|
2011-01-05 14:47:25 +03:00
|
|
|
.section .kprobes.text, "ax"
|
|
|
|
|
2017-09-12 17:37:33 +03:00
|
|
|
#if defined(CONFIG_CHECK_STACK) || defined(CONFIG_VMAP_STACK)
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* The synchronous or the asynchronous stack overflowed. We are dead.
|
|
|
|
* No need to properly save the registers, we are going to panic anyway.
|
|
|
|
* Setup a pt_regs so that show_trace can provide a good call trace.
|
|
|
|
*/
|
2019-01-17 12:02:22 +03:00
|
|
|
ENTRY(stack_overflow)
|
2017-09-12 17:37:33 +03:00
|
|
|
lg %r15,__LC_NODAT_STACK # change to panic stack
|
2013-04-24 12:20:43 +04:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 14:27:15 +04:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
|
|
|
mvc __PT_R8(64,%r11),0(%r14)
|
|
|
|
stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2
|
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2005-04-17 02:20:36 +04:00
|
|
|
jg kernel_stack_overflow
|
2019-01-17 12:02:22 +03:00
|
|
|
ENDPROC(stack_overflow)
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif
|
|
|
|
|
2015-06-22 18:26:40 +03:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
.Lcleanup_sie:
|
2020-02-20 14:09:36 +03:00
|
|
|
cghi %r11,__LC_SAVE_AREA_ASYNC #Is this in normal interrupt?
|
|
|
|
je 1f
|
|
|
|
larl %r13,.Lsie_entry
|
|
|
|
slgr %r9,%r13
|
|
|
|
larl %r13,.Lsie_skip
|
|
|
|
clgr %r9,%r13
|
|
|
|
jh 1f
|
|
|
|
oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
|
|
|
|
1: BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2018-03-20 15:33:43 +03:00
|
|
|
lg %r9,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-10-06 19:06:15 +03:00
|
|
|
ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE
|
2020-11-16 10:06:40 +03:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2015-06-22 18:26:40 +03:00
|
|
|
larl %r9,sie_exit # skip forward to sie_exit
|
2018-06-21 15:49:38 +03:00
|
|
|
BR_EX %r14,%r11
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2011-07-24 12:48:18 +04:00
|
|
|
#endif
|
2015-02-13 16:44:29 +03:00
|
|
|
.section .rodata, "a"
|
2019-02-03 23:36:13 +03:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390x_ ## esame
|
2009-06-12 12:26:47 +04:00
|
|
|
.globl sys_call_table
|
2005-04-17 02:20:36 +04:00
|
|
|
sys_call_table:
|
2017-12-11 16:47:27 +03:00
|
|
|
#include "asm/syscall_table.h"
|
2005-04-17 02:20:36 +04:00
|
|
|
#undef SYSCALL
|
|
|
|
|
2006-01-06 11:19:28 +03:00
|
|
|
#ifdef CONFIG_COMPAT
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2019-02-03 23:36:13 +03:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390_ ## emu
|
2013-04-24 14:58:39 +04:00
|
|
|
.globl sys_call_table_emu
|
2005-04-17 02:20:36 +04:00
|
|
|
sys_call_table_emu:
|
2017-12-11 16:47:27 +03:00
|
|
|
#include "asm/syscall_table.h"
|
2005-04-17 02:20:36 +04:00
|
|
|
#undef SYSCALL
|
|
|
|
#endif
|