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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-11-18 22:40:46 +08:00
|
|
|
* Copyright (C) 2004 IBM
|
|
|
|
*
|
|
|
|
* Implements the generic device dma API for powerpc.
|
|
|
|
* the pci and vio busses
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-11-18 22:40:46 +08:00
|
|
|
#ifndef _ASM_DMA_MAPPING_H
|
|
|
|
#define _ASM_DMA_MAPPING_H
|
2007-10-17 03:54:33 +08:00
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/cache.h>
|
|
|
|
/* need struct page definitions */
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/scatterlist.h>
|
2009-08-05 03:08:26 +08:00
|
|
|
#include <linux/dma-debug.h>
|
2007-10-17 03:54:33 +08:00
|
|
|
#include <asm/io.h>
|
2009-05-14 20:42:28 +08:00
|
|
|
#include <asm/swiotlb.h>
|
2007-10-17 03:54:33 +08:00
|
|
|
|
2009-05-14 20:42:28 +08:00
|
|
|
/* Some dma direct funcs must be visible for use in other dma_ops */
|
2017-12-22 17:58:24 +08:00
|
|
|
extern void *__dma_nommu_alloc_coherent(struct device *dev, size_t size,
|
2015-06-24 13:25:31 +08:00
|
|
|
dma_addr_t *dma_handle, gfp_t flag,
|
2016-08-04 04:46:00 +08:00
|
|
|
unsigned long attrs);
|
2017-12-22 17:58:24 +08:00
|
|
|
extern void __dma_nommu_free_coherent(struct device *dev, size_t size,
|
2015-06-24 13:25:31 +08:00
|
|
|
void *vaddr, dma_addr_t dma_handle,
|
2016-08-04 04:46:00 +08:00
|
|
|
unsigned long attrs);
|
2017-12-22 17:58:24 +08:00
|
|
|
extern int dma_nommu_mmap_coherent(struct device *dev,
|
2012-06-14 19:03:04 +08:00
|
|
|
struct vm_area_struct *vma,
|
|
|
|
void *cpu_addr, dma_addr_t handle,
|
2016-08-04 04:46:00 +08:00
|
|
|
size_t size, unsigned long attrs);
|
2009-05-14 20:42:28 +08:00
|
|
|
|
2007-10-17 03:54:33 +08:00
|
|
|
#ifdef CONFIG_NOT_COHERENT_CACHE
|
|
|
|
/*
|
|
|
|
* DMA-consistent mapping functions for PowerPCs that don't support
|
|
|
|
* cache snooping. These allocate/free a region of uncached mapped
|
|
|
|
* memory space for use with DMA devices. Alternatively, you could
|
|
|
|
* allocate the space "normally" and use the cache management functions
|
|
|
|
* to ensure it is consistent.
|
|
|
|
*/
|
2009-05-27 11:50:33 +08:00
|
|
|
struct device;
|
|
|
|
extern void *__dma_alloc_coherent(struct device *dev, size_t size,
|
|
|
|
dma_addr_t *handle, gfp_t gfp);
|
2007-10-17 03:54:33 +08:00
|
|
|
extern void __dma_free_coherent(size_t size, void *vaddr);
|
|
|
|
extern void __dma_sync(void *vaddr, size_t size, int direction);
|
|
|
|
extern void __dma_sync_page(struct page *page, unsigned long offset,
|
|
|
|
size_t size, int direction);
|
2011-03-25 04:50:06 +08:00
|
|
|
extern unsigned long __dma_get_coherent_pfn(unsigned long cpu_addr);
|
2007-10-17 03:54:33 +08:00
|
|
|
|
|
|
|
#else /* ! CONFIG_NOT_COHERENT_CACHE */
|
|
|
|
/*
|
|
|
|
* Cache coherent cores.
|
|
|
|
*/
|
|
|
|
|
2009-05-27 11:50:33 +08:00
|
|
|
#define __dma_alloc_coherent(dev, gfp, size, handle) NULL
|
2007-10-17 03:54:33 +08:00
|
|
|
#define __dma_free_coherent(size, addr) ((void)0)
|
|
|
|
#define __dma_sync(addr, size, rw) ((void)0)
|
|
|
|
#define __dma_sync_page(pg, off, sz, rw) ((void)0)
|
|
|
|
|
|
|
|
#endif /* ! CONFIG_NOT_COHERENT_CACHE */
|
|
|
|
|
2008-07-05 03:05:45 +08:00
|
|
|
static inline unsigned long device_to_mask(struct device *dev)
|
|
|
|
{
|
|
|
|
if (dev->dma_mask && *dev->dma_mask)
|
|
|
|
return *dev->dma_mask;
|
|
|
|
/* Assume devices without mask can take 32 bit addresses */
|
|
|
|
return 0xfffffffful;
|
|
|
|
}
|
|
|
|
|
powerpc: Merge 32 and 64-bit dma code
We essentially adopt the 64-bit dma code, with some changes to support
32-bit systems, including HIGHMEM. dma functions on 32-bit are now
invoked via accessor functions which call the correct op for a device based
on archdata dma_ops. If there is no archdata dma_ops, this defaults
to dma_direct_ops.
In addition, the dma_map/unmap_page functions are added to dma_ops
because we can't just fall back on map/unmap_single when HIGHMEM is
enabled. In the case of dma_direct_*, we stop using map/unmap_single
and just use the page version - this saves a lot of ugly
ifdeffing. We leave map/unmap_single in the dma_ops definition,
though, because they are needed by the iommu code, which does not
implement map/unmap_page. Ideally, going forward, we will completely
eliminate map/unmap_single and just have map/unmap_page, if it's
workable for 64-bit.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-09-12 18:34:46 +08:00
|
|
|
/*
|
|
|
|
* Available generic sets of operations
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_PPC64
|
2009-08-05 03:08:25 +08:00
|
|
|
extern struct dma_map_ops dma_iommu_ops;
|
powerpc: Merge 32 and 64-bit dma code
We essentially adopt the 64-bit dma code, with some changes to support
32-bit systems, including HIGHMEM. dma functions on 32-bit are now
invoked via accessor functions which call the correct op for a device based
on archdata dma_ops. If there is no archdata dma_ops, this defaults
to dma_direct_ops.
In addition, the dma_map/unmap_page functions are added to dma_ops
because we can't just fall back on map/unmap_single when HIGHMEM is
enabled. In the case of dma_direct_*, we stop using map/unmap_single
and just use the page version - this saves a lot of ugly
ifdeffing. We leave map/unmap_single in the dma_ops definition,
though, because they are needed by the iommu code, which does not
implement map/unmap_page. Ideally, going forward, we will completely
eliminate map/unmap_single and just have map/unmap_page, if it's
workable for 64-bit.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-09-12 18:34:46 +08:00
|
|
|
#endif
|
2017-12-22 17:58:24 +08:00
|
|
|
extern const struct dma_map_ops dma_nommu_ops;
|
powerpc: Merge 32 and 64-bit dma code
We essentially adopt the 64-bit dma code, with some changes to support
32-bit systems, including HIGHMEM. dma functions on 32-bit are now
invoked via accessor functions which call the correct op for a device based
on archdata dma_ops. If there is no archdata dma_ops, this defaults
to dma_direct_ops.
In addition, the dma_map/unmap_page functions are added to dma_ops
because we can't just fall back on map/unmap_single when HIGHMEM is
enabled. In the case of dma_direct_*, we stop using map/unmap_single
and just use the page version - this saves a lot of ugly
ifdeffing. We leave map/unmap_single in the dma_ops definition,
though, because they are needed by the iommu code, which does not
implement map/unmap_page. Ideally, going forward, we will completely
eliminate map/unmap_single and just have map/unmap_page, if it's
workable for 64-bit.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-09-12 18:34:46 +08:00
|
|
|
|
2017-01-21 05:04:04 +08:00
|
|
|
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
|
2007-10-17 03:54:33 +08:00
|
|
|
{
|
|
|
|
/* We don't handle the NULL dev case for ISA for now. We could
|
|
|
|
* do it via an out of line call but it is not needed for now. The
|
|
|
|
* only ISA DMA device we support is the floppy and we have a hack
|
|
|
|
* in the floppy driver directly to get a device for us.
|
|
|
|
*/
|
2017-01-21 05:04:04 +08:00
|
|
|
return NULL;
|
2008-01-29 22:13:58 +08:00
|
|
|
}
|
|
|
|
|
2009-09-21 16:26:34 +08:00
|
|
|
/*
|
|
|
|
* get_dma_offset()
|
|
|
|
*
|
|
|
|
* Get the dma offset on configurations where the dma address can be determined
|
|
|
|
* from the physical address by looking at a simple offset. Direct dma and
|
|
|
|
* swiotlb use this function, but it is typically not used by implementations
|
|
|
|
* with an iommu.
|
|
|
|
*/
|
2009-09-21 16:26:35 +08:00
|
|
|
static inline dma_addr_t get_dma_offset(struct device *dev)
|
2009-09-21 16:26:34 +08:00
|
|
|
{
|
|
|
|
if (dev)
|
2015-06-24 13:25:22 +08:00
|
|
|
return dev->archdata.dma_offset;
|
2009-09-21 16:26:34 +08:00
|
|
|
|
|
|
|
return PCI_DRAM_OFFSET;
|
|
|
|
}
|
|
|
|
|
2009-09-21 16:26:35 +08:00
|
|
|
static inline void set_dma_offset(struct device *dev, dma_addr_t off)
|
|
|
|
{
|
|
|
|
if (dev)
|
2015-06-24 13:25:22 +08:00
|
|
|
dev->archdata.dma_offset = off;
|
2009-09-21 16:26:35 +08:00
|
|
|
}
|
|
|
|
|
2015-09-10 06:39:53 +08:00
|
|
|
#define HAVE_ARCH_DMA_SET_MASK 1
|
|
|
|
extern int dma_set_mask(struct device *dev, u64 dma_mask);
|
|
|
|
|
2014-09-30 10:39:10 +08:00
|
|
|
extern u64 __dma_get_required_mask(struct device *dev);
|
2007-10-17 03:54:33 +08:00
|
|
|
|
2011-03-25 04:50:06 +08:00
|
|
|
#define ARCH_HAS_DMA_MMAP_COHERENT
|
|
|
|
|
2005-12-17 05:43:46 +08:00
|
|
|
#endif /* __KERNEL__ */
|
2005-11-18 22:40:46 +08:00
|
|
|
#endif /* _ASM_DMA_MAPPING_H */
|