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
|
2008-01-30 12:32:54 +00:00
|
|
|
/*
|
|
|
|
* sleep.c - x86-specific ACPI sleep support.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2003 Patrick Mochel
|
2010-07-18 12:27:13 +00:00
|
|
|
* Copyright (C) 2001-2003 Pavel Machek <pavel@ucw.cz>
|
2008-01-30 12:32:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
2010-08-25 20:39:17 +00:00
|
|
|
#include <linux/memblock.h>
|
2008-01-30 12:32:54 +00:00
|
|
|
#include <linux/dmi.h>
|
|
|
|
#include <linux/cpumask.h>
|
2020-06-09 04:32:42 +00:00
|
|
|
#include <linux/pgtable.h>
|
2008-07-17 18:29:24 +00:00
|
|
|
#include <asm/segment.h>
|
2008-10-16 23:26:27 +00:00
|
|
|
#include <asm/desc.h>
|
2011-02-07 05:16:09 +00:00
|
|
|
#include <asm/cacheflush.h>
|
2012-05-08 18:22:29 +00:00
|
|
|
#include <asm/realmode.h>
|
2010-08-28 13:58:33 +00:00
|
|
|
|
2016-03-03 00:05:29 +00:00
|
|
|
#include <linux/ftrace.h>
|
2012-05-08 18:22:42 +00:00
|
|
|
#include "../../realmode/rm/wakeup.h"
|
2008-04-10 21:28:10 +00:00
|
|
|
#include "sleep.h"
|
2008-01-30 12:32:54 +00:00
|
|
|
|
|
|
|
unsigned long acpi_realmode_flags;
|
|
|
|
|
2008-08-03 17:25:48 +00:00
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
|
2008-10-09 16:56:21 +00:00
|
|
|
static char temp_stack[4096];
|
2008-04-10 21:28:10 +00:00
|
|
|
#endif
|
2008-01-30 12:32:54 +00:00
|
|
|
|
2019-11-26 16:54:17 +00:00
|
|
|
/**
|
|
|
|
* acpi_get_wakeup_address - provide physical address for S3 wakeup
|
|
|
|
*
|
|
|
|
* Returns the physical address where the kernel should be resumed after the
|
|
|
|
* system awakes from S3, e.g. for programming into the firmware waking vector.
|
|
|
|
*/
|
|
|
|
unsigned long acpi_get_wakeup_address(void)
|
|
|
|
{
|
|
|
|
return ((unsigned long)(real_mode_header->wakeup_start));
|
|
|
|
}
|
|
|
|
|
2013-10-31 01:31:18 +00:00
|
|
|
/**
|
|
|
|
* x86_acpi_enter_sleep_state - enter sleep state
|
|
|
|
* @state: Sleep state to enter.
|
|
|
|
*
|
2021-03-18 14:28:01 +00:00
|
|
|
* Wrapper around acpi_enter_sleep_state() to be called by assembly.
|
2013-10-31 01:31:18 +00:00
|
|
|
*/
|
2020-03-03 20:41:44 +00:00
|
|
|
asmlinkage acpi_status __visible x86_acpi_enter_sleep_state(u8 state)
|
2013-10-31 01:31:18 +00:00
|
|
|
{
|
|
|
|
return acpi_enter_sleep_state(state);
|
|
|
|
}
|
|
|
|
|
2008-01-30 12:32:54 +00:00
|
|
|
/**
|
2013-05-14 17:09:16 +00:00
|
|
|
* x86_acpi_suspend_lowlevel - save kernel state
|
2008-01-30 12:32:54 +00:00
|
|
|
*
|
|
|
|
* Create an identity mapped page table and copy the wakeup routine to
|
|
|
|
* low memory.
|
|
|
|
*/
|
2013-05-14 17:09:16 +00:00
|
|
|
int x86_acpi_suspend_lowlevel(void)
|
2008-01-30 12:32:54 +00:00
|
|
|
{
|
2012-05-08 18:22:29 +00:00
|
|
|
struct wakeup_header *header =
|
2012-05-08 18:22:41 +00:00
|
|
|
(struct wakeup_header *) __va(real_mode_header->wakeup_header);
|
2008-04-10 21:28:10 +00:00
|
|
|
|
2011-02-14 23:42:46 +00:00
|
|
|
if (header->signature != WAKEUP_HEADER_SIGNATURE) {
|
2008-04-10 21:28:10 +00:00
|
|
|
printk(KERN_ERR "wakeup header does not match\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
header->video_mode = saved_video_mode;
|
|
|
|
|
2012-09-26 22:02:34 +00:00
|
|
|
header->pmode_behavior = 0;
|
|
|
|
|
2008-04-10 21:28:10 +00:00
|
|
|
#ifndef CONFIG_64BIT
|
2013-04-05 20:42:23 +00:00
|
|
|
native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
|
2008-04-10 21:28:10 +00:00
|
|
|
|
2013-07-12 23:48:12 +00:00
|
|
|
/*
|
|
|
|
* We have to check that we can write back the value, and not
|
|
|
|
* just read it. At least on 90 nm Pentium M (Family 6, Model
|
|
|
|
* 13), reading an invalid MSR is not guaranteed to trap, see
|
|
|
|
* Erratum X4 in "Intel Pentium M Processor on 90 nm Process
|
|
|
|
* with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90
|
|
|
|
* nm process with 512-KB L2 Cache Specification Update".
|
|
|
|
*/
|
2012-09-26 22:02:34 +00:00
|
|
|
if (!rdmsr_safe(MSR_EFER,
|
|
|
|
&header->pmode_efer_low,
|
2013-07-12 23:48:12 +00:00
|
|
|
&header->pmode_efer_high) &&
|
|
|
|
!wrmsr_safe(MSR_EFER,
|
|
|
|
header->pmode_efer_low,
|
|
|
|
header->pmode_efer_high))
|
2012-09-26 22:02:34 +00:00
|
|
|
header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
|
2008-04-10 21:28:10 +00:00
|
|
|
#endif /* !CONFIG_64BIT */
|
|
|
|
|
|
|
|
header->pmode_cr0 = read_cr0();
|
2012-09-26 22:02:34 +00:00
|
|
|
if (__this_cpu_read(cpu_info.cpuid_level) >= 0) {
|
2014-10-24 22:58:08 +00:00
|
|
|
header->pmode_cr4 = __read_cr4();
|
2012-09-26 22:02:34 +00:00
|
|
|
header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4);
|
|
|
|
}
|
x86, suspend: Restore MISC_ENABLE MSR in realmode wakeup
Some BIOSes will reset the Intel MISC_ENABLE MSR (specifically the
XD_DISABLE bit) when resuming from S3, which can interact poorly with
ebba638ae723d8a8fc2f7abce5ec18b688b791d7. In 32bit PAE mode, this can
lead to a fault when EFER is restored by the kernel wakeup routines,
due to it setting the NX bit for a CPU that (thanks to the BIOS reset)
now incorrectly thinks it lacks the NX feature. (64bit is not affected
because it uses a common CPU bring-up that specifically handles the
XD_DISABLE bit.)
The need for MISC_ENABLE being restored so early is specific to the S3
resume path. Normally, MISC_ENABLE is saved in save_processor_state(),
but this happens after the resume header is created, so just reproduce
the logic here. (acpi_suspend_lowlevel() creates the header, calls
do_suspend_lowlevel, which calls save_processor_state(), so the saved
processor context isn't available during resume header creation.)
[ hpa: Consider for stable if OK in mainline ]
Signed-off-by: Kees Cook <kees.cook@canonical.com>
Link: http://lkml.kernel.org/r/20110707011034.GA8523@outflux.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: <stable@kernel.org> 2.6.38+
2011-07-07 01:10:34 +00:00
|
|
|
if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
|
|
|
|
&header->pmode_misc_en_low,
|
2013-07-12 23:48:12 +00:00
|
|
|
&header->pmode_misc_en_high) &&
|
|
|
|
!wrmsr_safe(MSR_IA32_MISC_ENABLE,
|
|
|
|
header->pmode_misc_en_low,
|
|
|
|
header->pmode_misc_en_high))
|
x86, suspend: Restore MISC_ENABLE MSR in realmode wakeup
Some BIOSes will reset the Intel MISC_ENABLE MSR (specifically the
XD_DISABLE bit) when resuming from S3, which can interact poorly with
ebba638ae723d8a8fc2f7abce5ec18b688b791d7. In 32bit PAE mode, this can
lead to a fault when EFER is restored by the kernel wakeup routines,
due to it setting the NX bit for a CPU that (thanks to the BIOS reset)
now incorrectly thinks it lacks the NX feature. (64bit is not affected
because it uses a common CPU bring-up that specifically handles the
XD_DISABLE bit.)
The need for MISC_ENABLE being restored so early is specific to the S3
resume path. Normally, MISC_ENABLE is saved in save_processor_state(),
but this happens after the resume header is created, so just reproduce
the logic here. (acpi_suspend_lowlevel() creates the header, calls
do_suspend_lowlevel, which calls save_processor_state(), so the saved
processor context isn't available during resume header creation.)
[ hpa: Consider for stable if OK in mainline ]
Signed-off-by: Kees Cook <kees.cook@canonical.com>
Link: http://lkml.kernel.org/r/20110707011034.GA8523@outflux.net
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: <stable@kernel.org> 2.6.38+
2011-07-07 01:10:34 +00:00
|
|
|
header->pmode_behavior |=
|
|
|
|
(1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
|
2008-04-10 21:28:10 +00:00
|
|
|
header->realmode_flags = acpi_realmode_flags;
|
|
|
|
header->real_magic = 0x12345678;
|
|
|
|
|
|
|
|
#ifndef CONFIG_64BIT
|
|
|
|
header->pmode_entry = (u32)&wakeup_pmode_return;
|
2012-11-16 21:57:43 +00:00
|
|
|
header->pmode_cr3 = (u32)__pa_symbol(initial_page_table);
|
2008-04-10 21:28:10 +00:00
|
|
|
saved_magic = 0x12345678;
|
|
|
|
#else /* CONFIG_64BIT */
|
2008-06-13 18:31:54 +00:00
|
|
|
#ifdef CONFIG_SMP
|
2016-08-18 15:59:03 +00:00
|
|
|
initial_stack = (unsigned long)temp_stack + sizeof(temp_stack);
|
2008-10-16 23:26:27 +00:00
|
|
|
early_gdt_descr.address =
|
2017-03-14 17:05:07 +00:00
|
|
|
(unsigned long)get_cpu_gdt_rw(smp_processor_id());
|
2009-01-13 11:41:35 +00:00
|
|
|
initial_gs = per_cpu_offset(smp_processor_id());
|
2008-06-13 18:31:54 +00:00
|
|
|
#endif
|
2008-04-10 21:28:10 +00:00
|
|
|
initial_code = (unsigned long)wakeup_long64;
|
2009-04-18 11:44:57 +00:00
|
|
|
saved_magic = 0x123456789abcdef0L;
|
2008-04-10 21:28:10 +00:00
|
|
|
#endif /* CONFIG_64BIT */
|
2008-01-30 12:32:54 +00:00
|
|
|
|
2016-03-03 00:05:29 +00:00
|
|
|
/*
|
|
|
|
* Pause/unpause graph tracing around do_suspend_lowlevel as it has
|
|
|
|
* inconsistent call/return info after it jumps to the wakeup vector.
|
|
|
|
*/
|
|
|
|
pause_graph_tracing();
|
2011-02-08 22:42:22 +00:00
|
|
|
do_suspend_lowlevel();
|
2016-03-03 00:05:29 +00:00
|
|
|
unpause_graph_tracing();
|
2008-01-30 12:32:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __init acpi_sleep_setup(char *str)
|
|
|
|
{
|
|
|
|
while ((str != NULL) && (*str != '\0')) {
|
|
|
|
if (strncmp(str, "s3_bios", 7) == 0)
|
|
|
|
acpi_realmode_flags |= 1;
|
|
|
|
if (strncmp(str, "s3_mode", 7) == 0)
|
|
|
|
acpi_realmode_flags |= 2;
|
|
|
|
if (strncmp(str, "s3_beep", 7) == 0)
|
|
|
|
acpi_realmode_flags |= 4;
|
2008-07-24 04:28:41 +00:00
|
|
|
#ifdef CONFIG_HIBERNATION
|
2021-11-08 16:09:41 +00:00
|
|
|
if (strncmp(str, "s4_hwsig", 8) == 0)
|
|
|
|
acpi_check_s4_hw_signature(1);
|
2008-07-24 04:28:41 +00:00
|
|
|
if (strncmp(str, "s4_nohwsig", 10) == 0)
|
2021-11-08 16:09:41 +00:00
|
|
|
acpi_check_s4_hw_signature(0);
|
2008-07-24 04:28:41 +00:00
|
|
|
#endif
|
2010-07-23 20:59:09 +00:00
|
|
|
if (strncmp(str, "nonvs", 5) == 0)
|
|
|
|
acpi_nvs_nosave();
|
2012-10-26 11:39:15 +00:00
|
|
|
if (strncmp(str, "nonvs_s3", 8) == 0)
|
|
|
|
acpi_nvs_nosave_s3();
|
2008-06-12 21:24:06 +00:00
|
|
|
if (strncmp(str, "old_ordering", 12) == 0)
|
|
|
|
acpi_old_suspend_ordering();
|
2017-11-15 01:16:55 +00:00
|
|
|
if (strncmp(str, "nobl", 4) == 0)
|
|
|
|
acpi_sleep_no_blacklist();
|
2008-01-30 12:32:54 +00:00
|
|
|
str = strchr(str, ',');
|
|
|
|
if (str != NULL)
|
|
|
|
str += strspn(str, ", \t");
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
__setup("acpi_sleep=", acpi_sleep_setup);
|