mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 10:05:18 +07:00
b24413180f
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>
208 lines
5.9 KiB
ArmAsm
208 lines
5.9 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Asm versions of Xen pv-ops, suitable for direct use.
|
|
*
|
|
* We only bother with direct forms (ie, vcpu in pda) of the
|
|
* operations here; the indirect forms are better handled in C.
|
|
*/
|
|
|
|
#include <asm/thread_info.h>
|
|
#include <asm/processor-flags.h>
|
|
#include <asm/segment.h>
|
|
#include <asm/asm.h>
|
|
|
|
#include <xen/interface/xen.h>
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
/* Pseudo-flag used for virtual NMI, which we don't implement yet */
|
|
#define XEN_EFLAGS_NMI 0x80000000
|
|
|
|
/*
|
|
* This is run where a normal iret would be run, with the same stack setup:
|
|
* 8: eflags
|
|
* 4: cs
|
|
* esp-> 0: eip
|
|
*
|
|
* This attempts to make sure that any pending events are dealt with
|
|
* on return to usermode, but there is a small window in which an
|
|
* event can happen just before entering usermode. If the nested
|
|
* interrupt ends up setting one of the TIF_WORK_MASK pending work
|
|
* flags, they will not be tested again before returning to
|
|
* usermode. This means that a process can end up with pending work,
|
|
* which will be unprocessed until the process enters and leaves the
|
|
* kernel again, which could be an unbounded amount of time. This
|
|
* means that a pending signal or reschedule event could be
|
|
* indefinitely delayed.
|
|
*
|
|
* The fix is to notice a nested interrupt in the critical window, and
|
|
* if one occurs, then fold the nested interrupt into the current
|
|
* interrupt stack frame, and re-process it iteratively rather than
|
|
* recursively. This means that it will exit via the normal path, and
|
|
* all pending work will be dealt with appropriately.
|
|
*
|
|
* Because the nested interrupt handler needs to deal with the current
|
|
* stack state in whatever form its in, we keep things simple by only
|
|
* using a single register which is pushed/popped on the stack.
|
|
*/
|
|
|
|
.macro POP_FS
|
|
1:
|
|
popw %fs
|
|
.pushsection .fixup, "ax"
|
|
2: movw $0, (%esp)
|
|
jmp 1b
|
|
.popsection
|
|
_ASM_EXTABLE(1b,2b)
|
|
.endm
|
|
|
|
ENTRY(xen_iret)
|
|
/* test eflags for special cases */
|
|
testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp)
|
|
jnz hyper_iret
|
|
|
|
push %eax
|
|
ESP_OFFSET=4 # bytes pushed onto stack
|
|
|
|
/* Store vcpu_info pointer for easy access */
|
|
#ifdef CONFIG_SMP
|
|
pushw %fs
|
|
movl $(__KERNEL_PERCPU), %eax
|
|
movl %eax, %fs
|
|
movl %fs:xen_vcpu, %eax
|
|
POP_FS
|
|
#else
|
|
movl %ss:xen_vcpu, %eax
|
|
#endif
|
|
|
|
/* check IF state we're restoring */
|
|
testb $X86_EFLAGS_IF>>8, 8+1+ESP_OFFSET(%esp)
|
|
|
|
/*
|
|
* Maybe enable events. Once this happens we could get a
|
|
* recursive event, so the critical region starts immediately
|
|
* afterwards. However, if that happens we don't end up
|
|
* resuming the code, so we don't have to be worried about
|
|
* being preempted to another CPU.
|
|
*/
|
|
setz %ss:XEN_vcpu_info_mask(%eax)
|
|
xen_iret_start_crit:
|
|
|
|
/* check for unmasked and pending */
|
|
cmpw $0x0001, %ss:XEN_vcpu_info_pending(%eax)
|
|
|
|
/*
|
|
* If there's something pending, mask events again so we can
|
|
* jump back into xen_hypervisor_callback. Otherwise do not
|
|
* touch XEN_vcpu_info_mask.
|
|
*/
|
|
jne 1f
|
|
movb $1, %ss:XEN_vcpu_info_mask(%eax)
|
|
|
|
1: popl %eax
|
|
|
|
/*
|
|
* From this point on the registers are restored and the stack
|
|
* updated, so we don't need to worry about it if we're
|
|
* preempted
|
|
*/
|
|
iret_restore_end:
|
|
|
|
/*
|
|
* Jump to hypervisor_callback after fixing up the stack.
|
|
* Events are masked, so jumping out of the critical region is
|
|
* OK.
|
|
*/
|
|
je xen_hypervisor_callback
|
|
|
|
1: iret
|
|
xen_iret_end_crit:
|
|
_ASM_EXTABLE(1b, iret_exc)
|
|
|
|
hyper_iret:
|
|
/* put this out of line since its very rarely used */
|
|
jmp hypercall_page + __HYPERVISOR_iret * 32
|
|
|
|
.globl xen_iret_start_crit, xen_iret_end_crit
|
|
|
|
/*
|
|
* This is called by xen_hypervisor_callback in entry.S when it sees
|
|
* that the EIP at the time of interrupt was between
|
|
* xen_iret_start_crit and xen_iret_end_crit. We're passed the EIP in
|
|
* %eax so we can do a more refined determination of what to do.
|
|
*
|
|
* The stack format at this point is:
|
|
* ----------------
|
|
* ss : (ss/esp may be present if we came from usermode)
|
|
* esp :
|
|
* eflags } outer exception info
|
|
* cs }
|
|
* eip }
|
|
* ---------------- <- edi (copy dest)
|
|
* eax : outer eax if it hasn't been restored
|
|
* ----------------
|
|
* eflags } nested exception info
|
|
* cs } (no ss/esp because we're nested
|
|
* eip } from the same ring)
|
|
* orig_eax }<- esi (copy src)
|
|
* - - - - - - - -
|
|
* fs }
|
|
* es }
|
|
* ds } SAVE_ALL state
|
|
* eax }
|
|
* : :
|
|
* ebx }<- esp
|
|
* ----------------
|
|
*
|
|
* In order to deliver the nested exception properly, we need to shift
|
|
* everything from the return addr up to the error code so it sits
|
|
* just under the outer exception info. This means that when we
|
|
* handle the exception, we do it in the context of the outer
|
|
* exception rather than starting a new one.
|
|
*
|
|
* The only caveat is that if the outer eax hasn't been restored yet
|
|
* (ie, it's still on stack), we need to insert its value into the
|
|
* SAVE_ALL state before going on, since it's usermode state which we
|
|
* eventually need to restore.
|
|
*/
|
|
ENTRY(xen_iret_crit_fixup)
|
|
/*
|
|
* Paranoia: Make sure we're really coming from kernel space.
|
|
* One could imagine a case where userspace jumps into the
|
|
* critical range address, but just before the CPU delivers a
|
|
* GP, it decides to deliver an interrupt instead. Unlikely?
|
|
* Definitely. Easy to avoid? Yes. The Intel documents
|
|
* explicitly say that the reported EIP for a bad jump is the
|
|
* jump instruction itself, not the destination, but some
|
|
* virtual environments get this wrong.
|
|
*/
|
|
movl PT_CS(%esp), %ecx
|
|
andl $SEGMENT_RPL_MASK, %ecx
|
|
cmpl $USER_RPL, %ecx
|
|
je 2f
|
|
|
|
lea PT_ORIG_EAX(%esp), %esi
|
|
lea PT_EFLAGS(%esp), %edi
|
|
|
|
/*
|
|
* If eip is before iret_restore_end then stack
|
|
* hasn't been restored yet.
|
|
*/
|
|
cmp $iret_restore_end, %eax
|
|
jae 1f
|
|
|
|
movl 0+4(%edi), %eax /* copy EAX (just above top of frame) */
|
|
movl %eax, PT_EAX(%esp)
|
|
|
|
lea ESP_OFFSET(%edi), %edi /* move dest up over saved regs */
|
|
|
|
/* set up the copy */
|
|
1: std
|
|
mov $PT_EIP / 4, %ecx /* saved regs up to orig_eax */
|
|
rep movsl
|
|
cld
|
|
|
|
lea 4(%edi), %esp /* point esp to new frame */
|
|
2: jmp xen_do_upcall
|
|
|