mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 01:15:15 +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>
447 lines
9.9 KiB
C
447 lines
9.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __NITROX_REQ_H
|
|
#define __NITROX_REQ_H
|
|
|
|
#include <linux/dma-mapping.h>
|
|
#include <crypto/aes.h>
|
|
|
|
#include "nitrox_dev.h"
|
|
|
|
/**
|
|
* struct gphdr - General purpose Header
|
|
* @param0: first parameter.
|
|
* @param1: second parameter.
|
|
* @param2: third parameter.
|
|
* @param3: fourth parameter.
|
|
*
|
|
* Params tell the iv and enc/dec data offsets.
|
|
*/
|
|
struct gphdr {
|
|
__be16 param0;
|
|
__be16 param1;
|
|
__be16 param2;
|
|
__be16 param3;
|
|
};
|
|
|
|
/**
|
|
* struct se_req_ctrl - SE request information.
|
|
* @arg: Minor number of the opcode
|
|
* @ctxc: Context control.
|
|
* @unca: Uncertainity enabled.
|
|
* @info: Additional information for SE cores.
|
|
* @ctxl: Context length in bytes.
|
|
* @uddl: User defined data length
|
|
*/
|
|
union se_req_ctrl {
|
|
u64 value;
|
|
struct {
|
|
u64 raz : 22;
|
|
u64 arg : 8;
|
|
u64 ctxc : 2;
|
|
u64 unca : 1;
|
|
u64 info : 3;
|
|
u64 unc : 8;
|
|
u64 ctxl : 12;
|
|
u64 uddl : 8;
|
|
} s;
|
|
};
|
|
|
|
struct nitrox_sglist {
|
|
u16 len;
|
|
u16 raz0;
|
|
u32 raz1;
|
|
dma_addr_t dma;
|
|
};
|
|
|
|
#define MAX_IV_LEN 16
|
|
|
|
/**
|
|
* struct se_crypto_request - SE crypto request structure.
|
|
* @opcode: Request opcode (enc/dec)
|
|
* @flags: flags from crypto subsystem
|
|
* @ctx_handle: Crypto context handle.
|
|
* @gph: GP Header
|
|
* @ctrl: Request Information.
|
|
* @in: Input sglist
|
|
* @out: Output sglist
|
|
*/
|
|
struct se_crypto_request {
|
|
u8 opcode;
|
|
gfp_t gfp;
|
|
u32 flags;
|
|
u64 ctx_handle;
|
|
|
|
struct gphdr gph;
|
|
union se_req_ctrl ctrl;
|
|
|
|
u8 iv[MAX_IV_LEN];
|
|
u16 ivsize;
|
|
|
|
struct scatterlist *src;
|
|
struct scatterlist *dst;
|
|
};
|
|
|
|
/* Crypto opcodes */
|
|
#define FLEXI_CRYPTO_ENCRYPT_HMAC 0x33
|
|
#define ENCRYPT 0
|
|
#define DECRYPT 1
|
|
|
|
/* IV from context */
|
|
#define IV_FROM_CTX 0
|
|
/* IV from Input data */
|
|
#define IV_FROM_DPTR 1
|
|
|
|
/**
|
|
* cipher opcodes for firmware
|
|
*/
|
|
enum flexi_cipher {
|
|
CIPHER_NULL = 0,
|
|
CIPHER_3DES_CBC,
|
|
CIPHER_3DES_ECB,
|
|
CIPHER_AES_CBC,
|
|
CIPHER_AES_ECB,
|
|
CIPHER_AES_CFB,
|
|
CIPHER_AES_CTR,
|
|
CIPHER_AES_GCM,
|
|
CIPHER_AES_XTS,
|
|
CIPHER_AES_CCM,
|
|
CIPHER_AES_CBC_CTS,
|
|
CIPHER_AES_ECB_CTS,
|
|
CIPHER_INVALID
|
|
};
|
|
|
|
/**
|
|
* struct crypto_keys - Crypto keys
|
|
* @key: Encryption key or KEY1 for AES-XTS
|
|
* @iv: Encryption IV or Tweak for AES-XTS
|
|
*/
|
|
struct crypto_keys {
|
|
union {
|
|
u8 key[AES_MAX_KEY_SIZE];
|
|
u8 key1[AES_MAX_KEY_SIZE];
|
|
} u;
|
|
u8 iv[AES_BLOCK_SIZE];
|
|
};
|
|
|
|
/**
|
|
* struct auth_keys - Authentication keys
|
|
* @ipad: IPAD or KEY2 for AES-XTS
|
|
* @opad: OPAD or AUTH KEY if auth_input_type = 1
|
|
*/
|
|
struct auth_keys {
|
|
union {
|
|
u8 ipad[64];
|
|
u8 key2[64];
|
|
} u;
|
|
u8 opad[64];
|
|
};
|
|
|
|
/**
|
|
* struct flexi_crypto_context - Crypto context
|
|
* @cipher_type: Encryption cipher type
|
|
* @aes_keylen: AES key length
|
|
* @iv_source: Encryption IV source
|
|
* @hash_type: Authentication type
|
|
* @auth_input_type: Authentication input type
|
|
* 1 - Authentication IV and KEY, microcode calculates OPAD/IPAD
|
|
* 0 - Authentication OPAD/IPAD
|
|
* @mac_len: mac length
|
|
* @crypto: Crypto keys
|
|
* @auth: Authentication keys
|
|
*/
|
|
struct flexi_crypto_context {
|
|
union {
|
|
__be64 flags;
|
|
struct {
|
|
#if defined(__BIG_ENDIAN_BITFIELD)
|
|
u64 cipher_type : 4;
|
|
u64 reserved_59 : 1;
|
|
u64 aes_keylen : 2;
|
|
u64 iv_source : 1;
|
|
u64 hash_type : 4;
|
|
u64 reserved_49_51 : 3;
|
|
u64 auth_input_type: 1;
|
|
u64 mac_len : 8;
|
|
u64 reserved_0_39 : 40;
|
|
#else
|
|
u64 reserved_0_39 : 40;
|
|
u64 mac_len : 8;
|
|
u64 auth_input_type: 1;
|
|
u64 reserved_49_51 : 3;
|
|
u64 hash_type : 4;
|
|
u64 iv_source : 1;
|
|
u64 aes_keylen : 2;
|
|
u64 reserved_59 : 1;
|
|
u64 cipher_type : 4;
|
|
#endif
|
|
} w0;
|
|
};
|
|
|
|
struct crypto_keys crypto;
|
|
struct auth_keys auth;
|
|
};
|
|
|
|
struct nitrox_crypto_ctx {
|
|
struct nitrox_device *ndev;
|
|
union {
|
|
u64 ctx_handle;
|
|
struct flexi_crypto_context *fctx;
|
|
} u;
|
|
};
|
|
|
|
struct nitrox_kcrypt_request {
|
|
struct se_crypto_request creq;
|
|
struct nitrox_crypto_ctx *nctx;
|
|
struct skcipher_request *skreq;
|
|
};
|
|
|
|
/**
|
|
* struct pkt_instr_hdr - Packet Instruction Header
|
|
* @g: Gather used
|
|
* When [G] is set and [GSZ] != 0, the instruction is
|
|
* indirect gather instruction.
|
|
* When [G] is set and [GSZ] = 0, the instruction is
|
|
* direct gather instruction.
|
|
* @gsz: Number of pointers in the indirect gather list
|
|
* @ihi: When set hardware duplicates the 1st 8 bytes of pkt_instr_hdr
|
|
* and adds them to the packet after the pkt_instr_hdr but before any UDD
|
|
* @ssz: Not used by the input hardware. But can become slc_store_int[SSZ]
|
|
* when [IHI] is set.
|
|
* @fsz: The number of front data bytes directly included in the
|
|
* PCIe instruction.
|
|
* @tlen: The length of the input packet in bytes, include:
|
|
* - 16B pkt_hdr
|
|
* - Inline context bytes if any,
|
|
* - UDD if any,
|
|
* - packet payload bytes
|
|
*/
|
|
union pkt_instr_hdr {
|
|
u64 value;
|
|
struct {
|
|
#if defined(__BIG_ENDIAN_BITFIELD)
|
|
u64 raz_48_63 : 16;
|
|
u64 g : 1;
|
|
u64 gsz : 7;
|
|
u64 ihi : 1;
|
|
u64 ssz : 7;
|
|
u64 raz_30_31 : 2;
|
|
u64 fsz : 6;
|
|
u64 raz_16_23 : 8;
|
|
u64 tlen : 16;
|
|
#else
|
|
u64 tlen : 16;
|
|
u64 raz_16_23 : 8;
|
|
u64 fsz : 6;
|
|
u64 raz_30_31 : 2;
|
|
u64 ssz : 7;
|
|
u64 ihi : 1;
|
|
u64 gsz : 7;
|
|
u64 g : 1;
|
|
u64 raz_48_63 : 16;
|
|
#endif
|
|
} s;
|
|
};
|
|
|
|
/**
|
|
* struct pkt_hdr - Packet Input Header
|
|
* @opcode: Request opcode (Major)
|
|
* @arg: Request opcode (Minor)
|
|
* @ctxc: Context control.
|
|
* @unca: When set [UNC] is the uncertainty count for an input packet.
|
|
* The hardware uses uncertainty counts to predict
|
|
* output buffer use and avoid deadlock.
|
|
* @info: Not used by input hardware. Available for use
|
|
* during SE processing.
|
|
* @destport: The expected destination port/ring/channel for the packet.
|
|
* @unc: Uncertainty count for an input packet.
|
|
* @grp: SE group that will process the input packet.
|
|
* @ctxl: Context Length in 64-bit words.
|
|
* @uddl: User-defined data (UDD) length in bytes.
|
|
* @ctxp: Context pointer. CTXP<63,2:0> must be zero in all cases.
|
|
*/
|
|
union pkt_hdr {
|
|
u64 value[2];
|
|
struct {
|
|
#if defined(__BIG_ENDIAN_BITFIELD)
|
|
u64 opcode : 8;
|
|
u64 arg : 8;
|
|
u64 ctxc : 2;
|
|
u64 unca : 1;
|
|
u64 raz_44 : 1;
|
|
u64 info : 3;
|
|
u64 destport : 9;
|
|
u64 unc : 8;
|
|
u64 raz_19_23 : 5;
|
|
u64 grp : 3;
|
|
u64 raz_15 : 1;
|
|
u64 ctxl : 7;
|
|
u64 uddl : 8;
|
|
#else
|
|
u64 uddl : 8;
|
|
u64 ctxl : 7;
|
|
u64 raz_15 : 1;
|
|
u64 grp : 3;
|
|
u64 raz_19_23 : 5;
|
|
u64 unc : 8;
|
|
u64 destport : 9;
|
|
u64 info : 3;
|
|
u64 raz_44 : 1;
|
|
u64 unca : 1;
|
|
u64 ctxc : 2;
|
|
u64 arg : 8;
|
|
u64 opcode : 8;
|
|
#endif
|
|
__be64 ctxp;
|
|
} s;
|
|
};
|
|
|
|
/**
|
|
* struct slc_store_info - Solicited Paceket Output Store Information.
|
|
* @ssz: The number of scatterlist pointers for the solicited output port
|
|
* packet.
|
|
* @rptr: The result pointer for the solicited output port packet.
|
|
* If [SSZ]=0, [RPTR] must point directly to a buffer on the remote
|
|
* host that is large enough to hold the entire output packet.
|
|
* If [SSZ]!=0, [RPTR] must point to an array of ([SSZ]+3)/4
|
|
* sglist components at [RPTR] on the remote host.
|
|
*/
|
|
union slc_store_info {
|
|
u64 value[2];
|
|
struct {
|
|
#if defined(__BIG_ENDIAN_BITFIELD)
|
|
u64 raz_39_63 : 25;
|
|
u64 ssz : 7;
|
|
u64 raz_0_31 : 32;
|
|
#else
|
|
u64 raz_0_31 : 32;
|
|
u64 ssz : 7;
|
|
u64 raz_39_63 : 25;
|
|
#endif
|
|
__be64 rptr;
|
|
} s;
|
|
};
|
|
|
|
/**
|
|
* struct nps_pkt_instr - NPS Packet Instruction of SE cores.
|
|
* @dptr0 : Input pointer points to buffer in remote host.
|
|
* @ih: Packet Instruction Header (8 bytes)
|
|
* @irh: Packet Input Header (16 bytes)
|
|
* @slc: Solicited Packet Output Store Information (16 bytes)
|
|
* @fdata: Front data
|
|
*
|
|
* 64-Byte Instruction Format
|
|
*/
|
|
struct nps_pkt_instr {
|
|
__be64 dptr0;
|
|
union pkt_instr_hdr ih;
|
|
union pkt_hdr irh;
|
|
union slc_store_info slc;
|
|
u64 fdata[2];
|
|
};
|
|
|
|
/**
|
|
* struct ctx_hdr - Book keeping data about the crypto context
|
|
* @pool: Pool used to allocate crypto context
|
|
* @dma: Base DMA address of the cypto context
|
|
* @ctx_dma: Actual usable crypto context for NITROX
|
|
*/
|
|
struct ctx_hdr {
|
|
struct dma_pool *pool;
|
|
dma_addr_t dma;
|
|
dma_addr_t ctx_dma;
|
|
};
|
|
|
|
/*
|
|
* struct sglist_component - SG list component format
|
|
* @len0: The number of bytes at [PTR0] on the remote host.
|
|
* @len1: The number of bytes at [PTR1] on the remote host.
|
|
* @len2: The number of bytes at [PTR2] on the remote host.
|
|
* @len3: The number of bytes at [PTR3] on the remote host.
|
|
* @dma0: First pointer point to buffer in remote host.
|
|
* @dma1: Second pointer point to buffer in remote host.
|
|
* @dma2: Third pointer point to buffer in remote host.
|
|
* @dma3: Fourth pointer point to buffer in remote host.
|
|
*/
|
|
struct nitrox_sgcomp {
|
|
__be16 len[4];
|
|
__be64 dma[4];
|
|
};
|
|
|
|
/*
|
|
* strutct nitrox_sgtable - SG list information
|
|
* @map_cnt: Number of buffers mapped
|
|
* @nr_comp: Number of sglist components
|
|
* @total_bytes: Total bytes in sglist.
|
|
* @len: Total sglist components length.
|
|
* @dma: DMA address of sglist component.
|
|
* @dir: DMA direction.
|
|
* @buf: crypto request buffer.
|
|
* @sglist: SG list of input/output buffers.
|
|
* @sgcomp: sglist component for NITROX.
|
|
*/
|
|
struct nitrox_sgtable {
|
|
u8 map_bufs_cnt;
|
|
u8 nr_sgcomp;
|
|
u16 total_bytes;
|
|
u32 len;
|
|
dma_addr_t dma;
|
|
enum dma_data_direction dir;
|
|
|
|
struct scatterlist *buf;
|
|
struct nitrox_sglist *sglist;
|
|
struct nitrox_sgcomp *sgcomp;
|
|
};
|
|
|
|
/* Response Header Length */
|
|
#define ORH_HLEN 8
|
|
/* Completion bytes Length */
|
|
#define COMP_HLEN 8
|
|
|
|
struct resp_hdr {
|
|
u64 orh;
|
|
dma_addr_t orh_dma;
|
|
u64 completion;
|
|
dma_addr_t completion_dma;
|
|
};
|
|
|
|
typedef void (*completion_t)(struct skcipher_request *skreq, int err);
|
|
|
|
/**
|
|
* struct nitrox_softreq - Represents the NIROX Request.
|
|
* @response: response list entry
|
|
* @backlog: Backlog list entry
|
|
* @ndev: Device used to submit the request
|
|
* @cmdq: Command queue for submission
|
|
* @resp: Response headers
|
|
* @instr: 64B instruction
|
|
* @in: SG table for input
|
|
* @out SG table for output
|
|
* @tstamp: Request submitted time in jiffies
|
|
* @callback: callback after request completion/timeout
|
|
* @cb_arg: callback argument
|
|
*/
|
|
struct nitrox_softreq {
|
|
struct list_head response;
|
|
struct list_head backlog;
|
|
|
|
u32 flags;
|
|
gfp_t gfp;
|
|
atomic_t status;
|
|
bool inplace;
|
|
|
|
struct nitrox_device *ndev;
|
|
struct nitrox_cmdq *cmdq;
|
|
|
|
struct nps_pkt_instr instr;
|
|
struct resp_hdr resp;
|
|
struct nitrox_sgtable in;
|
|
struct nitrox_sgtable out;
|
|
|
|
unsigned long tstamp;
|
|
|
|
completion_t callback;
|
|
struct skcipher_request *skreq;
|
|
};
|
|
|
|
#endif /* __NITROX_REQ_H */
|