mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08: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>
270 lines
8.2 KiB
C
270 lines
8.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __POWERNV_PCI_H
|
|
#define __POWERNV_PCI_H
|
|
|
|
#include <linux/iommu.h>
|
|
#include <asm/iommu.h>
|
|
#include <asm/msi_bitmap.h>
|
|
|
|
struct pci_dn;
|
|
|
|
/* Maximum possible number of ATSD MMIO registers per NPU */
|
|
#define NV_NMMU_ATSD_REGS 8
|
|
|
|
enum pnv_phb_type {
|
|
PNV_PHB_IODA1 = 0,
|
|
PNV_PHB_IODA2 = 1,
|
|
PNV_PHB_NPU = 2,
|
|
};
|
|
|
|
/* Precise PHB model for error management */
|
|
enum pnv_phb_model {
|
|
PNV_PHB_MODEL_UNKNOWN,
|
|
PNV_PHB_MODEL_P7IOC,
|
|
PNV_PHB_MODEL_PHB3,
|
|
PNV_PHB_MODEL_NPU,
|
|
PNV_PHB_MODEL_NPU2,
|
|
};
|
|
|
|
#define PNV_PCI_DIAG_BUF_SIZE 8192
|
|
#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */
|
|
#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */
|
|
#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
|
|
#define PNV_IODA_PE_MASTER (1 << 3) /* Master PE in compound case */
|
|
#define PNV_IODA_PE_SLAVE (1 << 4) /* Slave PE in compound case */
|
|
#define PNV_IODA_PE_VF (1 << 5) /* PE for one VF */
|
|
|
|
/* Indicates operations are frozen for a PE: MMIO in PESTA & DMA in PESTB. */
|
|
#define PNV_IODA_STOPPED_STATE 0x8000000000000000
|
|
|
|
/* Data associated with a PE, including IOMMU tracking etc.. */
|
|
struct pnv_phb;
|
|
struct pnv_ioda_pe {
|
|
unsigned long flags;
|
|
struct pnv_phb *phb;
|
|
int device_count;
|
|
|
|
/* A PE can be associated with a single device or an
|
|
* entire bus (& children). In the former case, pdev
|
|
* is populated, in the later case, pbus is.
|
|
*/
|
|
#ifdef CONFIG_PCI_IOV
|
|
struct pci_dev *parent_dev;
|
|
#endif
|
|
struct pci_dev *pdev;
|
|
struct pci_bus *pbus;
|
|
|
|
/* Effective RID (device RID for a device PE and base bus
|
|
* RID with devfn 0 for a bus PE)
|
|
*/
|
|
unsigned int rid;
|
|
|
|
/* PE number */
|
|
unsigned int pe_number;
|
|
|
|
/* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
|
|
struct iommu_table_group table_group;
|
|
|
|
/* 64-bit TCE bypass region */
|
|
bool tce_bypass_enabled;
|
|
uint64_t tce_bypass_base;
|
|
|
|
/* MSIs. MVE index is identical for for 32 and 64 bit MSI
|
|
* and -1 if not supported. (It's actually identical to the
|
|
* PE number)
|
|
*/
|
|
int mve_number;
|
|
|
|
/* PEs in compound case */
|
|
struct pnv_ioda_pe *master;
|
|
struct list_head slaves;
|
|
|
|
/* PCI peer-to-peer*/
|
|
int p2p_initiator_count;
|
|
|
|
/* Link in list of PE#s */
|
|
struct list_head list;
|
|
};
|
|
|
|
#define PNV_PHB_FLAG_EEH (1 << 0)
|
|
#define PNV_PHB_FLAG_CXL (1 << 1) /* Real PHB supporting the cxl kernel API */
|
|
|
|
struct pnv_phb {
|
|
struct pci_controller *hose;
|
|
enum pnv_phb_type type;
|
|
enum pnv_phb_model model;
|
|
u64 hub_id;
|
|
u64 opal_id;
|
|
int flags;
|
|
void __iomem *regs;
|
|
u64 regs_phys;
|
|
int initialized;
|
|
spinlock_t lock;
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
int has_dbgfs;
|
|
struct dentry *dbgfs;
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCI_MSI
|
|
unsigned int msi_base;
|
|
unsigned int msi32_support;
|
|
struct msi_bitmap msi_bmp;
|
|
#endif
|
|
int (*msi_setup)(struct pnv_phb *phb, struct pci_dev *dev,
|
|
unsigned int hwirq, unsigned int virq,
|
|
unsigned int is_64, struct msi_msg *msg);
|
|
void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev);
|
|
void (*fixup_phb)(struct pci_controller *hose);
|
|
int (*init_m64)(struct pnv_phb *phb);
|
|
void (*reserve_m64_pe)(struct pci_bus *bus,
|
|
unsigned long *pe_bitmap, bool all);
|
|
struct pnv_ioda_pe *(*pick_m64_pe)(struct pci_bus *bus, bool all);
|
|
int (*get_pe_state)(struct pnv_phb *phb, int pe_no);
|
|
void (*freeze_pe)(struct pnv_phb *phb, int pe_no);
|
|
int (*unfreeze_pe)(struct pnv_phb *phb, int pe_no, int opt);
|
|
|
|
struct {
|
|
/* Global bridge info */
|
|
unsigned int total_pe_num;
|
|
unsigned int reserved_pe_idx;
|
|
unsigned int root_pe_idx;
|
|
bool root_pe_populated;
|
|
|
|
/* 32-bit MMIO window */
|
|
unsigned int m32_size;
|
|
unsigned int m32_segsize;
|
|
unsigned int m32_pci_base;
|
|
|
|
/* 64-bit MMIO window */
|
|
unsigned int m64_bar_idx;
|
|
unsigned long m64_size;
|
|
unsigned long m64_segsize;
|
|
unsigned long m64_base;
|
|
unsigned long m64_bar_alloc;
|
|
|
|
/* IO ports */
|
|
unsigned int io_size;
|
|
unsigned int io_segsize;
|
|
unsigned int io_pci_base;
|
|
|
|
/* PE allocation */
|
|
struct mutex pe_alloc_mutex;
|
|
unsigned long *pe_alloc;
|
|
struct pnv_ioda_pe *pe_array;
|
|
|
|
/* M32 & IO segment maps */
|
|
unsigned int *m64_segmap;
|
|
unsigned int *m32_segmap;
|
|
unsigned int *io_segmap;
|
|
|
|
/* DMA32 segment maps - IODA1 only */
|
|
unsigned int dma32_count;
|
|
unsigned int *dma32_segmap;
|
|
|
|
/* IRQ chip */
|
|
int irq_chip_init;
|
|
struct irq_chip irq_chip;
|
|
|
|
/* Sorted list of used PE's based
|
|
* on the sequence of creation
|
|
*/
|
|
struct list_head pe_list;
|
|
struct mutex pe_list_mutex;
|
|
|
|
/* Reverse map of PEs, indexed by {bus, devfn} */
|
|
unsigned int pe_rmap[0x10000];
|
|
} ioda;
|
|
|
|
/* PHB and hub diagnostics */
|
|
unsigned int diag_data_size;
|
|
u8 *diag_data;
|
|
|
|
/* Nvlink2 data */
|
|
struct npu {
|
|
int index;
|
|
__be64 *mmio_atsd_regs[NV_NMMU_ATSD_REGS];
|
|
unsigned int mmio_atsd_count;
|
|
|
|
/* Bitmask for MMIO register usage */
|
|
unsigned long mmio_atsd_usage;
|
|
} npu;
|
|
|
|
#ifdef CONFIG_CXL_BASE
|
|
struct cxl_afu *cxl_afu;
|
|
#endif
|
|
int p2p_target_count;
|
|
};
|
|
|
|
extern struct pci_ops pnv_pci_ops;
|
|
extern int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
|
|
unsigned long uaddr, enum dma_data_direction direction,
|
|
unsigned long attrs);
|
|
extern void pnv_tce_free(struct iommu_table *tbl, long index, long npages);
|
|
extern int pnv_tce_xchg(struct iommu_table *tbl, long index,
|
|
unsigned long *hpa, enum dma_data_direction *direction);
|
|
extern unsigned long pnv_tce_get(struct iommu_table *tbl, long index);
|
|
|
|
void pnv_pci_dump_phb_diag_data(struct pci_controller *hose,
|
|
unsigned char *log_buff);
|
|
int pnv_pci_cfg_read(struct pci_dn *pdn,
|
|
int where, int size, u32 *val);
|
|
int pnv_pci_cfg_write(struct pci_dn *pdn,
|
|
int where, int size, u32 val);
|
|
extern struct iommu_table *pnv_pci_table_alloc(int nid);
|
|
|
|
extern long pnv_pci_link_table_and_group(int node, int num,
|
|
struct iommu_table *tbl,
|
|
struct iommu_table_group *table_group);
|
|
extern void pnv_pci_unlink_table_and_group(struct iommu_table *tbl,
|
|
struct iommu_table_group *table_group);
|
|
extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
|
|
void *tce_mem, u64 tce_size,
|
|
u64 dma_offset, unsigned page_shift);
|
|
extern void pnv_pci_init_ioda_hub(struct device_node *np);
|
|
extern void pnv_pci_init_ioda2_phb(struct device_node *np);
|
|
extern void pnv_pci_init_npu_phb(struct device_node *np);
|
|
extern void pnv_pci_reset_secondary_bus(struct pci_dev *dev);
|
|
extern int pnv_eeh_phb_reset(struct pci_controller *hose, int option);
|
|
|
|
extern void pnv_pci_dma_dev_setup(struct pci_dev *pdev);
|
|
extern void pnv_pci_dma_bus_setup(struct pci_bus *bus);
|
|
extern int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
|
|
extern void pnv_teardown_msi_irqs(struct pci_dev *pdev);
|
|
extern struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev);
|
|
extern void pnv_set_msi_irq_chip(struct pnv_phb *phb, unsigned int virq);
|
|
extern bool pnv_pci_enable_device_hook(struct pci_dev *dev);
|
|
extern void pnv_pci_ioda2_set_bypass(struct pnv_ioda_pe *pe, bool enable);
|
|
|
|
extern void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
|
|
const char *fmt, ...);
|
|
#define pe_err(pe, fmt, ...) \
|
|
pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
|
|
#define pe_warn(pe, fmt, ...) \
|
|
pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
|
|
#define pe_info(pe, fmt, ...) \
|
|
pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
|
|
|
|
/* Nvlink functions */
|
|
extern void pnv_npu_try_dma_set_bypass(struct pci_dev *gpdev, bool bypass);
|
|
extern void pnv_pci_ioda2_tce_invalidate_entire(struct pnv_phb *phb, bool rm);
|
|
extern struct pnv_ioda_pe *pnv_pci_npu_setup_iommu(struct pnv_ioda_pe *npe);
|
|
extern long pnv_npu_set_window(struct pnv_ioda_pe *npe, int num,
|
|
struct iommu_table *tbl);
|
|
extern long pnv_npu_unset_window(struct pnv_ioda_pe *npe, int num);
|
|
extern void pnv_npu_take_ownership(struct pnv_ioda_pe *npe);
|
|
extern void pnv_npu_release_ownership(struct pnv_ioda_pe *npe);
|
|
extern int pnv_npu2_init(struct pnv_phb *phb);
|
|
|
|
/* cxl functions */
|
|
extern bool pnv_cxl_enable_device_hook(struct pci_dev *dev);
|
|
extern void pnv_cxl_disable_device(struct pci_dev *dev);
|
|
extern int pnv_cxl_cx4_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type);
|
|
extern void pnv_cxl_cx4_teardown_msi_irqs(struct pci_dev *pdev);
|
|
|
|
|
|
/* phb ops (cxl switches these when enabling the kernel api on the phb) */
|
|
extern const struct pci_controller_ops pnv_cxl_cx4_ioda_controller_ops;
|
|
|
|
#endif /* __POWERNV_PCI_H */
|