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 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* S390 low-level entry points.
|
|
|
|
*
|
2012-07-20 09:15:04 +00:00
|
|
|
* Copyright IBM Corp. 1999, 2012
|
2005-04-16 22:20:36 +00:00
|
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
|
2006-09-28 14:56:37 +00:00
|
|
|
* Hartmut Penner (hp@de.ibm.com),
|
|
|
|
* Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
2023-08-06 15:16:39 +00:00
|
|
|
#include <linux/export.h>
|
2008-02-05 15:50:40 +00:00
|
|
|
#include <linux/init.h>
|
2011-07-24 08:48:19 +00:00
|
|
|
#include <linux/linkage.h>
|
2022-02-28 10:22:12 +00:00
|
|
|
#include <asm/asm-extable.h>
|
2018-03-26 13:27:36 +00:00
|
|
|
#include <asm/alternative-asm.h>
|
2012-09-05 11:26:11 +00:00
|
|
|
#include <asm/processor.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/cache.h>
|
2018-02-19 10:27:09 +00:00
|
|
|
#include <asm/dwarf.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/errno.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/thread_info.h>
|
2005-09-09 18:57:26 +00:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/unistd.h>
|
|
|
|
#include <asm/page.h>
|
2012-06-04 13:05:43 +00:00
|
|
|
#include <asm/sigp.h>
|
2013-06-27 07:01:09 +00:00
|
|
|
#include <asm/irq.h>
|
2024-02-03 10:45:02 +00:00
|
|
|
#include <asm/fpu-insn.h>
|
2015-10-01 15:02:48 +00:00
|
|
|
#include <asm/setup.h>
|
|
|
|
#include <asm/nmi.h>
|
2018-04-20 14:49:46 +00:00
|
|
|
#include <asm/nospec-insn.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2018-03-26 13:23:33 +00:00
|
|
|
_LPP_OFFSET = __LC_LPP
|
|
|
|
|
2021-04-07 07:20:17 +00:00
|
|
|
.macro STBEAR address
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", ".insn s,0xb2010000,\address", 193
|
2021-04-07 07:20:17 +00:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro LBEAR address
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", ".insn s,0xb2000000,\address", 193
|
2021-04-07 07:20:17 +00:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro LPSWEY address,lpswe
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "b \lpswe; nopr", ".insn siy,0xeb0000000071,\address,0", 193
|
2021-04-07 07:20:17 +00:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro MBEAR reg
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "brcl 0,0", __stringify(mvc __PT_LAST_BREAK(8,\reg),__LC_LAST_BREAK), 193
|
2021-04-07 07:20:17 +00:00
|
|
|
.endm
|
|
|
|
|
2017-09-12 14:37:33 +00:00
|
|
|
.macro CHECK_STACK savearea
|
2006-06-29 12:58:05 +00:00
|
|
|
#ifdef CONFIG_CHECK_STACK
|
2023-03-27 09:37:22 +00:00
|
|
|
tml %r15,THREAD_SIZE - CONFIG_STACK_GUARD
|
2011-12-27 10:27:15 +00:00
|
|
|
lghi %r14,\savearea
|
|
|
|
jz stack_overflow
|
2006-06-29 12:58:05 +00:00
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2017-09-12 14:37:33 +00:00
|
|
|
.macro CHECK_VMAP_STACK savearea,oklabel
|
|
|
|
#ifdef CONFIG_VMAP_STACK
|
|
|
|
lgr %r14,%r15
|
2023-03-27 09:37:22 +00:00
|
|
|
nill %r14,0x10000 - THREAD_SIZE
|
|
|
|
oill %r14,STACK_INIT_OFFSET
|
2017-09-12 14:37:33 +00:00
|
|
|
clg %r14,__LC_KERNEL_STACK
|
|
|
|
je \oklabel
|
|
|
|
clg %r14,__LC_ASYNC_STACK
|
|
|
|
je \oklabel
|
2021-02-03 08:02:51 +00:00
|
|
|
clg %r14,__LC_MCCK_STACK
|
|
|
|
je \oklabel
|
2017-09-12 14:37:33 +00: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
|
|
|
|
|
2015-10-01 15:02:48 +00: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 06:11:45 +00:00
|
|
|
.macro BPOFF
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,12,0", 82
|
2018-01-16 06:11:45 +00:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPON
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", ".insn rrf,0xb2e80000,0,0,13,0", 82
|
2018-01-16 06:11:45 +00:00
|
|
|
.endm
|
|
|
|
|
2018-01-16 06:36:46 +00:00
|
|
|
.macro BPENTER tif_ptr,tif_mask
|
2022-03-13 21:39:27 +00:00
|
|
|
ALTERNATIVE "TSTMSK \tif_ptr,\tif_mask; jz .+8; .insn rrf,0xb2e80000,0,0,13,0", \
|
2022-05-11 12:05:25 +00:00
|
|
|
"j .+12; nop; nop", 82
|
2018-01-16 06:36:46 +00:00
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro BPEXIT tif_ptr,tif_mask
|
|
|
|
TSTMSK \tif_ptr,\tif_mask
|
2022-03-13 21:39:27 +00:00
|
|
|
ALTERNATIVE "jz .+8; .insn rrf,0xb2e80000,0,0,12,0", \
|
|
|
|
"jnz .+8; .insn rrf,0xb2e80000,0,0,13,0", 82
|
2018-01-16 06:36:46 +00:00
|
|
|
.endm
|
|
|
|
|
2021-06-07 10:01:49 +00:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2024-03-13 08:51:22 +00:00
|
|
|
.macro SIEEXIT sie_control
|
|
|
|
lg %r9,\sie_control # get control block pointer
|
2021-06-18 06:17:13 +00:00
|
|
|
ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2024-02-20 13:21:14 +00:00
|
|
|
ni __LC_CPU_FLAGS+7,255-_CIF_SIE
|
2021-06-18 06:17:13 +00:00
|
|
|
larl %r9,sie_exit # skip forward to sie_exit
|
|
|
|
.endm
|
2021-06-07 10:01:49 +00:00
|
|
|
#endif
|
|
|
|
|
2023-03-27 09:37:28 +00:00
|
|
|
.macro STACKLEAK_ERASE
|
|
|
|
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
|
|
|
|
brasl %r14,stackleak_erase_on_task_stack
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2018-04-20 14:49:46 +00:00
|
|
|
GEN_BR_THUNK %r14
|
2018-01-26 11:46:47 +00:00
|
|
|
|
2011-01-05 11:47:25 +00:00
|
|
|
.section .kprobes.text, "ax"
|
2016-06-30 10:40:25 +00:00
|
|
|
.Ldummy:
|
|
|
|
/*
|
2023-02-28 12:57:50 +00:00
|
|
|
* The following nop exists only in order to avoid that the next
|
|
|
|
* symbol starts at the beginning of the kprobes text section.
|
|
|
|
* In that case there would be several symbols at the same address.
|
|
|
|
* E.g. objdump would take an arbitrary symbol when disassembling
|
|
|
|
* the code.
|
|
|
|
* With the added nop in between this cannot happen.
|
2016-06-30 10:40:25 +00:00
|
|
|
*/
|
|
|
|
nop 0
|
2011-01-05 11:47:25 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2024-02-05 20:32:13 +00:00
|
|
|
* Scheduler resume function, called by __switch_to
|
|
|
|
* gpr2 = (task_struct *)prev
|
|
|
|
* gpr3 = (task_struct *)next
|
2005-04-16 22:20:36 +00:00
|
|
|
* Returns:
|
|
|
|
* gpr2 = prev
|
|
|
|
*/
|
2024-02-05 20:32:13 +00:00
|
|
|
SYM_FUNC_START(__switch_to_asm)
|
2012-05-15 07:20:06 +00:00
|
|
|
stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
|
2017-11-16 13:54:04 +00:00
|
|
|
lghi %r4,__TASK_stack
|
|
|
|
lghi %r1,__TASK_thread
|
2023-03-27 09:37:22 +00:00
|
|
|
llill %r5,STACK_INIT_OFFSET
|
2017-11-16 13:54:04 +00:00
|
|
|
stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev
|
2018-10-26 13:29:59 +00:00
|
|
|
lg %r15,0(%r4,%r3) # start of kernel stack of next
|
|
|
|
agr %r15,%r5 # end of kernel stack of next
|
2012-05-15 07:20:06 +00:00
|
|
|
stg %r3,__LC_CURRENT # store task struct of next
|
|
|
|
stg %r15,__LC_KERNEL_STACK # store end of kernel stack
|
2017-11-16 13:54:04 +00: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 10:55:07 +00:00
|
|
|
lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40
|
2018-04-20 14:49:46 +00:00
|
|
|
BR_EX %r14
|
2024-02-05 20:32:13 +00:00
|
|
|
SYM_FUNC_END(__switch_to_asm)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2015-06-22 15:26:40 +00:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
/*
|
2022-10-20 14:31:56 +00:00
|
|
|
* __sie64a calling convention:
|
|
|
|
* %r2 pointer to sie control block phys
|
|
|
|
* %r3 pointer to sie control block virt
|
|
|
|
* %r4 guest register save area
|
2015-06-22 15:26:40 +00:00
|
|
|
*/
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_FUNC_START(__sie64a)
|
2015-06-22 15:26:40 +00:00
|
|
|
stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers
|
2018-01-16 06:36:46 +00:00
|
|
|
lg %r12,__LC_CURRENT
|
2022-10-20 14:31:56 +00:00
|
|
|
stg %r2,__SF_SIE_CONTROL_PHYS(%r15) # save sie block physical..
|
|
|
|
stg %r3,__SF_SIE_CONTROL(%r15) # ...and virtual addresses
|
|
|
|
stg %r4,__SF_SIE_SAVEAREA(%r15) # save guest register save area
|
2018-03-20 12:33:43 +00:00
|
|
|
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
|
2022-10-20 14:31:56 +00:00
|
|
|
lmg %r0,%r13,0(%r4) # load guest gprs 0-13
|
2015-06-22 15:26:40 +00:00
|
|
|
lg %r14,__LC_GMAP # get gmap pointer
|
|
|
|
ltgr %r14,%r14
|
|
|
|
jz .Lsie_gmap
|
2024-02-20 13:21:14 +00:00
|
|
|
oi __LC_CPU_FLAGS+7,_CIF_SIE
|
2015-06-22 15:26:40 +00:00
|
|
|
lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
|
|
|
|
.Lsie_gmap:
|
2018-03-20 12:33:43 +00:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-06-22 15:26:40 +00:00
|
|
|
oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
|
|
|
|
tm __SIE_PROG20+3(%r14),3 # last exit...
|
|
|
|
jnz .Lsie_skip
|
2022-10-20 14:31:56 +00:00
|
|
|
lg %r14,__SF_SIE_CONTROL_PHYS(%r15) # get sie block phys addr
|
2023-02-28 12:57:48 +00:00
|
|
|
BPEXIT __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
2017-06-07 09:30:42 +00:00
|
|
|
.Lsie_entry:
|
2015-06-22 15:26:40 +00:00
|
|
|
sie 0(%r14)
|
2022-05-23 10:38:14 +00:00
|
|
|
# Let the next instruction be NOP to avoid triggering a machine check
|
|
|
|
# and handling it in a guest as result of the instruction execution.
|
|
|
|
nopr 7
|
|
|
|
.Lsie_leave:
|
2018-01-16 06:11:45 +00:00
|
|
|
BPOFF
|
2023-02-28 12:57:48 +00:00
|
|
|
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
2015-06-22 15:26:40 +00:00
|
|
|
.Lsie_skip:
|
2022-10-20 14:31:56 +00:00
|
|
|
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
|
2015-06-22 15:26:40 +00:00
|
|
|
ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
|
2020-11-16 07:06:40 +00:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE # load primary asce
|
2024-02-20 13:21:14 +00:00
|
|
|
ni __LC_CPU_FLAGS+7,255-_CIF_SIE
|
2015-06-22 15:26:40 +00:00
|
|
|
# some program checks are suppressing. C code (e.g. do_protection_exception)
|
2017-05-15 12:11:03 +00: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.
|
2022-10-20 14:31:56 +00:00
|
|
|
# Other instructions between __sie64a and .Lsie_done should not cause program
|
2017-05-15 12:11:03 +00:00
|
|
|
# interrupts. So lets use 3 nops as a landing pad for all possible rewinds.
|
|
|
|
.Lrewind_pad6:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad4:
|
|
|
|
nopr 7
|
|
|
|
.Lrewind_pad2:
|
|
|
|
nopr 7
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_INNER_LABEL(sie_exit, SYM_L_GLOBAL)
|
2018-03-20 12:33:43 +00:00
|
|
|
lg %r14,__SF_SIE_SAVEAREA(%r15) # load guest register save area
|
2015-06-22 15:26:40 +00:00
|
|
|
stmg %r0,%r13,0(%r14) # save guest gprs 0-13
|
2018-01-16 12:27:30 +00: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 15:26:40 +00:00
|
|
|
lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
|
2018-03-20 12:33:43 +00:00
|
|
|
lg %r2,__SF_SIE_REASON(%r15) # return exit reason code
|
2018-04-20 14:49:46 +00:00
|
|
|
BR_EX %r14
|
2015-06-22 15:26:40 +00:00
|
|
|
.Lsie_fault:
|
|
|
|
lghi %r14,-EFAULT
|
2018-03-20 12:33:43 +00:00
|
|
|
stg %r14,__SF_SIE_REASON(%r15) # set exit reason code
|
2015-06-22 15:26:40 +00:00
|
|
|
j sie_exit
|
|
|
|
|
2017-05-15 12:11:03 +00:00
|
|
|
EX_TABLE(.Lrewind_pad6,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad4,.Lsie_fault)
|
|
|
|
EX_TABLE(.Lrewind_pad2,.Lsie_fault)
|
2015-06-22 15:26:40 +00:00
|
|
|
EX_TABLE(sie_exit,.Lsie_fault)
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_FUNC_END(__sie64a)
|
2022-10-20 14:31:56 +00:00
|
|
|
EXPORT_SYMBOL(__sie64a)
|
2016-01-12 18:30:03 +00:00
|
|
|
EXPORT_SYMBOL(sie_exit)
|
2015-06-22 15:26:40 +00:00
|
|
|
#endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* SVC interrupt handler routine. System calls are synchronous events and
|
2020-07-07 12:07:53 +00:00
|
|
|
* are entered with interrupts disabled.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(system_call)
|
2020-11-21 10:14:56 +00:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
2018-01-16 06:11:45 +00:00
|
|
|
BPOFF
|
2020-11-21 10:14:56 +00:00
|
|
|
lghi %r14,0
|
2014-12-03 16:00:08 +00:00
|
|
|
.Lsysc_per:
|
2021-04-07 07:20:17 +00:00
|
|
|
STBEAR __LC_LAST_BREAK
|
2020-11-16 07:06:40 +00:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2011-12-27 10:27:15 +00:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
2020-12-04 16:56:57 +00:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2020-11-21 10:14:56 +00:00
|
|
|
stmg %r0,%r7,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
2018-03-05 19:18:47 +00:00
|
|
|
# clear user controlled register to prevent speculative use
|
|
|
|
xgr %r0,%r0
|
2020-11-21 10:14:56 +00: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
|
2021-05-05 20:01:09 +00:00
|
|
|
mvc __PT_R8(64,%r2),__LC_SAVE_AREA_SYNC
|
2021-04-07 07:20:17 +00:00
|
|
|
MBEAR %r2
|
2020-11-21 10:14:56 +00:00
|
|
|
lgr %r3,%r14
|
|
|
|
brasl %r14,__do_syscall
|
2023-03-27 09:37:28 +00:00
|
|
|
STACKLEAK_ERASE
|
2020-11-16 07:06:40 +00:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2020-11-21 10:14:56 +00:00
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
2023-02-28 12:57:48 +00:00
|
|
|
BPON
|
2021-04-07 07:20:17 +00:00
|
|
|
LBEAR STACK_FRAME_OVERHEAD+__PT_LAST_BREAK(%r15)
|
2020-11-21 10:14:56 +00:00
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
2011-12-27 10:27:15 +00:00
|
|
|
stpt __LC_EXIT_TIMER
|
2021-04-07 07:20:17 +00:00
|
|
|
LPSWEY __LC_RETURN_PSW,__LC_RETURN_LPSWE
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(system_call)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# a new process exits the kernel with ret_from_fork
|
|
|
|
#
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(ret_from_fork)
|
2020-11-21 10:14:56 +00:00
|
|
|
lgr %r3,%r11
|
|
|
|
brasl %r14,__ret_from_fork
|
2023-03-27 09:37:28 +00:00
|
|
|
STACKLEAK_ERASE
|
2020-11-21 10:14:56 +00:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
2023-02-28 12:57:48 +00:00
|
|
|
BPON
|
2021-04-07 07:20:17 +00:00
|
|
|
LBEAR STACK_FRAME_OVERHEAD+__PT_LAST_BREAK(%r15)
|
2020-11-21 10:14:56 +00:00
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
|
|
|
stpt __LC_EXIT_TIMER
|
2021-04-07 07:20:17 +00:00
|
|
|
LPSWEY __LC_RETURN_PSW,__LC_RETURN_LPSWE
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(ret_from_fork)
|
2019-01-17 09:02:22 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Program check handler routine
|
|
|
|
*/
|
|
|
|
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(pgm_check_handler)
|
2020-11-21 10:14:56 +00:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2018-01-16 06:11:45 +00:00
|
|
|
BPOFF
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_SYNC
|
2024-03-13 08:51:22 +00:00
|
|
|
lgr %r10,%r15
|
2011-12-27 10:27:15 +00:00
|
|
|
lmg %r8,%r9,__LC_PGM_OLD_PSW
|
2020-11-16 07:06:40 +00:00
|
|
|
tmhh %r8,0x0001 # coming from user space?
|
|
|
|
jno .Lpgm_skip_asce
|
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2020-11-21 10:14:56 +00:00
|
|
|
j 3f # -> fault in user space
|
2020-11-16 07:06:40 +00:00
|
|
|
.Lpgm_skip_asce:
|
2020-01-22 12:38:22 +00:00
|
|
|
1: tmhh %r8,0x4000 # PER bit set in old PSW ?
|
|
|
|
jnz 2f # -> enabled, can't be a double fault
|
2011-12-27 10:27:15 +00:00
|
|
|
tm __LC_PGM_ILC+3,0x80 # check for per exception
|
2014-12-03 16:00:08 +00:00
|
|
|
jnz .Lpgm_svcper # -> single stepped svc
|
2020-01-22 12:38:22 +00:00
|
|
|
2: CHECK_STACK __LC_SAVE_AREA_SYNC
|
2013-04-24 08:20:43 +00:00
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
2020-11-21 10:14:56 +00:00
|
|
|
# CHECK_VMAP_STACK branches to stack_overflow or 4f
|
|
|
|
CHECK_VMAP_STACK __LC_SAVE_AREA_SYNC,4f
|
2023-02-28 12:57:48 +00:00
|
|
|
3: lg %r15,__LC_KERNEL_STACK
|
2020-11-21 10:14:56 +00:00
|
|
|
4: la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2024-03-13 08:51:22 +00:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2020-11-21 10:14:56 +00:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2020-11-21 10:14:56 +00:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
|
2021-04-07 07:20:17 +00:00
|
|
|
mvc __PT_LAST_BREAK(8,%r11),__LC_PGM_LAST_BREAK
|
2024-03-13 08:51:22 +00:00
|
|
|
stctg %c1,%c1,__PT_CR1(%r11)
|
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
|
|
lg %r12,__LC_GMAP
|
|
|
|
clc __GMAP_ASCE(8,%r12), __PT_CR1(%r11)
|
|
|
|
jne 5f
|
|
|
|
BPENTER __SF_SIE_FLAGS(%r10),_TIF_ISOLATE_BP_GUEST
|
|
|
|
SIEEXIT __SF_SIE_CONTROL(%r10)
|
|
|
|
#endif
|
|
|
|
5: stmg %r8,%r9,__PT_PSW(%r11)
|
2018-01-16 12:27:30 +00: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 10:14:56 +00:00
|
|
|
lgr %r2,%r11
|
|
|
|
brasl %r14,__do_pgm_check
|
|
|
|
tmhh %r8,0x0001 # returning to user space?
|
|
|
|
jno .Lpgm_exit_kernel
|
2023-03-27 09:37:28 +00:00
|
|
|
STACKLEAK_ERASE
|
2020-11-21 10:14:56 +00:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2023-02-28 12:57:48 +00:00
|
|
|
BPON
|
2020-11-11 17:46:26 +00:00
|
|
|
stpt __LC_EXIT_TIMER
|
2020-11-21 10:14:56 +00:00
|
|
|
.Lpgm_exit_kernel:
|
|
|
|
mvc __LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
|
2021-04-07 07:20:17 +00:00
|
|
|
LBEAR STACK_FRAME_OVERHEAD+__PT_LAST_BREAK(%r15)
|
2020-11-21 10:14:56 +00:00
|
|
|
lmg %r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
|
2021-04-07 07:20:17 +00:00
|
|
|
LPSWEY __LC_RETURN_PSW,__LC_RETURN_LPSWE
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-09-20 13:58:39 +00:00
|
|
|
#
|
2011-12-27 10:27:15 +00:00
|
|
|
# single stepped system call
|
2006-09-20 13:58:39 +00:00
|
|
|
#
|
2014-12-03 16:00:08 +00:00
|
|
|
.Lpgm_svcper:
|
2011-12-27 10:27:15 +00:00
|
|
|
mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW
|
2014-12-03 16:00:08 +00:00
|
|
|
larl %r14,.Lsysc_per
|
2011-12-27 10:27:15 +00:00
|
|
|
stg %r14,__LC_RETURN_PSW+8
|
2020-11-21 10:14:56 +00:00
|
|
|
lghi %r14,1
|
2021-04-07 07:20:17 +00:00
|
|
|
LBEAR __LC_PGM_LAST_BREAK
|
|
|
|
LPSWEY __LC_RETURN_PSW,__LC_RETURN_LPSWE # branch to .Lsysc_per
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(pgm_check_handler)
|
2006-09-20 13:58:39 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2020-11-21 10:14:56 +00:00
|
|
|
* Interrupt handler macro used for external and IO interrupts.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2020-11-21 10:14:56 +00:00
|
|
|
.macro INT_HANDLER name,lc_old_psw,handler
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(\name)
|
2022-02-25 09:38:23 +00:00
|
|
|
stckf __LC_INT_CLOCK
|
2020-11-21 10:14:56 +00:00
|
|
|
stpt __LC_SYS_ENTER_TIMER
|
2021-04-07 07:20:17 +00:00
|
|
|
STBEAR __LC_LAST_BREAK
|
2018-01-16 06:11:45 +00:00
|
|
|
BPOFF
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
|
2020-11-21 10:14:56 +00:00
|
|
|
lmg %r8,%r9,\lc_old_psw
|
2021-01-28 12:06:05 +00:00
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
|
|
|
jnz 1f
|
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2024-02-20 13:21:14 +00:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_SIE
|
|
|
|
jz 0f
|
2023-02-28 12:57:48 +00:00
|
|
|
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
2024-03-13 08:51:22 +00:00
|
|
|
SIEEXIT __SF_SIE_CONTROL(%r15)
|
2021-01-28 12:06:05 +00:00
|
|
|
#endif
|
|
|
|
0: CHECK_STACK __LC_SAVE_AREA_ASYNC
|
|
|
|
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
|
|
|
j 2f
|
2023-02-28 12:57:48 +00:00
|
|
|
1: lctlg %c1,%c1,__LC_KERNEL_ASCE
|
2021-01-28 12:06:05 +00:00
|
|
|
lg %r15,__LC_KERNEL_STACK
|
2021-04-08 22:13:18 +00:00
|
|
|
2: xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 12:27:30 +00: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
|
2021-06-11 14:08:18 +00:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2011-12-27 10:27:15 +00:00
|
|
|
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
|
2021-04-07 07:20:17 +00:00
|
|
|
MBEAR %r11
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2022-05-03 12:59:16 +00:00
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2020-11-21 10:14:56 +00:00
|
|
|
brasl %r14,\handler
|
2011-12-27 10:27:15 +00:00
|
|
|
mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
|
2020-11-21 10:14:56 +00:00
|
|
|
tmhh %r8,0x0001 # returning to user ?
|
|
|
|
jno 2f
|
2023-03-27 09:37:28 +00:00
|
|
|
STACKLEAK_ERASE
|
2020-11-16 07:06:40 +00:00
|
|
|
lctlg %c1,%c1,__LC_USER_ASCE
|
2023-02-28 12:57:48 +00:00
|
|
|
BPON
|
2011-12-27 10:27:15 +00:00
|
|
|
stpt __LC_EXIT_TIMER
|
2021-04-07 07:20:17 +00:00
|
|
|
2: LBEAR __PT_LAST_BREAK(%r11)
|
|
|
|
lmg %r0,%r15,__PT_R0(%r11)
|
|
|
|
LPSWEY __LC_RETURN_PSW,__LC_RETURN_LPSWE
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(\name)
|
2020-11-21 10:14:56 +00:00
|
|
|
.endm
|
2016-01-26 13:10:34 +00:00
|
|
|
|
2020-11-21 10:14:56 +00: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-16 22:20:36 +00:00
|
|
|
|
2012-03-11 15:59:27 +00:00
|
|
|
/*
|
2020-02-20 11:09:36 +00:00
|
|
|
* Load idle PSW.
|
2012-03-11 15:59:27 +00:00
|
|
|
*/
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_FUNC_START(psw_idle)
|
2021-04-08 22:15:21 +00:00
|
|
|
stg %r14,(__SF_GPRS+8*8)(%r15)
|
2012-07-20 09:15:08 +00:00
|
|
|
stg %r3,__SF_EMPTY(%r15)
|
2020-11-21 10:14:56 +00:00
|
|
|
larl %r1,psw_idle_exit
|
2012-03-11 15:59:27 +00:00
|
|
|
stg %r1,__SF_EMPTY+8(%r15)
|
2015-09-18 14:41:36 +00:00
|
|
|
larl %r1,smp_cpu_mtid
|
|
|
|
llgf %r1,0(%r1)
|
|
|
|
ltgr %r1,%r1
|
|
|
|
jz .Lpsw_idle_stcctm
|
2020-11-21 10:14:56 +00:00
|
|
|
.insn rsy,0xeb0000000017,%r1,5,__MT_CYCLES_ENTER(%r2)
|
2015-09-18 14:41:36 +00:00
|
|
|
.Lpsw_idle_stcctm:
|
2015-11-19 10:09:45 +00:00
|
|
|
oi __LC_CPU_FLAGS+7,_CIF_ENABLED_WAIT
|
2018-01-16 06:11:45 +00:00
|
|
|
BPON
|
2022-02-25 09:38:23 +00:00
|
|
|
stckf __CLOCK_IDLE_ENTER(%r2)
|
2012-07-20 09:15:08 +00:00
|
|
|
stpt __TIMER_IDLE_ENTER(%r2)
|
2012-03-11 15:59:27 +00:00
|
|
|
lpswe __SF_EMPTY(%r15)
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_INNER_LABEL(psw_idle_exit, SYM_L_GLOBAL)
|
2018-04-20 14:49:46 +00:00
|
|
|
BR_EX %r14
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_FUNC_END(psw_idle)
|
2012-03-11 15:59:27 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Machine check handler routines
|
|
|
|
*/
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(mcck_int_handler)
|
2018-01-16 06:11:45 +00:00
|
|
|
BPOFF
|
2011-12-27 10:27:15 +00:00
|
|
|
lmg %r8,%r9,__LC_MCK_OLD_PSW
|
2015-10-01 15:02:48 +00:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_SYSTEM_DAMAGE
|
2014-12-03 16:00:08 +00:00
|
|
|
jo .Lmcck_panic # yes -> rest of mcck code invalid
|
2017-10-12 11:24:48 +00:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_CR_VALID
|
|
|
|
jno .Lmcck_panic # control registers invalid -> panic
|
|
|
|
ptlb
|
2021-06-18 06:17:18 +00:00
|
|
|
lghi %r14,__LC_CPU_TIMER_SAVE_AREA
|
2011-12-27 10:27:15 +00:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2015-10-01 15:02:48 +00:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_CPU_TIMER_VALID
|
2011-12-27 10:27:15 +00:00
|
|
|
jo 3f
|
2020-11-21 10:14:56 +00:00
|
|
|
la %r14,__LC_SYS_ENTER_TIMER
|
|
|
|
clc 0(8,%r14),__LC_EXIT_TIMER
|
2011-12-27 10:27:15 +00:00
|
|
|
jl 1f
|
2006-06-29 12:58:05 +00:00
|
|
|
la %r14,__LC_EXIT_TIMER
|
2011-12-27 10:27:15 +00:00
|
|
|
1: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER
|
|
|
|
jl 2f
|
2006-06-29 12:58:05 +00:00
|
|
|
la %r14,__LC_LAST_UPDATE_TIMER
|
2011-12-27 10:27:15 +00:00
|
|
|
2: spt 0(%r14)
|
2010-05-17 08:00:03 +00:00
|
|
|
mvc __LC_MCCK_ENTER_TIMER(8),0(%r14)
|
2017-10-12 11:24:48 +00:00
|
|
|
3: TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_MWP_VALID
|
|
|
|
jno .Lmcck_panic
|
|
|
|
tmhh %r8,0x0001 # interrupting from user ?
|
2022-11-29 16:22:14 +00:00
|
|
|
jnz .Lmcck_user
|
2017-10-12 11:24:48 +00:00
|
|
|
TSTMSK __LC_MCCK_CODE,MCCK_CODE_PSW_IA_VALID
|
|
|
|
jno .Lmcck_panic
|
2021-01-28 12:06:05 +00:00
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
2024-02-20 13:21:14 +00:00
|
|
|
TSTMSK __LC_CPU_FLAGS,_CIF_SIE
|
|
|
|
jz .Lmcck_user
|
|
|
|
# Need to compare the address instead of a CIF_SIE* flag.
|
|
|
|
# Otherwise there would be a race between setting the flag
|
|
|
|
# and entering SIE (or leaving and clearing the flag). This
|
|
|
|
# would cause machine checks targeted at the guest to be
|
|
|
|
# handled by the host.
|
2024-02-20 14:18:56 +00:00
|
|
|
larl %r14,.Lsie_entry
|
|
|
|
clgrjl %r9,%r14, 4f
|
|
|
|
larl %r14,.Lsie_leave
|
|
|
|
clgrjhe %r9,%r14, 4f
|
2021-05-17 06:18:13 +00:00
|
|
|
oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
|
2023-02-28 12:57:48 +00:00
|
|
|
4: BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
2024-03-13 08:51:22 +00:00
|
|
|
SIEEXIT __SF_SIE_CONTROL(%r15)
|
2021-06-22 17:06:18 +00:00
|
|
|
#endif
|
2022-11-29 16:22:14 +00:00
|
|
|
.Lmcck_user:
|
2021-02-03 08:02:51 +00:00
|
|
|
lg %r15,__LC_MCCK_STACK
|
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2021-02-03 08:16:45 +00:00
|
|
|
stctg %c1,%c1,__PT_CR1(%r11)
|
2021-01-28 12:06:05 +00:00
|
|
|
lctlg %c1,%c1,__LC_KERNEL_ASCE
|
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
2013-02-28 15:28:41 +00:00
|
|
|
lghi %r14,__LC_GPREGS_SAVE_AREA+64
|
|
|
|
stmg %r0,%r7,__PT_R0(%r11)
|
2018-01-16 12:27:30 +00: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 15:28:41 +00:00
|
|
|
mvc __PT_R8(64,%r11),0(%r14)
|
2011-12-27 10:27:15 +00:00
|
|
|
stmg %r8,%r9,__PT_PSW(%r11)
|
2014-04-15 10:55:07 +00:00
|
|
|
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
2011-12-27 10:27:15 +00:00
|
|
|
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
|
|
|
lgr %r2,%r11 # pass pointer to pt_regs
|
2005-06-25 21:55:30 +00:00
|
|
|
brasl %r14,s390_do_machine_check
|
2020-11-16 07:06:40 +00:00
|
|
|
lctlg %c1,%c1,__PT_CR1(%r11)
|
2011-12-27 10:27:15 +00:00
|
|
|
lmg %r0,%r10,__PT_R0(%r11)
|
|
|
|
mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW
|
2006-06-29 12:58:05 +00:00
|
|
|
tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ?
|
|
|
|
jno 0f
|
2023-02-28 12:57:48 +00:00
|
|
|
BPON
|
2006-06-29 12:58:05 +00:00
|
|
|
stpt __LC_EXIT_TIMER
|
2022-05-11 12:05:25 +00:00
|
|
|
0: ALTERNATIVE "nop", __stringify(lghi %r12,__LC_LAST_BREAK_SAVE_AREA),193
|
2021-04-07 07:20:17 +00:00
|
|
|
LBEAR 0(%r12)
|
|
|
|
lmg %r11,%r15,__PT_R11(%r11)
|
|
|
|
LPSWEY __LC_RETURN_MCCK_PSW,__LC_RETURN_MCCK_LPSWE
|
2011-12-27 10:27:15 +00:00
|
|
|
|
2014-12-03 16:00:08 +00:00
|
|
|
.Lmcck_panic:
|
2021-06-18 06:17:15 +00:00
|
|
|
/*
|
|
|
|
* Iterate over all possible CPU addresses in the range 0..0xffff
|
|
|
|
* and stop each CPU using signal processor. Use compare and swap
|
|
|
|
* to allow just one CPU-stopper and prevent concurrent CPUs from
|
|
|
|
* stopping each other while leaving the others running.
|
|
|
|
*/
|
|
|
|
lhi %r5,0
|
|
|
|
lhi %r6,1
|
2023-04-17 12:45:15 +00:00
|
|
|
larl %r7,stop_lock
|
2021-06-18 06:17:15 +00:00
|
|
|
cs %r5,%r6,0(%r7) # single CPU-stopper only
|
|
|
|
jnz 4f
|
2023-04-17 12:45:15 +00:00
|
|
|
larl %r7,this_cpu
|
2021-06-18 06:17:15 +00:00
|
|
|
stap 0(%r7) # this CPU address
|
|
|
|
lh %r4,0(%r7)
|
|
|
|
nilh %r4,0
|
|
|
|
lhi %r0,1
|
|
|
|
sll %r0,16 # CPU counter
|
|
|
|
lhi %r3,0 # next CPU address
|
|
|
|
0: cr %r3,%r4
|
|
|
|
je 2f
|
|
|
|
1: sigp %r1,%r3,SIGP_STOP # stop next CPU
|
|
|
|
brc SIGP_CC_BUSY,1b
|
|
|
|
2: ahi %r3,1
|
|
|
|
brct %r0,0b
|
|
|
|
3: sigp %r1,%r4,SIGP_STOP # stop this CPU
|
|
|
|
brc SIGP_CC_BUSY,3b
|
|
|
|
4: j 4b
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(mcck_int_handler)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(restart_int_handler)
|
2022-05-11 12:05:25 +00:00
|
|
|
ALTERNATIVE "nop", "lpp _LPP_OFFSET", 40
|
2018-03-26 13:23:33 +00:00
|
|
|
stg %r15,__LC_SAVE_AREA_RESTART
|
2021-08-24 13:30:21 +00:00
|
|
|
TSTMSK __LC_RESTART_FLAGS,RESTART_FLAG_CTLREGS,4
|
|
|
|
jz 0f
|
2023-03-28 09:09:09 +00:00
|
|
|
lctlg %c0,%c15,__LC_CREGS_SAVE_AREA
|
2023-04-18 15:40:37 +00:00
|
|
|
0: larl %r15,daton_psw
|
|
|
|
lpswe 0(%r15) # turn dat on, keep irqs off
|
|
|
|
.Ldaton:
|
2012-03-11 15:59:26 +00:00
|
|
|
lg %r15,__LC_RESTART_STACK
|
2017-09-12 14:37:33 +00: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 15:59:26 +00:00
|
|
|
xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15)
|
2012-06-05 07:59:52 +00:00
|
|
|
lg %r1,__LC_RESTART_FN # load fn, parm & source cpu
|
|
|
|
lg %r2,__LC_RESTART_DATA
|
2021-08-24 13:30:21 +00:00
|
|
|
lgf %r3,__LC_RESTART_SOURCE
|
2012-03-11 15:59:26 +00:00
|
|
|
ltgr %r3,%r3 # test source cpu address
|
|
|
|
jm 1f # negative -> skip source stop
|
2012-06-04 13:05:43 +00:00
|
|
|
0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu
|
2012-03-11 15:59:26 +00: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 13:05:43 +00:00
|
|
|
2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu
|
2012-03-11 15:59:26 +00:00
|
|
|
brc 2,2b
|
|
|
|
3: j 3b
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(restart_int_handler)
|
2011-08-03 14:44:19 +00:00
|
|
|
|
2011-01-05 11:47:25 +00:00
|
|
|
.section .kprobes.text, "ax"
|
|
|
|
|
2017-09-12 14:37:33 +00:00
|
|
|
#if defined(CONFIG_CHECK_STACK) || defined(CONFIG_VMAP_STACK)
|
2005-04-16 22:20:36 +00: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.
|
|
|
|
*/
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_START(stack_overflow)
|
2017-09-12 14:37:33 +00:00
|
|
|
lg %r15,__LC_NODAT_STACK # change to panic stack
|
2013-04-24 08:20:43 +00:00
|
|
|
la %r11,STACK_FRAME_OVERHEAD(%r15)
|
2011-12-27 10:27:15 +00: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-16 22:20:36 +00:00
|
|
|
jg kernel_stack_overflow
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_CODE_END(stack_overflow)
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
2021-06-18 06:17:15 +00:00
|
|
|
.section .data, "aw"
|
2023-04-17 12:45:15 +00:00
|
|
|
.balign 4
|
|
|
|
SYM_DATA_LOCAL(stop_lock, .long 0)
|
|
|
|
SYM_DATA_LOCAL(this_cpu, .short 0)
|
2023-04-18 15:40:37 +00:00
|
|
|
.balign 8
|
|
|
|
SYM_DATA_START_LOCAL(daton_psw)
|
|
|
|
.quad PSW_KERNEL_BITS
|
|
|
|
.quad .Ldaton
|
|
|
|
SYM_DATA_END(daton_psw)
|
2023-04-17 12:45:15 +00:00
|
|
|
|
2015-02-13 13:44:29 +00:00
|
|
|
.section .rodata, "a"
|
2019-02-03 20:36:13 +00:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390x_ ## esame
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_DATA_START(sys_call_table)
|
2017-12-11 13:47:27 +00:00
|
|
|
#include "asm/syscall_table.h"
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_DATA_END(sys_call_table)
|
2005-04-16 22:20:36 +00:00
|
|
|
#undef SYSCALL
|
|
|
|
|
2006-01-06 08:19:28 +00:00
|
|
|
#ifdef CONFIG_COMPAT
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2019-02-03 20:36:13 +00:00
|
|
|
#define SYSCALL(esame,emu) .quad __s390_ ## emu
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_DATA_START(sys_call_table_emu)
|
2017-12-11 13:47:27 +00:00
|
|
|
#include "asm/syscall_table.h"
|
2023-04-17 12:45:15 +00:00
|
|
|
SYM_DATA_END(sys_call_table_emu)
|
2005-04-16 22:20:36 +00:00
|
|
|
#undef SYSCALL
|
|
|
|
#endif
|