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 */
|
2011-03-13 15:54:26 +07:00
|
|
|
/*
|
|
|
|
* CAAM/SEC 4.x driver backend
|
|
|
|
* Private/internal definitions between modules
|
|
|
|
*
|
|
|
|
* Copyright 2008-2011 Freescale Semiconductor, Inc.
|
2019-05-03 21:17:39 +07:00
|
|
|
* Copyright 2019 NXP
|
2011-03-13 15:54:26 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INTERN_H
|
|
|
|
#define INTERN_H
|
|
|
|
|
2019-08-21 03:23:47 +07:00
|
|
|
#include "ctrl.h"
|
2020-02-13 00:55:21 +07:00
|
|
|
#include <crypto/engine.h>
|
2019-08-21 03:23:47 +07:00
|
|
|
|
2011-03-13 15:54:26 +07:00
|
|
|
/* Currently comes from Kconfig param as a ^2 (driver-required) */
|
|
|
|
#define JOBR_DEPTH (1 << CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE)
|
|
|
|
|
|
|
|
/* Kconfig params for interrupt coalescing if selected (else zero) */
|
|
|
|
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_INTC
|
|
|
|
#define JOBR_INTC JRCFG_ICEN
|
|
|
|
#define JOBR_INTC_TIME_THLD CONFIG_CRYPTO_DEV_FSL_CAAM_INTC_TIME_THLD
|
|
|
|
#define JOBR_INTC_COUNT_THLD CONFIG_CRYPTO_DEV_FSL_CAAM_INTC_COUNT_THLD
|
|
|
|
#else
|
|
|
|
#define JOBR_INTC 0
|
|
|
|
#define JOBR_INTC_TIME_THLD 0
|
|
|
|
#define JOBR_INTC_COUNT_THLD 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Storage for tracking each in-process entry moving across a ring
|
|
|
|
* Each entry on an output ring needs one of these
|
|
|
|
*/
|
|
|
|
struct caam_jrentry_info {
|
|
|
|
void (*callbk)(struct device *dev, u32 *desc, u32 status, void *arg);
|
|
|
|
void *cbkarg; /* Argument per ring entry */
|
|
|
|
u32 *desc_addr_virt; /* Stored virt addr for postprocessing */
|
|
|
|
dma_addr_t desc_addr_dma; /* Stored bus addr for done matching */
|
|
|
|
u32 desc_size; /* Stored size for postprocessing, header derived */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Private sub-storage for a single JobR */
|
|
|
|
struct caam_drv_private_jr {
|
2013-10-25 13:31:01 +07:00
|
|
|
struct list_head list_node; /* Job Ring device list */
|
|
|
|
struct device *dev;
|
2011-03-13 15:54:26 +07:00
|
|
|
int ridx;
|
|
|
|
struct caam_job_ring __iomem *rregs; /* JobR's register space */
|
2016-11-09 15:46:21 +07:00
|
|
|
struct tasklet_struct irqtask;
|
2011-03-13 15:54:26 +07:00
|
|
|
int irq; /* One per queue */
|
2020-03-19 23:12:27 +07:00
|
|
|
bool hwrng;
|
2011-03-13 15:54:26 +07:00
|
|
|
|
2013-10-25 13:31:02 +07:00
|
|
|
/* Number of scatterlist crypt transforms active on the JobR */
|
|
|
|
atomic_t tfm_count ____cacheline_aligned;
|
|
|
|
|
2011-03-13 15:54:26 +07:00
|
|
|
/* Job ring info */
|
|
|
|
struct caam_jrentry_info *entinfo; /* Alloc'ed 1 per ring entry */
|
|
|
|
spinlock_t inplock ____cacheline_aligned; /* Input ring index lock */
|
2019-03-06 01:03:14 +07:00
|
|
|
u32 inpring_avail; /* Number of free entries in input ring */
|
2011-03-13 15:54:26 +07:00
|
|
|
int head; /* entinfo (s/w ring) head index */
|
2019-08-21 03:23:58 +07:00
|
|
|
void *inpring; /* Base of input ring, alloc
|
|
|
|
* DMA-safe */
|
2011-03-13 15:54:26 +07:00
|
|
|
int out_ring_read_index; /* Output index "tail" */
|
|
|
|
int tail; /* entinfo (s/w ring) tail index */
|
2019-08-21 03:23:57 +07:00
|
|
|
void *outring; /* Base of output ring, DMA-safe */
|
2020-02-13 00:55:21 +07:00
|
|
|
struct crypto_engine *engine;
|
2011-03-13 15:54:26 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Driver-private storage for a single CAAM block instance
|
|
|
|
*/
|
|
|
|
struct caam_drv_private {
|
|
|
|
/* Physical-presence section */
|
2014-09-01 16:30:44 +07:00
|
|
|
struct caam_ctrl __iomem *ctrl; /* controller region */
|
|
|
|
struct caam_deco __iomem *deco; /* DECO/CCB views */
|
|
|
|
struct caam_assurance __iomem *assure;
|
|
|
|
struct caam_queue_if __iomem *qi; /* QI control region */
|
|
|
|
struct caam_job_ring __iomem *jr[4]; /* JobR's register space */
|
2011-03-13 15:54:26 +07:00
|
|
|
|
2019-05-03 21:17:41 +07:00
|
|
|
struct iommu_domain *domain;
|
|
|
|
|
2011-03-13 15:54:26 +07:00
|
|
|
/*
|
|
|
|
* Detected geometry block. Filled in from device tree if powerpc,
|
|
|
|
* or from register-based version detection code
|
|
|
|
*/
|
|
|
|
u8 total_jobrs; /* Total Job Rings in device */
|
|
|
|
u8 qi_present; /* Nonzero if QI present in device */
|
2018-05-23 18:32:40 +07:00
|
|
|
u8 mc_en; /* Nonzero if MC f/w is active */
|
2011-03-13 15:54:26 +07:00
|
|
|
int secvio_irq; /* Security violation interrupt number */
|
2014-06-23 19:12:33 +07:00
|
|
|
int virt_en; /* Virtualization enabled in CAAM */
|
2017-12-19 17:16:06 +07:00
|
|
|
int era; /* CAAM Era (internal HW revision) */
|
2011-03-13 15:54:26 +07:00
|
|
|
|
2013-09-09 22:56:34 +07:00
|
|
|
#define RNG4_MAX_HANDLES 2
|
2013-09-09 22:56:32 +07:00
|
|
|
/* RNG4 block */
|
2013-09-09 22:56:34 +07:00
|
|
|
u32 rng4_sh_init; /* This bitmap shows which of the State
|
|
|
|
Handles of the RNG4 block are initialized
|
|
|
|
by this driver */
|
2013-09-09 22:56:32 +07:00
|
|
|
|
2019-08-21 03:23:48 +07:00
|
|
|
struct clk_bulk_data *clks;
|
|
|
|
int num_clks;
|
2011-03-13 15:54:26 +07:00
|
|
|
/*
|
|
|
|
* debugfs entries for developer view into driver/device
|
|
|
|
* variables at runtime.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *ctl; /* controller dir */
|
|
|
|
struct debugfs_blob_wrapper ctl_kek_wrap, ctl_tkek_wrap, ctl_tdsk_wrap;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2019-05-03 21:17:39 +07:00
|
|
|
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API
|
|
|
|
|
|
|
|
int caam_algapi_init(struct device *dev);
|
|
|
|
void caam_algapi_exit(void);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int caam_algapi_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void caam_algapi_exit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API
|
|
|
|
|
|
|
|
int caam_algapi_hash_init(struct device *dev);
|
|
|
|
void caam_algapi_hash_exit(void);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int caam_algapi_hash_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void caam_algapi_hash_exit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API
|
|
|
|
|
|
|
|
int caam_pkc_init(struct device *dev);
|
|
|
|
void caam_pkc_exit(void);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int caam_pkc_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void caam_pkc_exit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API
|
|
|
|
|
|
|
|
int caam_rng_init(struct device *dev);
|
2020-03-19 23:12:27 +07:00
|
|
|
void caam_rng_exit(struct device *dev);
|
2019-05-03 21:17:39 +07:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int caam_rng_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-03-19 23:12:27 +07:00
|
|
|
static inline void caam_rng_exit(struct device *dev) {}
|
2019-05-03 21:17:39 +07:00
|
|
|
|
|
|
|
#endif /* CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CAAM_QI
|
|
|
|
|
|
|
|
int caam_qi_algapi_init(struct device *dev);
|
|
|
|
void caam_qi_algapi_exit(void);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static inline int caam_qi_algapi_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void caam_qi_algapi_exit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_CAAM_QI */
|
2017-03-17 17:06:01 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
static int caam_debugfs_u64_get(void *data, u64 *val)
|
|
|
|
{
|
|
|
|
*val = caam64_to_cpu(*(u64 *)data);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int caam_debugfs_u32_get(void *data, u64 *val)
|
|
|
|
{
|
|
|
|
*val = caam32_to_cpu(*(u32 *)data);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_SIMPLE_ATTRIBUTE(caam_fops_u32_ro, caam_debugfs_u32_get, NULL, "%llu\n");
|
|
|
|
DEFINE_SIMPLE_ATTRIBUTE(caam_fops_u64_ro, caam_debugfs_u64_get, NULL, "%llu\n");
|
|
|
|
#endif
|
|
|
|
|
2019-08-21 03:23:47 +07:00
|
|
|
static inline u64 caam_get_dma_mask(struct device *dev)
|
|
|
|
{
|
|
|
|
struct device_node *nprop = dev->of_node;
|
|
|
|
|
2019-08-21 03:23:59 +07:00
|
|
|
if (caam_ptr_sz != sizeof(u64))
|
2019-08-21 03:23:47 +07:00
|
|
|
return DMA_BIT_MASK(32);
|
|
|
|
|
|
|
|
if (caam_dpaa2)
|
|
|
|
return DMA_BIT_MASK(49);
|
|
|
|
|
|
|
|
if (of_device_is_compatible(nprop, "fsl,sec-v5.0-job-ring") ||
|
|
|
|
of_device_is_compatible(nprop, "fsl,sec-v5.0"))
|
|
|
|
return DMA_BIT_MASK(40);
|
|
|
|
|
|
|
|
return DMA_BIT_MASK(36);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-13 15:54:26 +07:00
|
|
|
#endif /* INTERN_H */
|