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 */
|
2013-02-22 00:49:24 +07:00
|
|
|
#ifndef __ARM_MPU_H
|
|
|
|
#define __ARM_MPU_H
|
|
|
|
|
|
|
|
/* MPUIR layout */
|
|
|
|
#define MPUIR_nU 1
|
|
|
|
#define MPUIR_DREGION 8
|
|
|
|
#define MPUIR_IREGION 16
|
|
|
|
#define MPUIR_DREGION_SZMASK (0xFF << MPUIR_DREGION)
|
|
|
|
#define MPUIR_IREGION_SZMASK (0xFF << MPUIR_IREGION)
|
|
|
|
|
|
|
|
/* ID_MMFR0 data relevant to MPU */
|
|
|
|
#define MMFR0_PMSA (0xF << 4)
|
|
|
|
#define MMFR0_PMSAv7 (3 << 4)
|
2018-04-03 16:39:23 +07:00
|
|
|
#define MMFR0_PMSAv8 (4 << 4)
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
/* MPU D/I Size Register fields */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_RSR_SZ 1
|
|
|
|
#define PMSAv7_RSR_EN 0
|
|
|
|
#define PMSAv7_RSR_SD 8
|
ARM: 8712/1: NOMMU: Use more MPU regions to cover memory
PMSAv7 defines curious alignment requirements to the regions:
- size must be power of 2, and
- region start must be aligned to the region size
Because of that we currently adjust lowmem bounds plus we assign
only one MPU region to cover memory all these lead to significant amount of
memory could be wasted. As an example, consider 64Mb of memory at
0x70000000 - it fits alignment requirements nicely; now, imagine that
2Mb of memory is reserved for coherent DMA allocation, so now Linux is
expected to see 62Mb of memory... and here annoying thing happens -
memory gets truncated to 32Mb (we've lost 30Mb!), i.e. MPU layout
looks like:
0: base 0x70000000, size 0x2000000
This patch tries to allocate as much as possible MPU slots to minimise
amount of truncated memory. Moreover, with this patch MPU subregions
starting to get used. MPU subregions allow us reduce the number of MPU
slots used. For example given above, MPU layout looks like:
0: base 0x70000000, size 0x2000000
1: base 0x72000000, size 0x1000000
2: base 0x73000000, size 0x1000000, disable subreg 7 (0x73e00000 - 0x73ffffff)
Where without subregions we'd get:
0: base 0x70000000, size 0x2000000
1: base 0x72000000, size 0x1000000
2: base 0x73000000, size 0x800000
3: base 0x73800000, size 0x400000
4: base 0x73c00000, size 0x200000
To achieve better layout we fist try to cover specified memory as is
(maybe with help of subregions) and if we failed, we truncate memory
to fit alignment requirements (so it occupies one MPU slot) and
perform one more attempt with the reminder, and so on till we either
cover all memory or run out of MPU slots.
Tested-by: Szemző András <sza@esh.hu>
Tested-by: Alexandre TORGUE <alexandre.torgue@st.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2017-10-16 18:59:15 +07:00
|
|
|
|
|
|
|
/* Number of subregions (SD) */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_NR_SUBREGS 8
|
|
|
|
#define PMSAv7_MIN_SUBREG_SIZE 256
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
/* The D/I RSR value for an enabled region spanning the whole of memory */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_RSR_ALL_MEM 63
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
/* Individual bits in the DR/IR ACR */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_ACR_XN (1 << 12)
|
|
|
|
#define PMSAv7_ACR_SHARED (1 << 2)
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
/* C, B and TEX[2:0] bits only have semantic meanings when grouped */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_RGN_CACHEABLE 0xB
|
|
|
|
#define PMSAv7_RGN_SHARED_CACHEABLE (PMSAv7_RGN_CACHEABLE | PMSAv7_ACR_SHARED)
|
|
|
|
#define PMSAv7_RGN_STRONGLY_ORDERED 0
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
/* Main region should only be shared for SMP */
|
|
|
|
#ifdef CONFIG_SMP
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_RGN_NORMAL (PMSAv7_RGN_CACHEABLE | PMSAv7_ACR_SHARED)
|
2013-02-22 00:49:24 +07:00
|
|
|
#else
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_RGN_NORMAL PMSAv7_RGN_CACHEABLE
|
2013-02-22 00:49:24 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Access permission bits of ACR (only define those that we use)*/
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_AP_PL1RO_PL0NA (0x5 << 8)
|
|
|
|
#define PMSAv7_AP_PL1RW_PL0RW (0x3 << 8)
|
|
|
|
#define PMSAv7_AP_PL1RW_PL0R0 (0x2 << 8)
|
|
|
|
#define PMSAv7_AP_PL1RW_PL0NA (0x1 << 8)
|
2013-02-22 00:49:24 +07:00
|
|
|
|
2018-04-03 16:39:23 +07:00
|
|
|
#define PMSAv8_BAR_XN 1
|
|
|
|
|
|
|
|
#define PMSAv8_LAR_EN 1
|
|
|
|
#define PMSAv8_LAR_IDX(n) (((n) & 0x7) << 1)
|
|
|
|
|
|
|
|
|
|
|
|
#define PMSAv8_AP_PL1RW_PL0NA (0 << 1)
|
|
|
|
#define PMSAv8_AP_PL1RW_PL0RW (1 << 1)
|
|
|
|
#define PMSAv8_AP_PL1RO_PL0RO (3 << 1)
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
#define PMSAv8_RGN_SHARED (3 << 3) // inner sharable
|
|
|
|
#else
|
|
|
|
#define PMSAv8_RGN_SHARED (0 << 3)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define PMSAv8_RGN_DEVICE_nGnRnE 0
|
|
|
|
#define PMSAv8_RGN_NORMAL 1
|
|
|
|
|
|
|
|
#define PMSAv8_MAIR(attr, mt) ((attr) << ((mt) * 8))
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_V7M
|
|
|
|
#define PMSAv8_MINALIGN 32
|
|
|
|
#else
|
|
|
|
#define PMSAv8_MINALIGN 64
|
|
|
|
#endif
|
|
|
|
|
2013-02-22 00:49:24 +07:00
|
|
|
/* For minimal static MPU region configurations */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_PROBE_REGION 0
|
|
|
|
#define PMSAv7_BG_REGION 1
|
|
|
|
#define PMSAv7_RAM_REGION 2
|
|
|
|
#define PMSAv7_ROM_REGION 3
|
2013-02-22 00:49:24 +07:00
|
|
|
|
2018-04-03 16:39:23 +07:00
|
|
|
/* Fixed for PMSAv8 only */
|
|
|
|
#define PMSAv8_XIP_REGION 0
|
|
|
|
#define PMSAv8_KERNEL_REGION 1
|
|
|
|
|
2013-02-22 00:49:24 +07:00
|
|
|
/* Maximum number of regions Linux is interested in */
|
2018-04-03 16:36:37 +07:00
|
|
|
#define MPU_MAX_REGIONS 16
|
2013-02-22 00:49:24 +07:00
|
|
|
|
2018-04-03 16:36:37 +07:00
|
|
|
#define PMSAv7_DATA_SIDE 0
|
|
|
|
#define PMSAv7_INSTR_SIDE 1
|
2013-02-23 00:48:56 +07:00
|
|
|
|
2013-02-22 00:49:24 +07:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
struct mpu_rgn {
|
|
|
|
/* Assume same attributes for d/i-side */
|
2018-04-03 16:39:23 +07:00
|
|
|
union {
|
|
|
|
u32 drbar; /* PMSAv7 */
|
|
|
|
u32 prbar; /* PMSAv8 */
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
u32 drsr; /* PMSAv7 */
|
|
|
|
u32 prlar; /* PMSAv8 */
|
|
|
|
};
|
|
|
|
union {
|
|
|
|
u32 dracr; /* PMSAv7 */
|
|
|
|
u32 unused; /* not used in PMSAv8 */
|
|
|
|
};
|
2013-02-22 00:49:24 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mpu_rgn_info {
|
2017-10-16 18:54:05 +07:00
|
|
|
unsigned int used;
|
2013-02-22 00:49:24 +07:00
|
|
|
struct mpu_rgn rgns[MPU_MAX_REGIONS];
|
|
|
|
};
|
|
|
|
extern struct mpu_rgn_info mpu_rgn_info;
|
|
|
|
|
2017-10-16 18:52:35 +07:00
|
|
|
#ifdef CONFIG_ARM_MPU
|
2018-04-03 16:36:37 +07:00
|
|
|
extern void __init pmsav7_adjust_lowmem_bounds(void);
|
2018-04-03 16:39:23 +07:00
|
|
|
extern void __init pmsav8_adjust_lowmem_bounds(void);
|
|
|
|
|
2018-04-03 16:36:37 +07:00
|
|
|
extern void __init pmsav7_setup(void);
|
2018-04-03 16:39:23 +07:00
|
|
|
extern void __init pmsav8_setup(void);
|
2017-10-16 18:52:35 +07:00
|
|
|
#else
|
2018-04-03 16:36:37 +07:00
|
|
|
static inline void pmsav7_adjust_lowmem_bounds(void) {};
|
2018-04-03 16:39:23 +07:00
|
|
|
static inline void pmsav8_adjust_lowmem_bounds(void) {};
|
2018-04-03 16:36:37 +07:00
|
|
|
static inline void pmsav7_setup(void) {};
|
2018-04-03 16:39:23 +07:00
|
|
|
static inline void pmsav8_setup(void) {};
|
2018-04-03 16:36:37 +07:00
|
|
|
#endif
|
2017-10-16 18:52:35 +07:00
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
2013-02-22 00:49:24 +07:00
|
|
|
|
|
|
|
#endif
|