mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 08:02:17 +00: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>
252 lines
8.0 KiB
C
252 lines
8.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include <asm/cache.h>
|
|
|
|
#include "entry.h"
|
|
#include <asm/native/inst.h>
|
|
|
|
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
|
|
/* read ar.itc in advance, and use it before leaving bank 0 */
|
|
#define ACCOUNT_GET_STAMP \
|
|
(pUStk) mov.m r20=ar.itc;
|
|
#define ACCOUNT_SYS_ENTER \
|
|
(pUStk) br.call.spnt rp=account_sys_enter \
|
|
;;
|
|
#else
|
|
#define ACCOUNT_GET_STAMP
|
|
#define ACCOUNT_SYS_ENTER
|
|
#endif
|
|
|
|
.section ".data..patch.rse", "a"
|
|
.previous
|
|
|
|
/*
|
|
* DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
|
|
* the minimum state necessary that allows us to turn psr.ic back
|
|
* on.
|
|
*
|
|
* Assumed state upon entry:
|
|
* psr.ic: off
|
|
* r31: contains saved predicates (pr)
|
|
*
|
|
* Upon exit, the state is as follows:
|
|
* psr.ic: off
|
|
* r2 = points to &pt_regs.r16
|
|
* r8 = contents of ar.ccv
|
|
* r9 = contents of ar.csd
|
|
* r10 = contents of ar.ssd
|
|
* r11 = FPSR_DEFAULT
|
|
* r12 = kernel sp (kernel virtual address)
|
|
* r13 = points to current task_struct (kernel virtual address)
|
|
* p15 = TRUE if psr.i is set in cr.ipsr
|
|
* predicate registers (other than p2, p3, and p15), b6, r3, r14, r15:
|
|
* preserved
|
|
*
|
|
* Note that psr.ic is NOT turned on by this macro. This is so that
|
|
* we can pass interruption state as arguments to a handler.
|
|
*/
|
|
#define IA64_NATIVE_DO_SAVE_MIN(__COVER,SAVE_IFS,EXTRA,WORKAROUND) \
|
|
mov r16=IA64_KR(CURRENT); /* M */ \
|
|
mov r27=ar.rsc; /* M */ \
|
|
mov r20=r1; /* A */ \
|
|
mov r25=ar.unat; /* M */ \
|
|
MOV_FROM_IPSR(p0,r29); /* M */ \
|
|
mov r26=ar.pfs; /* I */ \
|
|
MOV_FROM_IIP(r28); /* M */ \
|
|
mov r21=ar.fpsr; /* M */ \
|
|
__COVER; /* B;; (or nothing) */ \
|
|
;; \
|
|
adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16; \
|
|
;; \
|
|
ld1 r17=[r16]; /* load current->thread.on_ustack flag */ \
|
|
st1 [r16]=r0; /* clear current->thread.on_ustack flag */ \
|
|
adds r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 \
|
|
/* switch from user to kernel RBS: */ \
|
|
;; \
|
|
invala; /* M */ \
|
|
SAVE_IFS; \
|
|
cmp.eq pKStk,pUStk=r0,r17; /* are we in kernel mode already? */ \
|
|
;; \
|
|
(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \
|
|
;; \
|
|
(pUStk) mov.m r24=ar.rnat; \
|
|
(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of RBS */ \
|
|
(pKStk) mov r1=sp; /* get sp */ \
|
|
;; \
|
|
(pUStk) lfetch.fault.excl.nt1 [r22]; \
|
|
(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \
|
|
(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \
|
|
;; \
|
|
(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \
|
|
(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \
|
|
;; \
|
|
(pUStk) mov r18=ar.bsp; \
|
|
(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \
|
|
adds r17=2*L1_CACHE_BYTES,r1; /* really: biggest cache-line size */ \
|
|
adds r16=PT(CR_IPSR),r1; \
|
|
;; \
|
|
lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES; \
|
|
st8 [r16]=r29; /* save cr.ipsr */ \
|
|
;; \
|
|
lfetch.fault.excl.nt1 [r17]; \
|
|
tbit.nz p15,p0=r29,IA64_PSR_I_BIT; \
|
|
mov r29=b0 \
|
|
;; \
|
|
WORKAROUND; \
|
|
adds r16=PT(R8),r1; /* initialize first base pointer */ \
|
|
adds r17=PT(R9),r1; /* initialize second base pointer */ \
|
|
(pKStk) mov r18=r0; /* make sure r18 isn't NaT */ \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r8,16; \
|
|
.mem.offset 8,0; st8.spill [r17]=r9,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r10,24; \
|
|
.mem.offset 8,0; st8.spill [r17]=r11,24; \
|
|
;; \
|
|
st8 [r16]=r28,16; /* save cr.iip */ \
|
|
st8 [r17]=r30,16; /* save cr.ifs */ \
|
|
(pUStk) sub r18=r18,r22; /* r18=RSE.ndirty*8 */ \
|
|
mov r8=ar.ccv; \
|
|
mov r9=ar.csd; \
|
|
mov r10=ar.ssd; \
|
|
movl r11=FPSR_DEFAULT; /* L-unit */ \
|
|
;; \
|
|
st8 [r16]=r25,16; /* save ar.unat */ \
|
|
st8 [r17]=r26,16; /* save ar.pfs */ \
|
|
shl r18=r18,16; /* compute ar.rsc to be used for "loadrs" */ \
|
|
;; \
|
|
st8 [r16]=r27,16; /* save ar.rsc */ \
|
|
(pUStk) st8 [r17]=r24,16; /* save ar.rnat */ \
|
|
(pKStk) adds r17=16,r17; /* skip over ar_rnat field */ \
|
|
;; /* avoid RAW on r16 & r17 */ \
|
|
(pUStk) st8 [r16]=r23,16; /* save ar.bspstore */ \
|
|
st8 [r17]=r31,16; /* save predicates */ \
|
|
(pKStk) adds r16=16,r16; /* skip over ar_bspstore field */ \
|
|
;; \
|
|
st8 [r16]=r29,16; /* save b0 */ \
|
|
st8 [r17]=r18,16; /* save ar.rsc value for "loadrs" */ \
|
|
cmp.eq pNonSys,pSys=r0,r0 /* initialize pSys=0, pNonSys=1 */ \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r20,16; /* save original r1 */ \
|
|
.mem.offset 8,0; st8.spill [r17]=r12,16; \
|
|
adds r12=-16,r1; /* switch to kernel memory stack (with 16 bytes of scratch) */ \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r13,16; \
|
|
.mem.offset 8,0; st8.spill [r17]=r21,16; /* save ar.fpsr */ \
|
|
mov r13=IA64_KR(CURRENT); /* establish `current' */ \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r15,16; \
|
|
.mem.offset 8,0; st8.spill [r17]=r14,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r16]=r2,16; \
|
|
.mem.offset 8,0; st8.spill [r17]=r3,16; \
|
|
ACCOUNT_GET_STAMP \
|
|
adds r2=IA64_PT_REGS_R16_OFFSET,r1; \
|
|
;; \
|
|
EXTRA; \
|
|
movl r1=__gp; /* establish kernel global pointer */ \
|
|
;; \
|
|
ACCOUNT_SYS_ENTER \
|
|
bsw.1; /* switch back to bank 1 (must be last in insn group) */ \
|
|
;;
|
|
|
|
/*
|
|
* SAVE_REST saves the remainder of pt_regs (with psr.ic on).
|
|
*
|
|
* Assumed state upon entry:
|
|
* psr.ic: on
|
|
* r2: points to &pt_regs.r16
|
|
* r3: points to &pt_regs.r17
|
|
* r8: contents of ar.ccv
|
|
* r9: contents of ar.csd
|
|
* r10: contents of ar.ssd
|
|
* r11: FPSR_DEFAULT
|
|
*
|
|
* Registers r14 and r15 are guaranteed not to be touched by SAVE_REST.
|
|
*/
|
|
#define SAVE_REST \
|
|
.mem.offset 0,0; st8.spill [r2]=r16,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r17,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r18,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r19,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r20,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r21,16; \
|
|
mov r18=b6; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r22,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r23,16; \
|
|
mov r19=b7; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r24,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r25,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r26,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r27,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r28,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r29,16; \
|
|
;; \
|
|
.mem.offset 0,0; st8.spill [r2]=r30,16; \
|
|
.mem.offset 8,0; st8.spill [r3]=r31,32; \
|
|
;; \
|
|
mov ar.fpsr=r11; /* M-unit */ \
|
|
st8 [r2]=r8,8; /* ar.ccv */ \
|
|
adds r24=PT(B6)-PT(F7),r3; \
|
|
;; \
|
|
stf.spill [r2]=f6,32; \
|
|
stf.spill [r3]=f7,32; \
|
|
;; \
|
|
stf.spill [r2]=f8,32; \
|
|
stf.spill [r3]=f9,32; \
|
|
;; \
|
|
stf.spill [r2]=f10; \
|
|
stf.spill [r3]=f11; \
|
|
adds r25=PT(B7)-PT(F11),r3; \
|
|
;; \
|
|
st8 [r24]=r18,16; /* b6 */ \
|
|
st8 [r25]=r19,16; /* b7 */ \
|
|
;; \
|
|
st8 [r24]=r9; /* ar.csd */ \
|
|
st8 [r25]=r10; /* ar.ssd */ \
|
|
;;
|
|
|
|
#define RSE_WORKAROUND \
|
|
(pUStk) extr.u r17=r18,3,6; \
|
|
(pUStk) sub r16=r18,r22; \
|
|
[1:](pKStk) br.cond.sptk.many 1f; \
|
|
.xdata4 ".data..patch.rse",1b-. \
|
|
;; \
|
|
cmp.ge p6,p7 = 33,r17; \
|
|
;; \
|
|
(p6) mov r17=0x310; \
|
|
(p7) mov r17=0x308; \
|
|
;; \
|
|
cmp.leu p1,p0=r16,r17; \
|
|
(p1) br.cond.sptk.many 1f; \
|
|
dep.z r17=r26,0,62; \
|
|
movl r16=2f; \
|
|
;; \
|
|
mov ar.pfs=r17; \
|
|
dep r27=r0,r27,16,14; \
|
|
mov b0=r16; \
|
|
;; \
|
|
br.ret.sptk b0; \
|
|
;; \
|
|
2: \
|
|
mov ar.rsc=r0 \
|
|
;; \
|
|
flushrs; \
|
|
;; \
|
|
mov ar.bspstore=r22 \
|
|
;; \
|
|
mov r18=ar.bsp; \
|
|
;; \
|
|
1: \
|
|
.pred.rel "mutex", pKStk, pUStk
|
|
|
|
#define SAVE_MIN_WITH_COVER DO_SAVE_MIN(COVER, mov r30=cr.ifs, , RSE_WORKAROUND)
|
|
#define SAVE_MIN_WITH_COVER_R19 DO_SAVE_MIN(COVER, mov r30=cr.ifs, mov r15=r19, RSE_WORKAROUND)
|
|
#define SAVE_MIN DO_SAVE_MIN( , mov r30=r0, , )
|