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 17:07:57 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 02:20:36 +04:00
|
|
|
#ifndef _M68K_CACHEFLUSH_H
|
|
|
|
#define _M68K_CACHEFLUSH_H
|
|
|
|
|
|
|
|
#include <linux/mm.h>
|
2011-10-17 08:38:09 +04:00
|
|
|
#ifdef CONFIG_COLDFIRE
|
|
|
|
#include <asm/mcfsim.h>
|
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-06-25 16:46:56 +04:00
|
|
|
/* cache code */
|
|
|
|
#define FLUSH_I_AND_D (0x00000808)
|
|
|
|
#define FLUSH_I (0x00000008)
|
|
|
|
|
2011-10-17 08:38:09 +04:00
|
|
|
#ifndef ICACHE_MAX_ADDR
|
|
|
|
#define ICACHE_MAX_ADDR 0
|
|
|
|
#define ICACHE_SET_MASK 0
|
|
|
|
#define DCACHE_MAX_ADDR 0
|
|
|
|
#define DCACHE_SETMASK 0
|
|
|
|
#endif
|
2012-07-10 07:33:24 +04:00
|
|
|
#ifndef CACHE_MODE
|
|
|
|
#define CACHE_MODE 0
|
|
|
|
#define CACR_ICINVA 0
|
|
|
|
#define CACR_DCINVA 0
|
|
|
|
#define CACR_BCINVA 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ColdFire architecture has no way to clear individual cache lines, so we
|
|
|
|
* are stuck invalidating all the cache entries when we want a clear operation.
|
|
|
|
*/
|
|
|
|
static inline void clear_cf_icache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"movec %0,%%cacr\n\t"
|
|
|
|
"nop"
|
|
|
|
:
|
|
|
|
: "r" (CACHE_MODE | CACR_ICINVA | CACR_BCINVA));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void clear_cf_dcache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"movec %0,%%cacr\n\t"
|
|
|
|
"nop"
|
|
|
|
:
|
|
|
|
: "r" (CACHE_MODE | CACR_DCINVA));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void clear_cf_bcache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"movec %0,%%cacr\n\t"
|
|
|
|
"nop"
|
|
|
|
:
|
|
|
|
: "r" (CACHE_MODE | CACR_ICINVA | CACR_BCINVA | CACR_DCINVA));
|
|
|
|
}
|
2011-10-17 08:38:09 +04:00
|
|
|
|
2012-07-10 07:33:24 +04:00
|
|
|
/*
|
|
|
|
* Use the ColdFire cpushl instruction to push (and invalidate) cache lines.
|
|
|
|
* The start and end addresses are cache line numbers not memory addresses.
|
|
|
|
*/
|
2011-10-17 08:38:09 +04:00
|
|
|
static inline void flush_cf_icache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
unsigned long set;
|
|
|
|
|
|
|
|
for (set = start; set <= end; set += (0x10 - 3)) {
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"cpushl %%ic,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%ic,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%ic,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%ic,(%0)"
|
|
|
|
: "=a" (set)
|
|
|
|
: "a" (set));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void flush_cf_dcache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
unsigned long set;
|
|
|
|
|
|
|
|
for (set = start; set <= end; set += (0x10 - 3)) {
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"cpushl %%dc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%dc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%dc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%dc,(%0)"
|
|
|
|
: "=a" (set)
|
|
|
|
: "a" (set));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void flush_cf_bcache(unsigned long start, unsigned long end)
|
|
|
|
{
|
|
|
|
unsigned long set;
|
|
|
|
|
|
|
|
for (set = start; set <= end; set += (0x10 - 3)) {
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"cpushl %%bc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%bc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%bc,(%0)\n\t"
|
|
|
|
"addq%.l #1,%0\n\t"
|
|
|
|
"cpushl %%bc,(%0)"
|
|
|
|
: "=a" (set)
|
|
|
|
: "a" (set));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Cache handling functions
|
|
|
|
*/
|
|
|
|
|
2006-06-25 16:46:56 +04:00
|
|
|
static inline void flush_icache(void)
|
|
|
|
{
|
2011-10-17 08:38:09 +04:00
|
|
|
if (CPU_IS_COLDFIRE) {
|
|
|
|
flush_cf_icache(0, ICACHE_MAX_ADDR);
|
|
|
|
} else if (CPU_IS_040_OR_060) {
|
2006-06-25 16:46:56 +04:00
|
|
|
asm volatile ( "nop\n"
|
|
|
|
" .chip 68040\n"
|
|
|
|
" cpusha %bc\n"
|
|
|
|
" .chip 68k");
|
2011-10-17 08:38:09 +04:00
|
|
|
} else {
|
2006-06-25 16:46:56 +04:00
|
|
|
unsigned long tmp;
|
|
|
|
asm volatile ( "movec %%cacr,%0\n"
|
|
|
|
" or.w %1,%0\n"
|
|
|
|
" movec %0,%%cacr"
|
|
|
|
: "=&d" (tmp)
|
|
|
|
: "id" (FLUSH_I));
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* invalidate the cache for the specified memory range.
|
|
|
|
* It starts at the physical address specified for
|
|
|
|
* the given number of bytes.
|
|
|
|
*/
|
|
|
|
extern void cache_clear(unsigned long paddr, int len);
|
|
|
|
/*
|
|
|
|
* push any dirty cache in the specified memory range.
|
|
|
|
* It starts at the physical address specified for
|
|
|
|
* the given number of bytes.
|
|
|
|
*/
|
|
|
|
extern void cache_push(unsigned long paddr, int len);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* push and invalidate pages in the specified user virtual
|
|
|
|
* memory range.
|
|
|
|
*/
|
|
|
|
extern void cache_push_v(unsigned long vaddr, int len);
|
|
|
|
|
|
|
|
/* This is needed whenever the virtual mapping of the current
|
|
|
|
process changes. */
|
|
|
|
#define __flush_cache_all() \
|
|
|
|
({ \
|
2011-10-17 08:38:09 +04:00
|
|
|
if (CPU_IS_COLDFIRE) { \
|
|
|
|
flush_cf_dcache(0, DCACHE_MAX_ADDR); \
|
|
|
|
} else if (CPU_IS_040_OR_060) { \
|
2005-04-17 02:20:36 +04:00
|
|
|
__asm__ __volatile__("nop\n\t" \
|
|
|
|
".chip 68040\n\t" \
|
|
|
|
"cpusha %dc\n\t" \
|
|
|
|
".chip 68k"); \
|
2011-10-17 08:38:09 +04:00
|
|
|
} else { \
|
2005-04-17 02:20:36 +04:00
|
|
|
unsigned long _tmp; \
|
|
|
|
__asm__ __volatile__("movec %%cacr,%0\n\t" \
|
|
|
|
"orw %1,%0\n\t" \
|
|
|
|
"movec %0,%%cacr" \
|
|
|
|
: "=&d" (_tmp) \
|
|
|
|
: "di" (FLUSH_I_AND_D)); \
|
|
|
|
} \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __flush_cache_030() \
|
|
|
|
({ \
|
|
|
|
if (CPU_IS_020_OR_030) { \
|
|
|
|
unsigned long _tmp; \
|
|
|
|
__asm__ __volatile__("movec %%cacr,%0\n\t" \
|
|
|
|
"orw %1,%0\n\t" \
|
|
|
|
"movec %0,%%cacr" \
|
|
|
|
: "=&d" (_tmp) \
|
|
|
|
: "di" (FLUSH_I_AND_D)); \
|
|
|
|
} \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define flush_cache_all() __flush_cache_all()
|
|
|
|
|
|
|
|
#define flush_cache_vmap(start, end) flush_cache_all()
|
|
|
|
#define flush_cache_vunmap(start, end) flush_cache_all()
|
|
|
|
|
|
|
|
static inline void flush_cache_mm(struct mm_struct *mm)
|
|
|
|
{
|
|
|
|
if (mm == current->mm)
|
|
|
|
__flush_cache_030();
|
|
|
|
}
|
|
|
|
|
2006-12-12 20:14:57 +03:00
|
|
|
#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* flush_cache_range/flush_cache_page must be macros to avoid
|
|
|
|
a dependency on linux/mm.h, which includes this file... */
|
|
|
|
static inline void flush_cache_range(struct vm_area_struct *vma,
|
|
|
|
unsigned long start,
|
|
|
|
unsigned long end)
|
|
|
|
{
|
|
|
|
if (vma->vm_mm == current->mm)
|
|
|
|
__flush_cache_030();
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
|
|
|
|
{
|
|
|
|
if (vma->vm_mm == current->mm)
|
|
|
|
__flush_cache_030();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Push the page at kernel virtual address and clear the icache */
|
|
|
|
/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */
|
|
|
|
static inline void __flush_page_to_ram(void *vaddr)
|
|
|
|
{
|
2011-10-17 08:38:09 +04:00
|
|
|
if (CPU_IS_COLDFIRE) {
|
|
|
|
unsigned long addr, start, end;
|
|
|
|
addr = ((unsigned long) vaddr) & ~(PAGE_SIZE - 1);
|
|
|
|
start = addr & ICACHE_SET_MASK;
|
|
|
|
end = (addr + PAGE_SIZE - 1) & ICACHE_SET_MASK;
|
|
|
|
if (start > end) {
|
|
|
|
flush_cf_bcache(0, end);
|
|
|
|
end = ICACHE_MAX_ADDR;
|
|
|
|
}
|
|
|
|
flush_cf_bcache(start, end);
|
|
|
|
} else if (CPU_IS_040_OR_060) {
|
2005-04-17 02:20:36 +04:00
|
|
|
__asm__ __volatile__("nop\n\t"
|
|
|
|
".chip 68040\n\t"
|
|
|
|
"cpushp %%bc,(%0)\n\t"
|
|
|
|
".chip 68k"
|
|
|
|
: : "a" (__pa(vaddr)));
|
|
|
|
} else {
|
|
|
|
unsigned long _tmp;
|
|
|
|
__asm__ __volatile__("movec %%cacr,%0\n\t"
|
|
|
|
"orw %1,%0\n\t"
|
|
|
|
"movec %0,%%cacr"
|
|
|
|
: "=&d" (_tmp)
|
|
|
|
: "di" (FLUSH_I));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-26 11:16:19 +03:00
|
|
|
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
|
2005-04-17 02:20:36 +04:00
|
|
|
#define flush_dcache_page(page) __flush_page_to_ram(page_address(page))
|
|
|
|
#define flush_dcache_mmap_lock(mapping) do { } while (0)
|
|
|
|
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
|
|
|
|
#define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page))
|
|
|
|
|
2005-09-04 02:57:09 +04:00
|
|
|
extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
|
|
|
|
unsigned long addr, int len);
|
2005-04-17 02:20:36 +04:00
|
|
|
extern void flush_icache_range(unsigned long address, unsigned long endaddr);
|
|
|
|
|
2005-09-04 02:57:09 +04:00
|
|
|
static inline void copy_to_user_page(struct vm_area_struct *vma,
|
|
|
|
struct page *page, unsigned long vaddr,
|
|
|
|
void *dst, void *src, int len)
|
|
|
|
{
|
|
|
|
flush_cache_page(vma, vaddr, page_to_pfn(page));
|
|
|
|
memcpy(dst, src, len);
|
|
|
|
flush_icache_user_range(vma, page, vaddr, len);
|
|
|
|
}
|
|
|
|
static inline void copy_from_user_page(struct vm_area_struct *vma,
|
|
|
|
struct page *page, unsigned long vaddr,
|
|
|
|
void *dst, void *src, int len)
|
|
|
|
{
|
|
|
|
flush_cache_page(vma, vaddr, page_to_pfn(page));
|
|
|
|
memcpy(dst, src, len);
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif /* _M68K_CACHEFLUSH_H */
|