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 */
|
2017-05-30 18:58:01 +07:00
|
|
|
#ifndef __NITROX_DEV_H
|
|
|
|
#define __NITROX_DEV_H
|
|
|
|
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/pci.h>
|
2018-09-21 18:38:00 +07:00
|
|
|
#include <linux/if.h>
|
2017-05-30 18:58:01 +07:00
|
|
|
|
|
|
|
#define VERSION_LEN 32
|
2018-12-04 19:55:54 +07:00
|
|
|
/* Maximum queues in PF mode */
|
|
|
|
#define MAX_PF_QUEUES 64
|
2019-08-08 19:17:37 +07:00
|
|
|
/* Maximum device queues */
|
|
|
|
#define MAX_DEV_QUEUES (MAX_PF_QUEUES)
|
2019-07-09 22:24:24 +07:00
|
|
|
/* Maximum UCD Blocks */
|
|
|
|
#define CNN55XX_MAX_UCD_BLOCKS 8
|
2017-05-30 18:58:01 +07:00
|
|
|
|
2018-09-29 15:19:09 +07:00
|
|
|
/**
|
|
|
|
* struct nitrox_cmdq - NITROX command queue
|
|
|
|
* @cmd_qlock: command queue lock
|
|
|
|
* @resp_qlock: response queue lock
|
|
|
|
* @backlog_qlock: backlog queue lock
|
|
|
|
* @ndev: NITROX device
|
|
|
|
* @response_head: submitted request list
|
|
|
|
* @backlog_head: backlog queue
|
|
|
|
* @dbell_csr_addr: doorbell register address for this queue
|
2018-09-29 15:19:10 +07:00
|
|
|
* @compl_cnt_csr_addr: completion count register address of the slc port
|
2018-09-29 15:19:09 +07:00
|
|
|
* @base: command queue base address
|
|
|
|
* @dma: dma address of the base
|
|
|
|
* @pending_count: request pending at device
|
|
|
|
* @backlog_count: backlog request count
|
|
|
|
* @write_idx: next write index for the command
|
|
|
|
* @instr_size: command size
|
|
|
|
* @qno: command queue number
|
|
|
|
* @qsize: command queue size
|
|
|
|
* @unalign_base: unaligned base address
|
|
|
|
* @unalign_dma: unaligned dma address
|
|
|
|
*/
|
2017-05-30 18:58:01 +07:00
|
|
|
struct nitrox_cmdq {
|
2018-09-29 15:19:09 +07:00
|
|
|
spinlock_t cmd_qlock;
|
|
|
|
spinlock_t resp_qlock;
|
|
|
|
spinlock_t backlog_qlock;
|
|
|
|
|
|
|
|
struct nitrox_device *ndev;
|
2017-05-30 18:58:01 +07:00
|
|
|
struct list_head response_head;
|
|
|
|
struct list_head backlog_head;
|
|
|
|
|
|
|
|
u8 __iomem *dbell_csr_addr;
|
2018-09-29 15:19:10 +07:00
|
|
|
u8 __iomem *compl_cnt_csr_addr;
|
2018-09-29 15:19:09 +07:00
|
|
|
u8 *base;
|
|
|
|
dma_addr_t dma;
|
2017-05-30 18:58:01 +07:00
|
|
|
|
|
|
|
struct work_struct backlog_qflush;
|
|
|
|
|
|
|
|
atomic_t pending_count;
|
|
|
|
atomic_t backlog_count;
|
|
|
|
|
2018-08-22 14:10:52 +07:00
|
|
|
int write_idx;
|
2017-05-30 18:58:01 +07:00
|
|
|
u8 instr_size;
|
|
|
|
u8 qno;
|
|
|
|
u32 qsize;
|
|
|
|
|
2018-09-29 15:19:09 +07:00
|
|
|
u8 *unalign_base;
|
|
|
|
dma_addr_t unalign_dma;
|
2017-05-30 18:58:01 +07:00
|
|
|
};
|
|
|
|
|
2018-09-21 18:38:00 +07:00
|
|
|
/**
|
|
|
|
* struct nitrox_hw - NITROX hardware information
|
|
|
|
* @partname: partname ex: CNN55xxx-xxx
|
|
|
|
* @fw_name: firmware version
|
|
|
|
* @freq: NITROX frequency
|
|
|
|
* @vendor_id: vendor ID
|
|
|
|
* @device_id: device ID
|
|
|
|
* @revision_id: revision ID
|
|
|
|
* @se_cores: number of symmetric cores
|
|
|
|
* @ae_cores: number of asymmetric cores
|
|
|
|
* @zip_cores: number of zip cores
|
|
|
|
*/
|
2017-05-30 18:58:01 +07:00
|
|
|
struct nitrox_hw {
|
2018-09-21 18:38:00 +07:00
|
|
|
char partname[IFNAMSIZ * 2];
|
2019-07-09 22:24:24 +07:00
|
|
|
char fw_name[CNN55XX_MAX_UCD_BLOCKS][VERSION_LEN];
|
2017-05-30 18:58:01 +07:00
|
|
|
|
2018-09-21 18:38:00 +07:00
|
|
|
int freq;
|
2017-05-30 18:58:01 +07:00
|
|
|
u16 vendor_id;
|
|
|
|
u16 device_id;
|
|
|
|
u8 revision_id;
|
|
|
|
|
|
|
|
u8 se_cores;
|
|
|
|
u8 ae_cores;
|
|
|
|
u8 zip_cores;
|
|
|
|
};
|
|
|
|
|
2018-09-21 18:38:01 +07:00
|
|
|
struct nitrox_stats {
|
|
|
|
atomic64_t posted;
|
|
|
|
atomic64_t completed;
|
|
|
|
atomic64_t dropped;
|
|
|
|
};
|
|
|
|
|
2018-09-29 15:19:10 +07:00
|
|
|
#define IRQ_NAMESZ 32
|
|
|
|
|
|
|
|
struct nitrox_q_vector {
|
|
|
|
char name[IRQ_NAMESZ];
|
|
|
|
bool valid;
|
|
|
|
int ring;
|
|
|
|
struct tasklet_struct resp_tasklet;
|
|
|
|
union {
|
|
|
|
struct nitrox_cmdq *cmdq;
|
|
|
|
struct nitrox_device *ndev;
|
|
|
|
};
|
2017-05-30 18:58:01 +07:00
|
|
|
};
|
|
|
|
|
2018-12-04 19:55:54 +07:00
|
|
|
/**
|
|
|
|
* mbox_msg - Mailbox message data
|
|
|
|
* @type: message type
|
|
|
|
* @opcode: message opcode
|
|
|
|
* @data: message data
|
|
|
|
*/
|
|
|
|
union mbox_msg {
|
|
|
|
u64 value;
|
|
|
|
struct {
|
|
|
|
u64 type: 2;
|
|
|
|
u64 opcode: 6;
|
|
|
|
u64 data: 58;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
u64 type: 2;
|
|
|
|
u64 opcode: 6;
|
|
|
|
u64 chipid: 8;
|
|
|
|
u64 vfid: 8;
|
|
|
|
} id;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nitrox_vfdev - NITROX VF device instance in PF
|
|
|
|
* @state: VF device state
|
|
|
|
* @vfno: VF number
|
|
|
|
* @nr_queues: number of queues enabled in VF
|
|
|
|
* @ring: ring to communicate with VF
|
|
|
|
* @msg: Mailbox message data from VF
|
|
|
|
* @mbx_resp: Mailbox counters
|
|
|
|
*/
|
|
|
|
struct nitrox_vfdev {
|
|
|
|
atomic_t state;
|
|
|
|
int vfno;
|
|
|
|
int nr_queues;
|
|
|
|
int ring;
|
|
|
|
union mbox_msg msg;
|
|
|
|
atomic64_t mbx_resp;
|
|
|
|
};
|
|
|
|
|
2018-11-21 16:52:24 +07:00
|
|
|
/**
|
|
|
|
* struct nitrox_iov - SR-IOV information
|
|
|
|
* @num_vfs: number of VF(s) enabled
|
2018-12-04 19:55:54 +07:00
|
|
|
* @max_vf_queues: Maximum number of queues allowed for VF
|
|
|
|
* @vfdev: VF(s) devices
|
|
|
|
* @pf2vf_wq: workqueue for PF2VF communication
|
|
|
|
* @msix: MSI-X entry for PF in SR-IOV case
|
2018-11-21 16:52:24 +07:00
|
|
|
*/
|
|
|
|
struct nitrox_iov {
|
|
|
|
int num_vfs;
|
2018-12-04 19:55:54 +07:00
|
|
|
int max_vf_queues;
|
|
|
|
struct nitrox_vfdev *vfdev;
|
|
|
|
struct workqueue_struct *pf2vf_wq;
|
2018-11-21 16:52:24 +07:00
|
|
|
struct msix_entry msix;
|
|
|
|
};
|
|
|
|
|
2018-09-07 14:01:18 +07:00
|
|
|
/*
|
|
|
|
* NITROX Device states
|
|
|
|
*/
|
|
|
|
enum ndev_state {
|
|
|
|
__NDEV_NOT_READY,
|
|
|
|
__NDEV_READY,
|
|
|
|
__NDEV_IN_RESET,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* NITROX support modes for VF(s) */
|
|
|
|
enum vf_mode {
|
|
|
|
__NDEV_MODE_PF,
|
|
|
|
__NDEV_MODE_VF16,
|
|
|
|
__NDEV_MODE_VF32,
|
|
|
|
__NDEV_MODE_VF64,
|
|
|
|
__NDEV_MODE_VF128,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define __NDEV_SRIOV_BIT 0
|
2017-05-30 18:58:01 +07:00
|
|
|
|
|
|
|
/* command queue size */
|
|
|
|
#define DEFAULT_CMD_QLEN 2048
|
|
|
|
/* command timeout in milliseconds */
|
|
|
|
#define CMD_TIMEOUT 2000
|
|
|
|
|
|
|
|
#define DEV(ndev) ((struct device *)(&(ndev)->pdev->dev))
|
|
|
|
|
|
|
|
#define NITROX_CSR_ADDR(ndev, offset) \
|
|
|
|
((ndev)->bar_addr + (offset))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct nitrox_device - NITROX Device Information.
|
|
|
|
* @list: pointer to linked list of devices
|
|
|
|
* @bar_addr: iomap address
|
|
|
|
* @pdev: PCI device information
|
2018-09-07 14:01:18 +07:00
|
|
|
* @state: NITROX device state
|
|
|
|
* @flags: flags to indicate device the features
|
2017-05-30 18:58:01 +07:00
|
|
|
* @timeout: Request timeout in jiffies
|
|
|
|
* @refcnt: Device usage count
|
|
|
|
* @idx: device index (0..N)
|
|
|
|
* @node: NUMA node id attached
|
|
|
|
* @qlen: Command queue length
|
|
|
|
* @nr_queues: Number of command queues
|
2018-09-07 14:01:18 +07:00
|
|
|
* @mode: Device mode PF/VF
|
2017-05-30 18:58:01 +07:00
|
|
|
* @ctx_pool: DMA pool for crypto context
|
2018-09-29 15:19:09 +07:00
|
|
|
* @pkt_inq: Packet input rings
|
2019-08-08 19:17:37 +07:00
|
|
|
* @aqmq: AQM command queues
|
2018-09-29 15:19:10 +07:00
|
|
|
* @qvec: MSI-X queue vectors information
|
2018-11-21 16:52:24 +07:00
|
|
|
* @iov: SR-IOV informatin
|
|
|
|
* @num_vecs: number of MSI-X vectors
|
|
|
|
* @stats: request statistics
|
2017-05-30 18:58:01 +07:00
|
|
|
* @hw: hardware information
|
2017-05-30 18:58:02 +07:00
|
|
|
* @debugfs_dir: debugfs directory
|
2017-05-30 18:58:01 +07:00
|
|
|
*/
|
|
|
|
struct nitrox_device {
|
|
|
|
struct list_head list;
|
|
|
|
|
|
|
|
u8 __iomem *bar_addr;
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
|
2018-09-07 14:01:18 +07:00
|
|
|
atomic_t state;
|
|
|
|
unsigned long flags;
|
2017-05-30 18:58:01 +07:00
|
|
|
unsigned long timeout;
|
|
|
|
refcount_t refcnt;
|
|
|
|
|
|
|
|
u8 idx;
|
|
|
|
int node;
|
|
|
|
u16 qlen;
|
|
|
|
u16 nr_queues;
|
2018-09-07 14:01:18 +07:00
|
|
|
enum vf_mode mode;
|
2017-05-30 18:58:01 +07:00
|
|
|
|
|
|
|
struct dma_pool *ctx_pool;
|
2018-09-29 15:19:09 +07:00
|
|
|
struct nitrox_cmdq *pkt_inq;
|
2019-08-08 19:17:37 +07:00
|
|
|
struct nitrox_cmdq *aqmq[MAX_DEV_QUEUES] ____cacheline_aligned_in_smp;
|
2017-05-30 18:58:01 +07:00
|
|
|
|
2018-09-29 15:19:10 +07:00
|
|
|
struct nitrox_q_vector *qvec;
|
2018-11-21 16:52:24 +07:00
|
|
|
struct nitrox_iov iov;
|
2018-09-29 15:19:10 +07:00
|
|
|
int num_vecs;
|
2017-05-30 18:58:01 +07:00
|
|
|
|
2018-09-21 18:38:01 +07:00
|
|
|
struct nitrox_stats stats;
|
2017-05-30 18:58:01 +07:00
|
|
|
struct nitrox_hw hw;
|
2017-05-30 18:58:02 +07:00
|
|
|
#if IS_ENABLED(CONFIG_DEBUG_FS)
|
|
|
|
struct dentry *debugfs_dir;
|
|
|
|
#endif
|
2017-05-30 18:58:01 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nitrox_read_csr - Read from device register
|
|
|
|
* @ndev: NITROX device
|
|
|
|
* @offset: offset of the register to read
|
|
|
|
*
|
|
|
|
* Returns: value read
|
|
|
|
*/
|
|
|
|
static inline u64 nitrox_read_csr(struct nitrox_device *ndev, u64 offset)
|
|
|
|
{
|
|
|
|
return readq(ndev->bar_addr + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nitrox_write_csr - Write to device register
|
|
|
|
* @ndev: NITROX device
|
|
|
|
* @offset: offset of the register to write
|
|
|
|
* @value: value to write
|
|
|
|
*/
|
|
|
|
static inline void nitrox_write_csr(struct nitrox_device *ndev, u64 offset,
|
|
|
|
u64 value)
|
|
|
|
{
|
|
|
|
writeq(value, (ndev->bar_addr + offset));
|
|
|
|
}
|
|
|
|
|
2018-09-07 14:01:18 +07:00
|
|
|
static inline bool nitrox_ready(struct nitrox_device *ndev)
|
2017-05-30 18:58:01 +07:00
|
|
|
{
|
2018-09-07 14:01:18 +07:00
|
|
|
return atomic_read(&ndev->state) == __NDEV_READY;
|
2017-05-30 18:58:01 +07:00
|
|
|
}
|
|
|
|
|
2018-12-04 19:55:54 +07:00
|
|
|
static inline bool nitrox_vfdev_ready(struct nitrox_vfdev *vfdev)
|
2018-09-21 18:38:02 +07:00
|
|
|
{
|
2018-12-04 19:55:54 +07:00
|
|
|
return atomic_read(&vfdev->state) == __NDEV_READY;
|
2018-09-21 18:38:02 +07:00
|
|
|
}
|
|
|
|
|
2017-05-30 18:58:01 +07:00
|
|
|
#endif /* __NITROX_DEV_H */
|