mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 17:01:57 +07:00
b24413180f
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>
190 lines
5.9 KiB
C
190 lines
5.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __NX_842_H__
|
|
#define __NX_842_H__
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/crypto.h>
|
|
#include <linux/of.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/io.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/ratelimit.h>
|
|
|
|
/* Restrictions on Data Descriptor List (DDL) and Entry (DDE) buffers
|
|
*
|
|
* From NX P8 workbook, sec 4.9.1 "842 details"
|
|
* Each DDE buffer is 128 byte aligned
|
|
* Each DDE buffer size is a multiple of 32 bytes (except the last)
|
|
* The last DDE buffer size is a multiple of 8 bytes
|
|
*/
|
|
#define DDE_BUFFER_ALIGN (128)
|
|
#define DDE_BUFFER_SIZE_MULT (32)
|
|
#define DDE_BUFFER_LAST_MULT (8)
|
|
|
|
/* Arbitrary DDL length limit
|
|
* Allows max buffer size of MAX-1 to MAX pages
|
|
* (depending on alignment)
|
|
*/
|
|
#define DDL_LEN_MAX (17)
|
|
|
|
/* CCW 842 CI/FC masks
|
|
* NX P8 workbook, section 4.3.1, figure 4-6
|
|
* "CI/FC Boundary by NX CT type"
|
|
*/
|
|
#define CCW_CI_842 (0x00003ff8)
|
|
#define CCW_FC_842 (0x00000007)
|
|
|
|
/* CCW Function Codes (FC) for 842
|
|
* NX P8 workbook, section 4.9, table 4-28
|
|
* "Function Code Definitions for 842 Memory Compression"
|
|
*/
|
|
#define CCW_FC_842_COMP_NOCRC (0)
|
|
#define CCW_FC_842_COMP_CRC (1)
|
|
#define CCW_FC_842_DECOMP_NOCRC (2)
|
|
#define CCW_FC_842_DECOMP_CRC (3)
|
|
#define CCW_FC_842_MOVE (4)
|
|
|
|
/* CSB CC Error Types for 842
|
|
* NX P8 workbook, section 4.10.3, table 4-30
|
|
* "Reported Error Types Summary Table"
|
|
*/
|
|
/* These are all duplicates of existing codes defined in icswx.h. */
|
|
#define CSB_CC_TRANSLATION_DUP1 (80)
|
|
#define CSB_CC_TRANSLATION_DUP2 (82)
|
|
#define CSB_CC_TRANSLATION_DUP3 (84)
|
|
#define CSB_CC_TRANSLATION_DUP4 (86)
|
|
#define CSB_CC_TRANSLATION_DUP5 (92)
|
|
#define CSB_CC_TRANSLATION_DUP6 (94)
|
|
#define CSB_CC_PROTECTION_DUP1 (81)
|
|
#define CSB_CC_PROTECTION_DUP2 (83)
|
|
#define CSB_CC_PROTECTION_DUP3 (85)
|
|
#define CSB_CC_PROTECTION_DUP4 (87)
|
|
#define CSB_CC_PROTECTION_DUP5 (93)
|
|
#define CSB_CC_PROTECTION_DUP6 (95)
|
|
#define CSB_CC_RD_EXTERNAL_DUP1 (89)
|
|
#define CSB_CC_RD_EXTERNAL_DUP2 (90)
|
|
#define CSB_CC_RD_EXTERNAL_DUP3 (91)
|
|
/* These are specific to NX */
|
|
/* 842 codes */
|
|
#define CSB_CC_TPBC_GT_SPBC (64) /* no error, but >1 comp ratio */
|
|
#define CSB_CC_CRC_MISMATCH (65) /* decomp crc mismatch */
|
|
#define CSB_CC_TEMPL_INVALID (66) /* decomp invalid template value */
|
|
#define CSB_CC_TEMPL_OVERFLOW (67) /* decomp template shows data after end */
|
|
/* sym crypt codes */
|
|
#define CSB_CC_DECRYPT_OVERFLOW (64)
|
|
/* asym crypt codes */
|
|
#define CSB_CC_MINV_OVERFLOW (128)
|
|
/*
|
|
* HW error - Job did not finish in the maximum time allowed.
|
|
* Job terminated.
|
|
*/
|
|
#define CSB_CC_HW_EXPIRED_TIMER (224)
|
|
/* These are reserved for hypervisor use */
|
|
#define CSB_CC_HYP_RESERVE_START (240)
|
|
#define CSB_CC_HYP_RESERVE_END (253)
|
|
#define CSB_CC_HYP_RESERVE_P9_END (251)
|
|
/* No valid interrupt server (P9 or later). */
|
|
#define CSB_CC_HYP_RESERVE_NO_INTR_SERVER (252)
|
|
#define CSB_CC_HYP_NO_HW (254)
|
|
#define CSB_CC_HYP_HANG_ABORTED (255)
|
|
|
|
/* CCB Completion Modes (CM) for 842
|
|
* NX P8 workbook, section 4.3, figure 4-5
|
|
* "CRB Details - Normal Cop_Req (CL=00, C=1)"
|
|
*/
|
|
#define CCB_CM_EXTRA_WRITE (CCB_CM0_ALL_COMPLETIONS & CCB_CM12_STORE)
|
|
#define CCB_CM_INTERRUPT (CCB_CM0_ALL_COMPLETIONS & CCB_CM12_INTERRUPT)
|
|
|
|
#define LEN_ON_SIZE(pa, size) ((size) - ((pa) & ((size) - 1)))
|
|
#define LEN_ON_PAGE(pa) LEN_ON_SIZE(pa, PAGE_SIZE)
|
|
|
|
static inline unsigned long nx842_get_pa(void *addr)
|
|
{
|
|
if (!is_vmalloc_addr(addr))
|
|
return __pa(addr);
|
|
|
|
return page_to_phys(vmalloc_to_page(addr)) + offset_in_page(addr);
|
|
}
|
|
|
|
/**
|
|
* This provides the driver's constraints. Different nx842 implementations
|
|
* may have varying requirements. The constraints are:
|
|
* @alignment: All buffers should be aligned to this
|
|
* @multiple: All buffer lengths should be a multiple of this
|
|
* @minimum: Buffer lengths must not be less than this amount
|
|
* @maximum: Buffer lengths must not be more than this amount
|
|
*
|
|
* The constraints apply to all buffers and lengths, both input and output,
|
|
* for both compression and decompression, except for the minimum which
|
|
* only applies to compression input and decompression output; the
|
|
* compressed data can be less than the minimum constraint. It can be
|
|
* assumed that compressed data will always adhere to the multiple
|
|
* constraint.
|
|
*
|
|
* The driver may succeed even if these constraints are violated;
|
|
* however the driver can return failure or suffer reduced performance
|
|
* if any constraint is not met.
|
|
*/
|
|
struct nx842_constraints {
|
|
int alignment;
|
|
int multiple;
|
|
int minimum;
|
|
int maximum;
|
|
};
|
|
|
|
struct nx842_driver {
|
|
char *name;
|
|
struct module *owner;
|
|
size_t workmem_size;
|
|
|
|
struct nx842_constraints *constraints;
|
|
|
|
int (*compress)(const unsigned char *in, unsigned int in_len,
|
|
unsigned char *out, unsigned int *out_len,
|
|
void *wrkmem);
|
|
int (*decompress)(const unsigned char *in, unsigned int in_len,
|
|
unsigned char *out, unsigned int *out_len,
|
|
void *wrkmem);
|
|
};
|
|
|
|
struct nx842_crypto_header_group {
|
|
__be16 padding; /* unused bytes at start of group */
|
|
__be32 compressed_length; /* compressed bytes in group */
|
|
__be32 uncompressed_length; /* bytes after decompression */
|
|
} __packed;
|
|
|
|
struct nx842_crypto_header {
|
|
__be16 magic; /* NX842_CRYPTO_MAGIC */
|
|
__be16 ignore; /* decompressed end bytes to ignore */
|
|
u8 groups; /* total groups in this header */
|
|
struct nx842_crypto_header_group group[];
|
|
} __packed;
|
|
|
|
#define NX842_CRYPTO_GROUP_MAX (0x20)
|
|
|
|
struct nx842_crypto_ctx {
|
|
spinlock_t lock;
|
|
|
|
u8 *wmem;
|
|
u8 *sbounce, *dbounce;
|
|
|
|
struct nx842_crypto_header header;
|
|
struct nx842_crypto_header_group group[NX842_CRYPTO_GROUP_MAX];
|
|
|
|
struct nx842_driver *driver;
|
|
};
|
|
|
|
int nx842_crypto_init(struct crypto_tfm *tfm, struct nx842_driver *driver);
|
|
void nx842_crypto_exit(struct crypto_tfm *tfm);
|
|
int nx842_crypto_compress(struct crypto_tfm *tfm,
|
|
const u8 *src, unsigned int slen,
|
|
u8 *dst, unsigned int *dlen);
|
|
int nx842_crypto_decompress(struct crypto_tfm *tfm,
|
|
const u8 *src, unsigned int slen,
|
|
u8 *dst, unsigned int *dlen);
|
|
|
|
#endif /* __NX_842_H__ */
|