diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-08 22:03:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-08 22:03:25 -0400 |
commit | 857f8640147c9fb43f20e43cbca6452710e1ca5d (patch) | |
tree | 76a92068d703b8001ca790ffa096d435fa24ae81 /drivers/pci/irq.c | |
parent | 8f3207c7eab9d885cc64c778416537034a7d9c5b (diff) | |
parent | 3146c8f4de9b0858794a902f273aec13f168596e (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/irq.c')
-rw-r--r-- | drivers/pci/irq.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c index f9f2a0324ecc..83d30953ce19 100644 --- a/drivers/pci/irq.c +++ b/drivers/pci/irq.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * PCI IRQ failure handing code | 2 | * PCI IRQ handling code |
3 | * | 3 | * |
4 | * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> | 4 | * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> |
5 | * Copyright (C) 2017 Christoph Hellwig. | ||
5 | */ | 6 | */ |
6 | 7 | ||
7 | #include <linux/acpi.h> | 8 | #include <linux/acpi.h> |
@@ -59,3 +60,61 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) | |||
59 | return PCI_LOST_IRQ_NO_INFORMATION; | 60 | return PCI_LOST_IRQ_NO_INFORMATION; |
60 | } | 61 | } |
61 | EXPORT_SYMBOL(pci_lost_interrupt); | 62 | EXPORT_SYMBOL(pci_lost_interrupt); |
63 | |||
64 | /** | ||
65 | * pci_request_irq - allocate an interrupt line for a PCI device | ||
66 | * @dev: PCI device to operate on | ||
67 | * @nr: device-relative interrupt vector index (0-based). | ||
68 | * @handler: Function to be called when the IRQ occurs. | ||
69 | * Primary handler for threaded interrupts. | ||
70 | * If NULL and thread_fn != NULL the default primary handler is | ||
71 | * installed. | ||
72 | * @thread_fn: Function called from the IRQ handler thread | ||
73 | * If NULL, no IRQ thread is created | ||
74 | * @dev_id: Cookie passed back to the handler function | ||
75 | * @fmt: Printf-like format string naming the handler | ||
76 | * | ||
77 | * This call allocates interrupt resources and enables the interrupt line and | ||
78 | * IRQ handling. From the point this call is made @handler and @thread_fn may | ||
79 | * be invoked. All interrupts requested using this function might be shared. | ||
80 | * | ||
81 | * @dev_id must not be NULL and must be globally unique. | ||
82 | */ | ||
83 | int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler, | ||
84 | irq_handler_t thread_fn, void *dev_id, const char *fmt, ...) | ||
85 | { | ||
86 | va_list ap; | ||
87 | int ret; | ||
88 | char *devname; | ||
89 | |||
90 | va_start(ap, fmt); | ||
91 | devname = kvasprintf(GFP_KERNEL, fmt, ap); | ||
92 | va_end(ap); | ||
93 | |||
94 | ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn, | ||
95 | IRQF_SHARED, devname, dev_id); | ||
96 | if (ret) | ||
97 | kfree(devname); | ||
98 | return ret; | ||
99 | } | ||
100 | EXPORT_SYMBOL(pci_request_irq); | ||
101 | |||
102 | /** | ||
103 | * pci_free_irq - free an interrupt allocated with pci_request_irq | ||
104 | * @dev: PCI device to operate on | ||
105 | * @nr: device-relative interrupt vector index (0-based). | ||
106 | * @dev_id: Device identity to free | ||
107 | * | ||
108 | * Remove an interrupt handler. The handler is removed and if the interrupt | ||
109 | * line is no longer in use by any driver it is disabled. The caller must | ||
110 | * ensure the interrupt is disabled on the device before calling this function. | ||
111 | * The function does not return until any executing interrupts for this IRQ | ||
112 | * have completed. | ||
113 | * | ||
114 | * This function must not be called from interrupt context. | ||
115 | */ | ||
116 | void pci_free_irq(struct pci_dev *dev, unsigned int nr, void *dev_id) | ||
117 | { | ||
118 | kfree(free_irq(pci_irq_vector(dev, nr), dev_id)); | ||
119 | } | ||
120 | EXPORT_SYMBOL(pci_free_irq); | ||