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 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2008-07-29 01:53:57 +07:00
|
|
|
#include <linux/hardirq.h>
|
|
|
|
|
2009-08-20 14:59:09 +07:00
|
|
|
#include <asm/x86_init.h>
|
|
|
|
|
2008-07-29 01:53:57 +07:00
|
|
|
#include <xen/interface/xen.h>
|
|
|
|
#include <xen/interface/sched.h>
|
|
|
|
#include <xen/interface/vcpu.h>
|
2013-12-12 03:36:51 +07:00
|
|
|
#include <xen/features.h>
|
2012-09-14 20:37:32 +07:00
|
|
|
#include <xen/events.h>
|
2008-07-29 01:53:57 +07:00
|
|
|
|
|
|
|
#include <asm/xen/hypercall.h>
|
|
|
|
#include <asm/xen/hypervisor.h>
|
|
|
|
|
|
|
|
#include "xen-ops.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Force a proper event-channel callback from Xen after clearing the
|
|
|
|
* callback mask. We do this in a very simple manner, by making a call
|
|
|
|
* down into Xen. The pending flag will be checked by Xen on return.
|
|
|
|
*/
|
|
|
|
void xen_force_evtchn_callback(void)
|
|
|
|
{
|
|
|
|
(void)HYPERVISOR_xen_version(0, NULL);
|
|
|
|
}
|
|
|
|
|
2014-05-02 05:44:37 +07:00
|
|
|
asmlinkage __visible unsigned long xen_save_fl(void)
|
2008-07-29 01:53:57 +07:00
|
|
|
{
|
|
|
|
struct vcpu_info *vcpu;
|
|
|
|
unsigned long flags;
|
|
|
|
|
2012-01-13 22:53:35 +07:00
|
|
|
vcpu = this_cpu_read(xen_vcpu);
|
2008-07-29 01:53:57 +07:00
|
|
|
|
|
|
|
/* flag has opposite sense of mask */
|
|
|
|
flags = !vcpu->evtchn_upcall_mask;
|
|
|
|
|
|
|
|
/* convert to IF type flag
|
|
|
|
-0 -> 0x00000000
|
|
|
|
-1 -> 0xffffffff
|
|
|
|
*/
|
|
|
|
return (-flags) & X86_EFLAGS_IF;
|
|
|
|
}
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
PV_CALLEE_SAVE_REGS_THUNK(xen_save_fl);
|
2008-07-29 01:53:57 +07:00
|
|
|
|
2013-10-22 23:07:56 +07:00
|
|
|
__visible void xen_restore_fl(unsigned long flags)
|
2008-07-29 01:53:57 +07:00
|
|
|
{
|
|
|
|
struct vcpu_info *vcpu;
|
|
|
|
|
|
|
|
/* convert from IF type flag */
|
|
|
|
flags = !(flags & X86_EFLAGS_IF);
|
|
|
|
|
2013-08-15 19:21:04 +07:00
|
|
|
/* See xen_irq_enable() for why preemption must be disabled. */
|
2008-07-29 01:53:57 +07:00
|
|
|
preempt_disable();
|
2012-01-13 22:53:35 +07:00
|
|
|
vcpu = this_cpu_read(xen_vcpu);
|
2008-07-29 01:53:57 +07:00
|
|
|
vcpu->evtchn_upcall_mask = flags;
|
|
|
|
|
|
|
|
if (flags == 0) {
|
|
|
|
barrier(); /* unmask then check (avoid races) */
|
|
|
|
if (unlikely(vcpu->evtchn_upcall_pending))
|
|
|
|
xen_force_evtchn_callback();
|
2013-08-15 19:21:04 +07:00
|
|
|
preempt_enable();
|
|
|
|
} else
|
|
|
|
preempt_enable_no_resched();
|
2008-07-29 01:53:57 +07:00
|
|
|
}
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
PV_CALLEE_SAVE_REGS_THUNK(xen_restore_fl);
|
2008-07-29 01:53:57 +07:00
|
|
|
|
2014-05-02 05:44:37 +07:00
|
|
|
asmlinkage __visible void xen_irq_disable(void)
|
2008-07-29 01:53:57 +07:00
|
|
|
{
|
|
|
|
/* There's a one instruction preempt window here. We need to
|
|
|
|
make sure we're don't switch CPUs between getting the vcpu
|
|
|
|
pointer and updating the mask. */
|
|
|
|
preempt_disable();
|
2012-01-13 22:53:35 +07:00
|
|
|
this_cpu_read(xen_vcpu)->evtchn_upcall_mask = 1;
|
2008-07-29 01:53:57 +07:00
|
|
|
preempt_enable_no_resched();
|
|
|
|
}
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
PV_CALLEE_SAVE_REGS_THUNK(xen_irq_disable);
|
2008-07-29 01:53:57 +07:00
|
|
|
|
2014-05-02 05:44:37 +07:00
|
|
|
asmlinkage __visible void xen_irq_enable(void)
|
2008-07-29 01:53:57 +07:00
|
|
|
{
|
|
|
|
struct vcpu_info *vcpu;
|
|
|
|
|
2013-08-15 19:21:04 +07:00
|
|
|
/*
|
|
|
|
* We may be preempted as soon as vcpu->evtchn_upcall_mask is
|
|
|
|
* cleared, so disable preemption to ensure we check for
|
|
|
|
* events on the VCPU we are still running on.
|
|
|
|
*/
|
|
|
|
preempt_disable();
|
2008-07-29 01:53:57 +07:00
|
|
|
|
2012-01-13 22:53:35 +07:00
|
|
|
vcpu = this_cpu_read(xen_vcpu);
|
2008-07-29 01:53:57 +07:00
|
|
|
vcpu->evtchn_upcall_mask = 0;
|
|
|
|
|
|
|
|
/* Doesn't matter if we get preempted here, because any
|
|
|
|
pending event will get dealt with anyway. */
|
|
|
|
|
|
|
|
barrier(); /* unmask then check (avoid races) */
|
|
|
|
if (unlikely(vcpu->evtchn_upcall_pending))
|
|
|
|
xen_force_evtchn_callback();
|
2013-08-15 19:21:04 +07:00
|
|
|
|
|
|
|
preempt_enable();
|
2008-07-29 01:53:57 +07:00
|
|
|
}
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
PV_CALLEE_SAVE_REGS_THUNK(xen_irq_enable);
|
2008-07-29 01:53:57 +07:00
|
|
|
|
|
|
|
static void xen_safe_halt(void)
|
|
|
|
{
|
|
|
|
/* Blocking includes an implicit local_irq_enable(). */
|
|
|
|
if (HYPERVISOR_sched_op(SCHEDOP_block, NULL) != 0)
|
|
|
|
BUG();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xen_halt(void)
|
|
|
|
{
|
|
|
|
if (irqs_disabled())
|
2016-06-30 22:56:38 +07:00
|
|
|
HYPERVISOR_vcpu_op(VCPUOP_down,
|
|
|
|
xen_vcpu_nr(smp_processor_id()), NULL);
|
2008-07-29 01:53:57 +07:00
|
|
|
else
|
|
|
|
xen_safe_halt();
|
|
|
|
}
|
|
|
|
|
2011-05-05 01:16:07 +07:00
|
|
|
static const struct pv_irq_ops xen_irq_ops __initconst = {
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
.save_fl = PV_CALLEE_SAVE(xen_save_fl),
|
|
|
|
.restore_fl = PV_CALLEE_SAVE(xen_restore_fl),
|
|
|
|
.irq_disable = PV_CALLEE_SAVE(xen_irq_disable),
|
|
|
|
.irq_enable = PV_CALLEE_SAVE(xen_irq_enable),
|
|
|
|
|
2008-07-29 01:53:57 +07:00
|
|
|
.safe_halt = xen_safe_halt,
|
|
|
|
.halt = xen_halt,
|
|
|
|
};
|
|
|
|
|
2011-01-09 11:00:36 +07:00
|
|
|
void __init xen_init_irq_ops(void)
|
2008-07-29 01:53:57 +07:00
|
|
|
{
|
2013-12-12 03:36:51 +07:00
|
|
|
/* For PVH we use default pv_irq_ops settings. */
|
|
|
|
if (!xen_feature(XENFEAT_hvm_callback_vector))
|
|
|
|
pv_irq_ops = xen_irq_ops;
|
2009-08-20 14:59:09 +07:00
|
|
|
x86_init.irqs.intr_init = xen_init_IRQ;
|
2008-07-29 01:53:57 +07:00
|
|
|
}
|