aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/access.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 22:03:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 22:03:25 -0400
commit857f8640147c9fb43f20e43cbca6452710e1ca5d (patch)
tree76a92068d703b8001ca790ffa096d435fa24ae81 /drivers/pci/access.c
parent8f3207c7eab9d885cc64c778416537034a7d9c5b (diff)
parent3146c8f4de9b0858794a902f273aec13f168596e (diff)
Merge tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas: - add framework for supporting PCIe devices in Endpoint mode (Kishon Vijay Abraham I) - use non-postable PCI config space mappings when possible (Lorenzo Pieralisi) - clean up and unify mmap of PCI BARs (David Woodhouse) - export and unify Function Level Reset support (Christoph Hellwig) - avoid FLR for Intel 82579 NICs (Sasha Neftin) - add pci_request_irq() and pci_free_irq() helpers (Christoph Hellwig) - short-circuit config access failures for disconnected devices (Keith Busch) - remove D3 sleep delay when possible (Adrian Hunter) - freeze PME scan before suspending devices (Lukas Wunner) - stop disabling MSI/MSI-X in pci_device_shutdown() (Prarit Bhargava) - disable boot interrupt quirk for ASUS M2N-LR (Stefan Assmann) - add arch-specific alignment control to improve device passthrough by avoiding multiple BARs in a page (Yongji Xie) - add sysfs sriov_drivers_autoprobe to control VF driver binding (Bodong Wang) - allow slots below PCI-to-PCIe "reverse bridges" (Bjorn Helgaas) - fix crashes when unbinding host controllers that don't support removal (Brian Norris) - add driver for MicroSemi Switchtec management interface (Logan Gunthorpe) - add driver for Faraday Technology FTPCI100 host bridge (Linus Walleij) - add i.MX7D support (Andrey Smirnov) - use generic MSI support for Aardvark (Thomas Petazzoni) - make Rockchip driver modular (Brian Norris) - advertise 128-byte Read Completion Boundary support for Rockchip (Shawn Lin) - advertise PCI_EXP_LNKSTA_SLC for Rockchip root port (Shawn Lin) - convert atomic_t to refcount_t in HV driver (Elena Reshetova) - add CPU IRQ affinity in HV driver (K. Y. Srinivasan) - fix PCI bus removal in HV driver (Long Li) - add support for ThunderX2 DMA alias topology (Jayachandran C) - add ThunderX pass2.x 2nd node MCFG quirk (Tomasz Nowicki) - add ITE 8893 bridge DMA alias quirk (Jarod Wilson) - restrict Cavium ACS quirk only to CN81xx/CN83xx/CN88xx devices (Manish Jaggi) * tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (146 commits) PCI: Don't allow unbinding host controllers that aren't prepared ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP MAINTAINERS: Add PCI Endpoint maintainer Documentation: PCI: Add userguide for PCI endpoint test function tools: PCI: Add sample test script to invoke pcitest tools: PCI: Add a userspace tool to test PCI endpoint Documentation: misc-devices: Add Documentation for pci-endpoint-test driver misc: Add host side PCI driver for PCI test function device PCI: Add device IDs for DRA74x and DRA72x dt-bindings: PCI: dra7xx: Add DT bindings to enable unaligned access PCI: dwc: dra7xx: Workaround for errata id i870 dt-bindings: PCI: dra7xx: Add DT bindings for PCI dra7xx EP mode PCI: dwc: dra7xx: Add EP mode support PCI: dwc: dra7xx: Facilitate wrapper and MSI interrupts to be enabled independently dt-bindings: PCI: Add DT bindings for PCI designware EP mode PCI: dwc: designware: Add EP mode support Documentation: PCI: Add binding documentation for pci-test endpoint function ixgbe: Use pcie_flr() instead of duplicating it IB/hfi1: Use pcie_flr() instead of duplicating it PCI: imx6: Fix spelling mistake: "contol" -> "control" ...
Diffstat (limited to 'drivers/pci/access.c')
-rw-r--r--drivers/pci/access.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 8b7382705bf2..74cf5fffb1e1 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -629,7 +629,7 @@ void pci_vpd_release(struct pci_dev *dev)
629 * 629 *
630 * When access is locked, any userspace reads or writes to config 630 * When access is locked, any userspace reads or writes to config
631 * space and concurrent lock requests will sleep until access is 631 * space and concurrent lock requests will sleep until access is
632 * allowed via pci_cfg_access_unlocked again. 632 * allowed via pci_cfg_access_unlock() again.
633 */ 633 */
634void pci_cfg_access_lock(struct pci_dev *dev) 634void pci_cfg_access_lock(struct pci_dev *dev)
635{ 635{
@@ -700,7 +700,8 @@ static bool pcie_downstream_port(const struct pci_dev *dev)
700 int type = pci_pcie_type(dev); 700 int type = pci_pcie_type(dev);
701 701
702 return type == PCI_EXP_TYPE_ROOT_PORT || 702 return type == PCI_EXP_TYPE_ROOT_PORT ||
703 type == PCI_EXP_TYPE_DOWNSTREAM; 703 type == PCI_EXP_TYPE_DOWNSTREAM ||
704 type == PCI_EXP_TYPE_PCIE_BRIDGE;
704} 705}
705 706
706bool pcie_cap_has_lnkctl(const struct pci_dev *dev) 707bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
@@ -890,3 +891,59 @@ int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
890 return ret; 891 return ret;
891} 892}
892EXPORT_SYMBOL(pcie_capability_clear_and_set_dword); 893EXPORT_SYMBOL(pcie_capability_clear_and_set_dword);
894
895int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
896{
897 if (pci_dev_is_disconnected(dev)) {
898 *val = ~0;
899 return -ENODEV;
900 }
901 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
902}
903EXPORT_SYMBOL(pci_read_config_byte);
904
905int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
906{
907 if (pci_dev_is_disconnected(dev)) {
908 *val = ~0;
909 return -ENODEV;
910 }
911 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
912}
913EXPORT_SYMBOL(pci_read_config_word);
914
915int pci_read_config_dword(const struct pci_dev *dev, int where,
916 u32 *val)
917{
918 if (pci_dev_is_disconnected(dev)) {
919 *val = ~0;
920 return -ENODEV;
921 }
922 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
923}
924EXPORT_SYMBOL(pci_read_config_dword);
925
926int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
927{
928 if (pci_dev_is_disconnected(dev))
929 return -ENODEV;
930 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
931}
932EXPORT_SYMBOL(pci_write_config_byte);
933
934int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
935{
936 if (pci_dev_is_disconnected(dev))
937 return -ENODEV;
938 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
939}
940EXPORT_SYMBOL(pci_write_config_word);
941
942int pci_write_config_dword(const struct pci_dev *dev, int where,
943 u32 val)
944{
945 if (pci_dev_is_disconnected(dev))
946 return -ENODEV;
947 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
948}
949EXPORT_SYMBOL(pci_write_config_dword);