aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 18:47:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 18:47:43 -0400
commit0d519f2d1ed1f11e49abc88cfcf6cf13b83ba14c (patch)
treefe2bfed7c6e8448f9661216610ec81f1e0c28515 /include/linux/pci.h
parent0756b7fbb696d2cb18785da9cab13ec164017f64 (diff)
parentcf2d804110d3c20dc6865ade514c44179de34855 (diff)
Merge tag 'pci-v4.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas: - add enhanced Downstream Port Containment support, which prints more details about Root Port Programmed I/O errors (Dongdong Liu) - add Layerscape ls1088a and ls2088a support (Hou Zhiqiang) - add MediaTek MT2712 and MT7622 support (Ryder Lee) - add MediaTek MT2712 and MT7622 MSI support (Honghui Zhang) - add Qualcom IPQ8074 support (Varadarajan Narayanan) - add R-Car r8a7743/5 device tree support (Biju Das) - add Rockchip per-lane PHY support for better power management (Shawn Lin) - fix IRQ mapping for hot-added devices by replacing the pci_fixup_irqs() boot-time design with a host bridge hook called at probe-time (Lorenzo Pieralisi, Matthew Minter) - fix race when enabling two devices that results in upstream bridge not being enabled correctly (Srinath Mannam) - fix pciehp power fault infinite loop (Keith Busch) - fix SHPC bridge MSI hotplug events by enabling bus mastering (Aleksandr Bezzubikov) - fix a VFIO issue by correcting PCIe capability sizes (Alex Williamson) - fix an INTD issue on Xilinx and possibly other drivers by unifying INTx IRQ domain support (Paul Burton) - avoid IOMMU stalls by marking AMD Stoney GPU ATS as broken (Joerg Roedel) - allow APM X-Gene device assignment to guests by adding an ACS quirk (Feng Kan) - fix driver crashes by disabling Extended Tags on Broadcom HT2100 (Extended Tags support is required for PCIe Receivers but not Requesters, and we now enable them by default when Requesters support them) (Sinan Kaya) - fix MSIs for devices that use phantom RIDs for DMA by assuming MSIs use the real Requester ID (not a phantom RID) (Robin Murphy) - prevent assignment of Intel VMD children to guests (which may be supported eventually, but isn't yet) by not associating an IOMMU with them (Jon Derrick) - fix Intel VMD suspend/resume by releasing IRQs on suspend (Scott Bauer) - fix a Function-Level Reset issue with Intel 750 NVMe by waiting longer (up to 60sec instead of 1sec) for device to become ready (Sinan Kaya) - fix a Function-Level Reset issue on iProc Stingray by working around hardware defects in the CRS implementation (Oza Pawandeep) - fix an issue with Intel NVMe P3700 after an iProc reset by adding a delay during shutdown (Oza Pawandeep) - fix a Microsoft Hyper-V lockdep issue by polling instead of blocking in compose_msi_msg() (Stephen Hemminger) - fix a wireless LAN driver timeout by clearing DesignWare MSI interrupt status after it is handled, not before (Faiz Abbas) - fix DesignWare ATU enable checking (Jisheng Zhang) - reduce Layerscape dependencies on the bootloader by doing more initialization in the driver (Hou Zhiqiang) - improve Intel VMD performance allowing allocation of more IRQ vectors than present CPUs (Keith Busch) - improve endpoint framework support for initial DMA mask, different BAR sizes, configurable page sizes, MSI, test driver, etc (Kishon Vijay Abraham I, Stan Drozd) - rework CRS support to add periodic messages while we poll during enumeration and after Function-Level Reset and prepare for possible other uses of CRS (Sinan Kaya) - clean up Root Port AER handling by removing unnecessary code and moving error handler methods to struct pcie_port_service_driver (Christoph Hellwig) - clean up error handling paths in various drivers (Bjorn Andersson, Fabio Estevam, Gustavo A. R. Silva, Harunobu Kurokawa, Jeffy Chen, Lorenzo Pieralisi, Sergei Shtylyov) - clean up SR-IOV resource handling by disabling VF decoding before updating the corresponding resource structs (Gavin Shan) - clean up DesignWare-based drivers by unifying quirks to update Class Code and Interrupt Pin and related handling of write-protected registers (Hou Zhiqiang) - clean up by adding empty generic pcibios_align_resource() and pcibios_fixup_bus() and removing empty arch-specific implementations (Palmer Dabbelt) - request exclusive reset control for several drivers to allow cleanup elsewhere (Philipp Zabel) - constify various structures (Arvind Yadav, Bhumika Goyal) - convert from full_name() to %pOF (Rob Herring) - remove unused variables from iProc, HiSi, Altera, Keystone (Shawn Lin) * tag 'pci-v4.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (170 commits) PCI: xgene: Clean up whitespace PCI: xgene: Define XGENE_PCI_EXP_CAP and use generic PCI_EXP_RTCTL offset PCI: xgene: Fix platform_get_irq() error handling PCI: xilinx-nwl: Fix platform_get_irq() error handling PCI: rockchip: Fix platform_get_irq() error handling PCI: altera: Fix platform_get_irq() error handling PCI: spear13xx: Fix platform_get_irq() error handling PCI: artpec6: Fix platform_get_irq() error handling PCI: armada8k: Fix platform_get_irq() error handling PCI: dra7xx: Fix platform_get_irq() error handling PCI: exynos: Fix platform_get_irq() error handling PCI: iproc: Clean up whitespace PCI: iproc: Rename PCI_EXP_CAP to IPROC_PCI_EXP_CAP PCI: iproc: Add 500ms delay during device shutdown PCI: Fix typos and whitespace errors PCI: Remove unused "res" variable from pci_resource_io() PCI: Correct kernel-doc of pci_vpd_srdt_size(), pci_vpd_srdt_tag() PCI/AER: Reformat AER register definitions iommu/vt-d: Prevent VMD child devices from being remapping targets x86/PCI: Use is_vmd() rather than relying on the domain number ...
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h62
1 files changed, 57 insertions, 5 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index da05e5db06ac..f68c58a93dd0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -102,6 +102,28 @@ enum {
102 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, 102 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES,
103}; 103};
104 104
105/**
106 * enum pci_interrupt_pin - PCI INTx interrupt values
107 * @PCI_INTERRUPT_UNKNOWN: Unknown or unassigned interrupt
108 * @PCI_INTERRUPT_INTA: PCI INTA pin
109 * @PCI_INTERRUPT_INTB: PCI INTB pin
110 * @PCI_INTERRUPT_INTC: PCI INTC pin
111 * @PCI_INTERRUPT_INTD: PCI INTD pin
112 *
113 * Corresponds to values for legacy PCI INTx interrupts, as can be found in the
114 * PCI_INTERRUPT_PIN register.
115 */
116enum pci_interrupt_pin {
117 PCI_INTERRUPT_UNKNOWN,
118 PCI_INTERRUPT_INTA,
119 PCI_INTERRUPT_INTB,
120 PCI_INTERRUPT_INTC,
121 PCI_INTERRUPT_INTD,
122};
123
124/* The number of legacy PCI INTx interrupts */
125#define PCI_NUM_INTX 4
126
105/* 127/*
106 * pci_power_t values must match the bits in the Capabilities PME_Support 128 * pci_power_t values must match the bits in the Capabilities PME_Support
107 * and Control/Status PowerState fields in the Power Management capability. 129 * and Control/Status PowerState fields in the Power Management capability.
@@ -453,6 +475,7 @@ struct pci_host_bridge {
453 void *release_data; 475 void *release_data;
454 struct msi_controller *msi; 476 struct msi_controller *msi;
455 unsigned int ignore_reset_delay:1; /* for entire hierarchy */ 477 unsigned int ignore_reset_delay:1; /* for entire hierarchy */
478 unsigned int no_ext_tags:1; /* no Extended Tags */
456 /* Resource alignment requirements */ 479 /* Resource alignment requirements */
457 resource_size_t (*align_resource)(struct pci_dev *dev, 480 resource_size_t (*align_resource)(struct pci_dev *dev,
458 const struct resource *res, 481 const struct resource *res,
@@ -847,7 +870,6 @@ char *pcibios_setup(char *str);
847resource_size_t pcibios_align_resource(void *, const struct resource *, 870resource_size_t pcibios_align_resource(void *, const struct resource *,
848 resource_size_t, 871 resource_size_t,
849 resource_size_t); 872 resource_size_t);
850void pcibios_update_irq(struct pci_dev *, int irq);
851 873
852/* Weak but can be overriden by arch */ 874/* Weak but can be overriden by arch */
853void pci_fixup_cardbus(struct pci_bus *); 875void pci_fixup_cardbus(struct pci_bus *);
@@ -1165,8 +1187,6 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
1165void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus); 1187void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
1166void pdev_enable_device(struct pci_dev *); 1188void pdev_enable_device(struct pci_dev *);
1167int pci_enable_resources(struct pci_dev *, int mask); 1189int pci_enable_resources(struct pci_dev *, int mask);
1168void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
1169 int (*)(const struct pci_dev *, u8, u8));
1170void pci_assign_irq(struct pci_dev *dev); 1190void pci_assign_irq(struct pci_dev *dev);
1171struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res); 1191struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res);
1172#define HAVE_PCI_REQ_REGIONS 2 1192#define HAVE_PCI_REQ_REGIONS 2
@@ -1399,6 +1419,38 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
1399 NULL); 1419 NULL);
1400} 1420}
1401 1421
1422/**
1423 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
1424 * @d: the INTx IRQ domain
1425 * @node: the DT node for the device whose interrupt we're translating
1426 * @intspec: the interrupt specifier data from the DT
1427 * @intsize: the number of entries in @intspec
1428 * @out_hwirq: pointer at which to write the hwirq number
1429 * @out_type: pointer at which to write the interrupt type
1430 *
1431 * Translate a PCI INTx interrupt number from device tree in the range 1-4, as
1432 * stored in the standard PCI_INTERRUPT_PIN register, to a value in the range
1433 * 0-3 suitable for use in a 4 entry IRQ domain. That is, subtract one from the
1434 * INTx value to obtain the hwirq number.
1435 *
1436 * Returns 0 on success, or -EINVAL if the interrupt specifier is out of range.
1437 */
1438static inline int pci_irqd_intx_xlate(struct irq_domain *d,
1439 struct device_node *node,
1440 const u32 *intspec,
1441 unsigned int intsize,
1442 unsigned long *out_hwirq,
1443 unsigned int *out_type)
1444{
1445 const u32 intx = intspec[0];
1446
1447 if (intx < PCI_INTERRUPT_INTA || intx > PCI_INTERRUPT_INTD)
1448 return -EINVAL;
1449
1450 *out_hwirq = intx - PCI_INTERRUPT_INTA;
1451 return 0;
1452}
1453
1402#ifdef CONFIG_PCIEPORTBUS 1454#ifdef CONFIG_PCIEPORTBUS
1403extern bool pcie_ports_disabled; 1455extern bool pcie_ports_disabled;
1404extern bool pcie_ports_auto; 1456extern bool pcie_ports_auto;
@@ -2064,7 +2116,7 @@ static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
2064 2116
2065/** 2117/**
2066 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length 2118 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
2067 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag 2119 * @srdt: Pointer to the beginning of the Small Resource Data Type tag
2068 * 2120 *
2069 * Returns the extracted Small Resource Data Type length. 2121 * Returns the extracted Small Resource Data Type length.
2070 */ 2122 */
@@ -2075,7 +2127,7 @@ static inline u8 pci_vpd_srdt_size(const u8 *srdt)
2075 2127
2076/** 2128/**
2077 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item 2129 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
2078 * @lrdt: Pointer to the beginning of the Small Resource Data Type tag 2130 * @srdt: Pointer to the beginning of the Small Resource Data Type tag
2079 * 2131 *
2080 * Returns the extracted Small Resource Data Type Tag Item. 2132 * Returns the extracted Small Resource Data Type Tag Item.
2081 */ 2133 */