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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* S390 low-level entry points.
|
|
|
|
*
|
2012-07-20 17:15:04 +08:00
|
|
|
* Copyright IBM Corp. 1999, 2012
|
2005-04-17 06:20:36 +08:00
|
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
|
2006-09-28 22:56:37 +08:00
|
|
|
* Hartmut Penner (hp@de.ibm.com),
|
|
|
|
* Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
|
2005-06-26 05:55:30 +08:00
|
|
|
* Heiko Carstens <heiko.carstens@de.ibm.com>
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
2008-02-05 23:50:40 +08:00
|
|
|
#include <linux/init.h>
|
2011-07-24 16:48:19 +08:00
|
|
|
#include <linux/linkage.h>
|
2018-03-26 21:27:36 +08:00
|
|
|
#include <asm/alternative-asm.h>
|
2012-09-05 19:26:11 +08:00
|
|
|
#include <asm/processor.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/cache.h>
|
2017-10-12 19:24:48 +08:00
|
|
|
#include <asm/ctl_reg.h>
|
2018-02-19 18:27:09 +08:00
|
|
|
#include <asm/dwarf.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/errno.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/thread_info.h>
|
2005-09-10 02:57:26 +08:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/unistd.h>
|
|
|
|
#include <asm/page.h>
|
2012-06-04 21:05:43 +08:00
|
|
|
#include <asm/sigp.h>
|
2013-06-27 15:01:09 +08: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 18:53:42 +08:00
|
|
|
#include <asm/vx-insn.h>
|
2015-10-01 23:02:48 +08:00
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/nmi.h>
|
2016-01-13 02:30:03 +08:00
|
|
|
#include <asm/export.h>
|
2018-04-20 22:49:46 +08:00
|
|
|
#include <asm/nospec-insn.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-12-27 18:27:15 +08: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 06:20:36 +08:00
|
|
|
|
2016-11-14 21:39:16 +08:00
|
|
|
STACK_SHIFT = PAGE_SHIFT + THREAD_SIZE_ORDER
|
2005-04-17 06:20:36 +08:00
|
|
|
STACK_SIZE = 1 << STACK_SHIFT
|
2013-04-24 16:20:43 +08:00
|
|
|
STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2018-03-26 21:23:33 +08:00
|
|
|
_LPP_OFFSET = __LC_LPP
|
|
|
|
|
2017-09-12 22:37:33 +08:00
|
|
|
.macro CHECK_STACK savearea
|
2006-06-29 20:58:05 +08:00
|
|
|
#ifdef CONFIG_CHECK_STACK
|
2017-09-12 22:37:33 +08:00
|
|
|
tml %r15,STACK_SIZE - CONFIG_STACK_GUARD
|
2011-12-27 18:27:15 +08:00
|
|
|
lghi %r14,\savearea
|
|
|
|
jz stack_overflow
|
2006-06-29 20:58:05 +08:00
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2017-09-12 22:37:33 +08: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
|
2021-02-03 16:02:51 +08:00
|
|
|
clg %r14,__LC_MCCK_STACK
|
|
|
|
je \oklabel
|
2017-09-12 22:37:33 +08:00
|
|
|
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
|
|
|
|
|
2012-05-09 22:27:39 +08:00
|
|
|
.macro STCK savearea
|
2021-02-02 20:46:47 +08:00
|
|
|
ALTERNATIVE ".insn s,0xb2050000,\savearea", \
|
|
|
|
".insn s,0xb27c0000,\savearea", 25
|
2012-05-09 22:27:39 +08:00
|
|
|
.endm
|
|
|
|
|
2015-10-01 23:02:48 +08: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 14:11:45 +08:00
|
|
|
.macro BPOFF
|
2018-03-26 21:27:36 +08:00
|
|
|
ALTERNATIVE "", ".long 0xb2e8c000", 82
|
2018-01-16 14:11:45 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPON
|
2018-03-26 21:27:36 +08:00
|
|
|
ALTERNATIVE "", ".long 0xb2e8d000", 82
|
2018-01-16 14:11:45 +08:00
|
|
|
.endm
|
|
|
|
|
2018-01-16 14:36:46 +08:00
|
|
|
.macro BPENTER tif_ptr,tif_mask
|
2018-03-26 21:27:36 +08:00
|
|
|
ALTERNATIVE "TSTMSK \tif_ptr,\tif_mask; jz .+8; .long 0xb2e8d000", \
|
|
|
|
"", 82
|
2018-01-16 14:36:46 +08:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPEXIT tif_ptr,tif_mask
|
|
|
|
TSTMSK \tif_ptr,\tif_mask
|
2018-03-26 21:27:36 +08:00
|
|
|
ALTERNATIVE "jz .+8; .long 0xb2e8c000", \
|
|
|
|
"jnz .+8; .long 0xb2e8d000", 82
|
2018-01-16 14:36:46 +08:00
|
|
|
.endm
|
|
|
|
|
2018-04-20 22:49:46 +08:00
|
|
|
GEN_BR_THUNK %r14
|
2021-02-04 00:46:12 +08:00
|
|
|
GEN_BR_THUNK %r14,%r13
|
2018-01-26 19:46:47 +08:00
|
|
|
|
2011-01-05 19:47:25 +08:00
|
|
|
.section .kprobes.text, "ax"
|
2016-06-30 18:40:25 +08:00
|
|
|
.Ldummy:
|
|
|
|
/*
|
2020-11-21 18:14:56 +08:00
|
|
|
* This nop exists only in order to avoid that __bpon starts at
|
2016-06-30 18:40:25 +08:00
|
|
|
* 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.
|
2020-11-21 18:14:56 +08:00
|
|
|
* With the added nop in between the __bpon symbol is unique
|
2016-06-30 18:40:25 +08:00
|
|
|
* again.
|
|
|
|
*/
|
|
|
|
nop 0
|
2011-01-05 19:47:25 +08:00
|
|
|
|
2018-01-16 14:11:45 +08:00
|
|
|
ENTRY(__bpon)
|
|
|
|
.globl __bpon
|
|
|
|
BPON
|
2018-04-20 22:49:46 +08:00
|
|
|
BR_EX %r14
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(__bpon)
|
2018-01-16 14:11:45 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Scheduler resume function, called by switch_to
|
|
|
|
* gpr2 = (task_struct *) prev
|
|
|
|
* gpr3 = (task_struct *) next
|
|
|
|
* Returns:
|
|
|
|
* gpr2 = prev
|
|
|
|
*/
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(__switch_to)
|
2012-05-15 15:20:06 +08:00
|
|
|
stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
|
2017-11-16 21:54:04 +08:00
|
|
|
lghi %r4,__TASK_stack
|
|
|
|
lghi %r1,__TASK_thread
|
2018-10-26 21:29:59 +08:00
|
|
|
llill %r5,STACK_INIT
|
2017-11-16 21:54:04 +08:00
|
|
|
stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev
|
2018-10-26 21:29:59 +08:00
|
|
|
lg %r15,0(%r4,%r3) # start of kernel stack of next
|
|
|
|
agr %r15,%r5 # end of kernel stack of next
|
2012-05-15 15:20:06 +08:00
|
|
|
stg %r3,__LC_CURRENT # store task struct of next
|
|
|
|
stg %r15,__LC_KERNEL_STACK # store end of kernel stack
|
2017-11-16 21:54:04 +08: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 18:55:07 +08:00
|
|
|
lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
|
2018-03-26 21:23:33 +08:00
|
|
|
ALTERNATIVE "", ".insn s,0xb2800000,_LPP_OFFSET", 40
|
2018-04-20 22:49:46 +08:00
|
|
|
BR_EX %r14
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(__switch_to)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-06-22 23:26:40 +08: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 14:36:46 +08:00
|
|
|
lg %r12,__LC_CURRENT
|
2018-03-20 20:33:43 +08: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-06-22 23:26:40 +08:00
|
|
|
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 20:33:43 +08:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-06-22 23:26:40 +08: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 23:02:48 +08:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
|
2015-06-22 23:26:40 +08:00
|
|
|
jo .Lsie_skip # exit if fp/vx regs changed
|
2018-03-20 20:33:43 +08:00
|
|
|
BPEXIT __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2017-06-07 17:30:42 +08:00
|
|
|
.Lsie_entry:
|
2015-06-22 23:26:40 +08:00
|
|
|
sie 0(%r14)
|
2018-01-16 14:11:45 +08:00
|
|
|
BPOFF
|
2018-03-20 20:33:43 +08:00
|
|
|
BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2015-06-22 23:26:40 +08:00
|
|
|
.Lsie_skip:
|
|
|
|
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2015-06-22 23:26:40 +08:00
|
|
|
.Lsie_done:
|
|
|
|
# some program checks are suppressing. C code (e.g. do_protection_exception)
|
2017-05-15 20:11:03 +08: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.
|
2021-02-04 00:50:00 +08:00
|
|
|
# See also .Lcleanup_sie_mcck/.Lcleanup_sie_int
|
2017-05-15 20:11:03 +08:00
|
|
|
.Lrewind_pad6:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad4:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad2:
|
|
|
|
nopr 7
|
2015-06-22 23:26:40 +08:00
|
|
|
.globl sie_exit
|
|
|
|
sie_exit:
|
2018-03-20 20:33:43 +08:00
|
|
|
lg %r14,__SF_SIE_SAVEAREA(%r15) # load guest register save area
|
2015-06-22 23:26:40 +08:00
|
|
|
stmg %r0,%r13,0(%r14) # save guest gprs 0-13
|
2018-01-16 20:27:30 +08:00
|
|
|
xgr %r0,%r0 # clear guest registers to
|
|
|
|
xgr %r1,%r1 # prevent speculative use
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
2015-06-22 23:26:40 +08:00
|
|
|
lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
|
2018-03-20 20:33:43 +08:00
|
|
|
lg %r2,__SF_SIE_REASON(%r15) # return exit reason code
|
2018-04-20 22:49:46 +08:00
|
|
|
BR_EX %r14
|
2015-06-22 23:26:40 +08:00
|
|
|
.Lsie_fault:
|
|
|
|
lghi %r14,-EFAULT
|
2018-03-20 20:33:43 +08:00
|
|
|
stg %r14,__SF_SIE_REASON(%r15) # set exit reason code
|
2015-06-22 23:26:40 +08:00
|
|
|
j sie_exit
|
|
|
|
|
2017-05-15 20:11:03 +08:00
|
|
|
EX_TABLE(.Lrewind_pad6,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad4,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad2,.Lsie_fault)
|
2015-06-22 23:26:40 +08:00
|
|
|
EX_TABLE(sie_exit,.Lsie_fault)
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(sie64a)
|
2016-01-13 02:30:03 +08:00
|
|
|
EXPORT_SYMBOL(sie64a)
|
|
|
|
EXPORT_SYMBOL(sie_exit)
|
2015-06-22 23:26:40 +08:00
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* SVC interrupt handler routine. System calls are synchronous events and
|
2020-07-07 20:07:53 +08:00
|
|
|
* are entered with interrupts disabled.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(system_call)
|
2020-11-21 18:14:56 +08:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
2018-01-16 14:11:45 +08:00
|
|
|
BPOFF
|
2020-11-21 18:14:56 +08:00
|
|
|
lghi %r14,0
|
2014-12-04 00:00:08 +08:00
|
|
|
.Lsysc_per:
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2020-11-21 18:14:56 +08:00
|
|
|
lg %r12,__LC_CURRENT
|
2011-12-27 18:27:15 +08:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
2020-12-05 00:56:57 +08:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-11-21 18:14:56 +08:00
|
|
|
stmg %r0,%r7,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
|
|
|
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2018-03-06 03:18:47 +08:00
|
|
|
# clear user controlled register to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
2020-11-21 18:14:56 +08:00
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r8,%r8
|
|
|
|
xgr %r9,%r9
|
|
|
|
xgr %r10,%r10
|
|
|
|
xgr %r11,%r11
|
|
|
|
la %r2,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
|
|
|
|
lgr %r3,%r14
|
|
|
|
brasl %r14,__do_syscall
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2020-11-21 18:14:56 +08:00
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
2011-12-27 18:27:15 +08:00
|
|
|
stpt __LC_EXIT_TIMER
|
2020-02-20 19:09:36 +08:00
|
|
|
b __LC_RETURN_LPSWE
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(system_call)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# a new process exits the kernel with ret_from_fork
|
|
|
|
#
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(ret_from_fork)
|
2020-11-21 18:14:56 +08:00
|
|
|
lgr %r3,%r11
|
|
|
|
brasl %r14,__ret_from_fork
|
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
|
|
|
stpt __LC_EXIT_TIMER
|
|
|
|
b __LC_RETURN_LPSWE
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(ret_from_fork)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Program check handler routine
|
|
|
|
*/
|
|
|
|
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(pgm_check_handler)
|
2020-11-21 18:14:56 +08:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2018-01-16 14:11:45 +08:00
|
|
|
BPOFF
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
2020-11-21 18:14:56 +08:00
|
|
|
lg %r12,__LC_CURRENT
|
|
|
|
lghi %r10,0
|
2011-12-27 18:27:15 +08:00
|
|
|
lmg %r8,%r9,__LC_PGM_OLD_PSW
|
2020-11-16 15:06:40 +08:00
|
|
|
tmhh %r8,0x0001 # coming from user space?
|
|
|
|
jno .Lpgm_skip_asce
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2020-11-21 18:14:56 +08:00
|
|
|
j 3f # -> fault in user space
|
2020-11-16 15:06:40 +08:00
|
|
|
.Lpgm_skip_asce:
|
2015-06-22 23:26:40 +08:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2017-10-05 14:29:47 +08:00
|
|
|
# cleanup critical section for program checks in sie64a
|
2015-06-22 23:26:40 +08:00
|
|
|
lgr %r14,%r9
|
2020-02-20 19:09:36 +08:00
|
|
|
larl %r13,.Lsie_gmap
|
|
|
|
slgr %r14,%r13
|
|
|
|
lghi %r13,.Lsie_done - .Lsie_gmap
|
|
|
|
clgr %r14,%r13
|
2020-01-22 20:38:22 +08:00
|
|
|
jhe 1f
|
2018-03-20 20:33:43 +08:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2017-10-05 14:29:47 +08:00
|
|
|
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2017-10-05 14:29:47 +08:00
|
|
|
larl %r9,sie_exit # skip forward to sie_exit
|
2020-11-21 18:14:56 +08:00
|
|
|
lghi %r10,_PIF_GUEST_FAULT
|
2015-06-22 23:26:40 +08:00
|
|
|
#endif
|
2020-01-22 20:38:22 +08:00
|
|
|
1: tmhh %r8,0x4000 # PER bit set in old PSW ?
|
|
|
|
jnz 2f # -> enabled, can't be a double fault
|
2011-12-27 18:27:15 +08:00
|
|
|
tm __LC_PGM_ILC+3,0x80 # check for per exception
|
2014-12-04 00:00:08 +08:00
|
|
|
jnz .Lpgm_svcper # -> single stepped svc
|
2020-01-22 20:38:22 +08:00
|
|
|
2: CHECK_STACK __LC_SAVE_AREA_SYNC
|
2013-04-24 16:20:43 +08:00
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
2020-11-21 18:14:56 +08:00
|
|
|
# CHECK_VMAP_STACK branches to stack_overflow or 4f
|
|
|
|
CHECK_VMAP_STACK __LC_SAVE_AREA_SYNC,4f
|
|
|
|
3: BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2011-12-27 18:27:15 +08:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
2020-11-21 18:14:56 +08:00
|
|
|
4: la %r11,STACK_FRAME_OVERHEAD(%r15)
|
|
|
|
stg %r10,__PT_FLAGS(%r11)
|
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2020-11-21 18:14:56 +08:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
|
|
|
|
2018-01-16 20:27:30 +08:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
2020-11-21 18:14:56 +08:00
|
|
|
lgr %r2,%r11
|
|
|
|
brasl %r14,__do_pgm_check
|
|
|
|
tmhh %r8,0x0001 # returning to user space?
|
|
|
|
jno .Lpgm_exit_kernel
|
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2020-11-12 01:46:26 +08:00
|
|
|
stpt __LC_EXIT_TIMER
|
2020-11-21 18:14:56 +08:00
|
|
|
.Lpgm_exit_kernel:
|
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
2020-11-12 01:46:26 +08:00
|
|
|
b __LC_RETURN_LPSWE
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-09-20 21:58:39 +08:00
|
|
|
#
|
2011-12-27 18:27:15 +08:00
|
|
|
# single stepped system call
|
2006-09-20 21:58:39 +08:00
|
|
|
#
|
2014-12-04 00:00:08 +08:00
|
|
|
.Lpgm_svcper:
|
2011-12-27 18:27:15 +08:00
|
|
|
mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW
|
2014-12-04 00:00:08 +08:00
|
|
|
larl %r14,.Lsysc_per
|
2011-12-27 18:27:15 +08:00
|
|
|
stg %r14,__LC_RETURN_PSW+8
|
2020-11-21 18:14:56 +08:00
|
|
|
lghi %r14,1
|
2020-02-20 19:09:36 +08:00
|
|
|
lpswe __LC_RETURN_PSW # branch to .Lsysc_per
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(pgm_check_handler)
|
2006-09-20 21:58:39 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2020-11-21 18:14:56 +08:00
|
|
|
* Interrupt handler macro used for external and IO interrupts.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2020-11-21 18:14:56 +08:00
|
|
|
.macro INT_HANDLER name,lc_old_psw,handler
|
|
|
|
ENTRY(\name)
|
2012-05-09 22:27:39 +08:00
|
|
|
STCK __LC_INT_CLOCK
|
2020-11-21 18:14:56 +08:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2018-01-16 14:11:45 +08:00
|
|
|
BPOFF
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
|
2016-11-08 18:08:26 +08:00
|
|
|
lg %r12,__LC_CURRENT
|
2020-11-21 18:14:56 +08:00
|
|
|
lmg %r8,%r9,\lc_old_psw
|
2021-01-28 20:06:05 +08:00
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
|
|
|
jnz 1f
|
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
lgr %r14,%r9
|
|
|
|
larl %r13,.Lsie_gmap
|
|
|
|
slgr %r14,%r13
|
|
|
|
lghi %r13,.Lsie_done - .Lsie_gmap
|
|
|
|
clgr %r14,%r13
|
|
|
|
jhe 0f
|
2021-02-04 00:50:00 +08:00
|
|
|
brasl %r14,.Lcleanup_sie_int
|
2021-01-28 20:06:05 +08:00
|
|
|
#endif
|
|
|
|
0: CHECK_STACK __LC_SAVE_AREA_ASYNC
|
|
|
|
lgr %r11,%r15
|
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
|
|
|
stg %r11,__SF_BACKCHAIN(%r15)
|
|
|
|
j 2f
|
|
|
|
1: BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
lg %r15,__LC_KERNEL_STACK
|
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
2: la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 20:27:30 +08:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r10,%r10
|
2011-12-27 18:27:15 +08:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
|
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2020-11-21 18:14:56 +08:00
|
|
|
tm %r8,0x0001 # coming from user space?
|
|
|
|
jno 1f
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2020-11-21 18:14:56 +08:00
|
|
|
1: lgr %r2,%r11 # pass pointer to pt_regs
|
|
|
|
brasl %r14,\handler
|
2011-12-27 18:27:15 +08:00
|
|
|
mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
|
2020-11-21 18:14:56 +08:00
|
|
|
tmhh %r8,0x0001 # returning to user ?
|
|
|
|
jno 2f
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2018-01-16 14:36:46 +08:00
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2011-12-27 18:27:15 +08:00
|
|
|
stpt __LC_EXIT_TIMER
|
2020-11-21 18:14:56 +08:00
|
|
|
2: lmg %r0,%r15,__PT_R0(%r11)
|
2020-02-20 19:09:36 +08:00
|
|
|
b __LC_RETURN_LPSWE
|
2020-11-21 18:14:56 +08:00
|
|
|
ENDPROC(\name)
|
|
|
|
.endm
|
2016-01-26 21:10:34 +08:00
|
|
|
|
2020-11-21 18:14:56 +08:00
|
|
|
INT_HANDLER ext_int_handler,__LC_EXT_OLD_PSW,do_ext_irq
|
|
|
|
INT_HANDLER io_int_handler,__LC_IO_OLD_PSW,do_io_irq
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-03-11 23:59:27 +08:00
|
|
|
/*
|
2020-02-20 19:09:36 +08:00
|
|
|
* Load idle PSW.
|
2012-03-11 23:59:27 +08:00
|
|
|
*/
|
|
|
|
ENTRY(psw_idle)
|
2012-07-20 17:15:08 +08:00
|
|
|
stg %r3,__SF_EMPTY(%r15)
|
2020-11-21 18:14:56 +08:00
|
|
|
larl %r1,psw_idle_exit
|
2012-03-11 23:59:27 +08:00
|
|
|
stg %r1,__SF_EMPTY+8(%r15)
|
2015-09-18 22:41:36 +08:00
|
|
|
larl %r1,smp_cpu_mtid
|
|
|
|
llgf %r1,0(%r1)
|
|
|
|
ltgr %r1,%r1
|
|
|
|
jz .Lpsw_idle_stcctm
|
2020-11-21 18:14:56 +08:00
|
|
|
.insn rsy,0xeb0000000017,%r1,5,__MT_CYCLES_ENTER(%r2)
|
2015-09-18 22:41:36 +08:00
|
|
|
.Lpsw_idle_stcctm:
|
2015-11-19 18:09:45 +08:00
|
|
|
oi __LC_CPU_FLAGS+7,_CIF_ENABLED_WAIT
|
2018-01-16 14:11:45 +08:00
|
|
|
BPON
|
2012-07-20 17:15:08 +08:00
|
|
|
STCK __CLOCK_IDLE_ENTER(%r2)
|
|
|
|
stpt __TIMER_IDLE_ENTER(%r2)
|
2012-03-11 23:59:27 +08:00
|
|
|
lpswe __SF_EMPTY(%r15)
|
2020-11-21 18:14:56 +08:00
|
|
|
.globl psw_idle_exit
|
|
|
|
psw_idle_exit:
|
2018-04-20 22:49:46 +08:00
|
|
|
BR_EX %r14
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(psw_idle)
|
2012-03-11 23:59:27 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Machine check handler routines
|
|
|
|
*/
|
2011-07-24 16:48:19 +08:00
|
|
|
ENTRY(mcck_int_handler)
|
2012-05-09 22:27:39 +08:00
|
|
|
STCK __LC_MCCK_CLOCK
|
2018-01-16 14:11:45 +08:00
|
|
|
BPOFF
|
2017-10-12 19:24:48 +08: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 18:08:26 +08:00
|
|
|
lg %r12,__LC_CURRENT
|
2011-12-27 18:27:15 +08:00
|
|
|
lmg %r8,%r9,__LC_MCK_OLD_PSW
|
2015-10-01 23:02:48 +08:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_SYSTEM_DAMAGE
|
2014-12-04 00:00:08 +08:00
|
|
|
jo .Lmcck_panic # yes -> rest of mcck code invalid
|
2017-10-12 19:24:48 +08: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 18:44:48 +08:00
|
|
|
lg %r11,__LC_MCESAD-4095(%r14) # extended machine check save area
|
2017-10-12 19:24:48 +08: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 18:27:15 +08:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2015-10-01 23:02:48 +08:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_CPU_TIMER_VALID
|
2011-12-27 18:27:15 +08:00
|
|
|
jo 3f
|
2020-11-21 18:14:56 +08:00
|
|
|
la %r14,__LC_SYS_ENTER_TIMER
|
|
|
|
clc 0(8,%r14),__LC_EXIT_TIMER
|
2011-12-27 18:27:15 +08:00
|
|
|
jl 1f
|
2006-06-29 20:58:05 +08:00
|
|
|
la %r14,__LC_EXIT_TIMER
|
2011-12-27 18:27:15 +08:00
|
|
|
1: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER
|
|
|
|
jl 2f
|
2006-06-29 20:58:05 +08:00
|
|
|
la %r14,__LC_LAST_UPDATE_TIMER
|
2011-12-27 18:27:15 +08:00
|
|
|
2: spt 0(%r14)
|
2010-05-17 16:00:03 +08:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2017-10-12 19:24:48 +08: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 22:37:33 +08:00
|
|
|
4: ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off
|
2021-01-28 20:06:05 +08:00
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
|
|
|
jnz .Lmcck_user
|
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
lgr %r14,%r9
|
|
|
|
larl %r13,.Lsie_gmap
|
|
|
|
slgr %r14,%r13
|
|
|
|
lghi %r13,.Lsie_done - .Lsie_gmap
|
|
|
|
clgr %r14,%r13
|
|
|
|
jhe .Lmcck_stack
|
2021-02-04 00:50:00 +08:00
|
|
|
brasl %r14,.Lcleanup_sie_mcck
|
2021-01-28 20:06:05 +08:00
|
|
|
#endif
|
2021-02-03 16:02:51 +08:00
|
|
|
j .Lmcck_stack
|
2021-01-28 20:06:05 +08:00
|
|
|
.Lmcck_user:
|
|
|
|
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
|
2021-02-03 16:02:51 +08:00
|
|
|
.Lmcck_stack:
|
|
|
|
lg %r15,__LC_MCCK_STACK
|
|
|
|
.Lmcck_skip:
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2021-02-03 16:16:45 +08:00
|
|
|
stctg %c1,%c1,__PT_CR1(%r11)
|
2021-01-28 20:06:05 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2013-02-28 23:28:41 +08:00
|
|
|
lghi %r14,__LC_GPREGS_SAVE_AREA+64
|
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 20:27:30 +08:00
|
|
|
# clear user controlled registers to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
|
|
|
xgr %r1,%r1
|
|
|
|
xgr %r3,%r3
|
|
|
|
xgr %r4,%r4
|
|
|
|
xgr %r5,%r5
|
|
|
|
xgr %r6,%r6
|
|
|
|
xgr %r7,%r7
|
|
|
|
xgr %r10,%r10
|
2013-02-28 23:28:41 +08:00
|
|
|
mvc __PT_R8(64,%r11),0(%r14)
|
2011-12-27 18:27:15 +08:00
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2014-04-15 18:55:07 +08:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2011-12-27 18:27:15 +08:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2005-06-26 05:55:30 +08:00
|
|
|
brasl %r14,s390_do_machine_check
|
2020-02-20 19:09:36 +08:00
|
|
|
cghi %r2,0
|
|
|
|
je .Lmcck_return
|
2005-06-26 05:55:30 +08:00
|
|
|
lg %r1,__LC_KERNEL_STACK # switch to kernel stack
|
2011-12-27 18:27:15 +08: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 05:55:30 +08:00
|
|
|
lgr %r15,%r1
|
|
|
|
brasl %r14,s390_handle_mcck
|
2014-12-04 00:00:08 +08:00
|
|
|
.Lmcck_return:
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__PT_CR1(%r11)
|
2011-12-27 18:27:15 +08:00
|
|
|
lmg %r0,%r10,__PT_R0(%r11)
|
|
|
|
mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW
|
2006-06-29 20:58:05 +08:00
|
|
|
tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
|
|
|
|
jno 0f
|
2018-01-16 14:36:46 +08:00
|
|
|
BPEXIT __TI_flags(%r12),_TIF_ISOLATE_BP
|
2006-06-29 20:58:05 +08:00
|
|
|
stpt __LC_EXIT_TIMER
|
2011-12-27 18:27:15 +08:00
|
|
|
0: lmg %r11,%r15,__PT_R11(%r11)
|
2020-01-22 20:38:22 +08:00
|
|
|
b __LC_RETURN_MCCK_LPSWE
|
2011-12-27 18:27:15 +08:00
|
|
|
|
2014-12-04 00:00:08 +08:00
|
|
|
.Lmcck_panic:
|
2017-09-12 22:37:33 +08:00
|
|
|
lg %r15,__LC_NODAT_STACK
|
2014-12-04 00:00:08 +08:00
|
|
|
j .Lmcck_skip
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(mcck_int_handler)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-08-03 22:44:19 +08:00
|
|
|
#
|
|
|
|
# PSW restart interrupt handler
|
|
|
|
#
|
2012-03-11 23:59:26 +08:00
|
|
|
ENTRY(restart_int_handler)
|
2018-03-26 21:23:33 +08:00
|
|
|
ALTERNATIVE "", ".insn s,0xb2800000,_LPP_OFFSET", 40
|
|
|
|
stg %r15,__LC_SAVE_AREA_RESTART
|
2012-03-11 23:59:26 +08:00
|
|
|
lg %r15,__LC_RESTART_STACK
|
2017-09-12 22:37:33 +08: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 23:59:26 +08:00
|
|
|
xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
|
2012-06-05 15:59:52 +08:00
|
|
|
lg %r1,__LC_RESTART_FN # load fn, parm & source cpu
|
|
|
|
lg %r2,__LC_RESTART_DATA
|
|
|
|
lg %r3,__LC_RESTART_SOURCE
|
2012-03-11 23:59:26 +08:00
|
|
|
ltgr %r3,%r3 # test source cpu address
|
|
|
|
jm 1f # negative -> skip source stop
|
2012-06-04 21:05:43 +08:00
|
|
|
0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
|
2012-03-11 23:59:26 +08: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 21:05:43 +08:00
|
|
|
2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
|
2012-03-11 23:59:26 +08:00
|
|
|
brc 2,2b
|
|
|
|
3: j 3b
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(restart_int_handler)
|
2011-08-03 22:44:19 +08:00
|
|
|
|
2011-01-05 19:47:25 +08:00
|
|
|
.section .kprobes.text, "ax"
|
|
|
|
|
2017-09-12 22:37:33 +08:00
|
|
|
#if defined(CONFIG_CHECK_STACK) || defined(CONFIG_VMAP_STACK)
|
2005-04-17 06:20:36 +08: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 17:02:22 +08:00
|
|
|
ENTRY(stack_overflow)
|
2017-09-12 22:37:33 +08:00
|
|
|
lg %r15,__LC_NODAT_STACK # change to panic stack
|
2013-04-24 16:20:43 +08:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 18:27:15 +08: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 06:20:36 +08:00
|
|
|
jg kernel_stack_overflow
|
2019-01-17 17:02:22 +08:00
|
|
|
ENDPROC(stack_overflow)
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
2015-06-22 23:26:40 +08:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2021-02-04 00:50:00 +08:00
|
|
|
.Lcleanup_sie_mcck:
|
2020-02-20 19:09:36 +08:00
|
|
|
larl %r13,.Lsie_entry
|
|
|
|
slgr %r9,%r13
|
|
|
|
larl %r13,.Lsie_skip
|
|
|
|
clgr %r9,%r13
|
2021-02-04 00:50:00 +08:00
|
|
|
jh .Lcleanup_sie_int
|
2020-02-20 19:09:36 +08:00
|
|
|
oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
|
2021-02-04 00:50:00 +08:00
|
|
|
.Lcleanup_sie_int:
|
|
|
|
BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
|
2018-03-20 20:33:43 +08:00
|
|
|
lg %r9,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-10-07 00:06:15 +08:00
|
|
|
ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE
|
2020-11-16 15:06:40 +08:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2015-06-22 23:26:40 +08:00
|
|
|
larl %r9,sie_exit # skip forward to sie_exit
|
2021-02-04 00:46:12 +08:00
|
|
|
BR_EX %r14,%r13
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-07-24 16:48:18 +08:00
|
|
|
#endif
|
2015-02-13 21:44:29 +08:00
|
|
|
.section .rodata, "a"
|
2019-02-04 04:36:13 +08:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390x_ ## esame
|
2009-06-12 16:26:47 +08:00
|
|
|
.globl sys_call_table
|
2005-04-17 06:20:36 +08:00
|
|
|
sys_call_table:
|
2017-12-11 21:47:27 +08:00
|
|
|
#include "asm/syscall_table.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#undef SYSCALL
|
|
|
|
|
2006-01-06 16:19:28 +08:00
|
|
|
#ifdef CONFIG_COMPAT
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2019-02-04 04:36:13 +08:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390_ ## emu
|
2013-04-24 18:58:39 +08:00
|
|
|
.globl sys_call_table_emu
|
2005-04-17 06:20:36 +08:00
|
|
|
sys_call_table_emu:
|
2017-12-11 21:47:27 +08:00
|
|
|
#include "asm/syscall_table.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
#undef SYSCALL
|
|
|
|
#endif
|