Skip to content

Commit 390e2db

Browse files
Keith Buschbjorn-helgaas
authored andcommitted
PCI/AER: Abstract AER interrupt handling
The aer_inject module was directly calling aer_irq(). This required the AER driver export its private IRQ handler for no other reason than to support error injection. A driver should not have to expose its private interfaces, so use the IRQ subsystem to route injection to the AER driver, and make aer_irq() a private interface. This provides additional benefits: First, directly calling the IRQ handler bypassed the IRQ subsytem so the injection wasn't really synthesizing what happens if a shared AER interrupt occurs. The error injection had to provide the callback data directly, which may be racing with a removal that is freeing that structure. The IRQ subsystem can handle that race. Finally, using the IRQ subsystem automatically reacts to threaded IRQs, keeping the error injection abstracted from that implementation detail. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 0e98db2 commit 390e2db

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

drivers/pci/pcie/aer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ static irqreturn_t aer_isr(int irq, void *context)
12291229
*
12301230
* Invoked when Root Port detects AER messages.
12311231
*/
1232-
irqreturn_t aer_irq(int irq, void *context)
1232+
static irqreturn_t aer_irq(int irq, void *context)
12331233
{
12341234
struct pcie_device *pdev = (struct pcie_device *)context;
12351235
struct aer_rpc *rpc = get_service_data(pdev);
@@ -1249,7 +1249,6 @@ irqreturn_t aer_irq(int irq, void *context)
12491249

12501250
return IRQ_WAKE_THREAD;
12511251
}
1252-
EXPORT_SYMBOL_GPL(aer_irq);
12531252

12541253
static int set_device_error_reporting(struct pci_dev *dev, void *data)
12551254
{

drivers/pci/pcie/aer_inject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <linux/module.h>
1616
#include <linux/init.h>
17+
#include <linux/irq.h>
1718
#include <linux/miscdevice.h>
1819
#include <linux/pci.h>
1920
#include <linux/slab.h>
@@ -457,7 +458,9 @@ static int aer_inject(struct aer_error_inj *einj)
457458
dev_info(&edev->device,
458459
"aer_inject: Injecting errors %08x/%08x into device %s\n",
459460
einj->cor_status, einj->uncor_status, pci_name(dev));
460-
aer_irq(-1, edev);
461+
local_irq_disable();
462+
generic_handle_irq(edev->irq);
463+
local_irq_enable();
461464
} else {
462465
pci_err(rpdev, "aer_inject: AER device not found\n");
463466
ret = -ENODEV;

drivers/pci/pcie/portdrv.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
151151
}
152152
#endif
153153

154-
#ifdef CONFIG_PCIEAER
155-
irqreturn_t aer_irq(int irq, void *context);
156-
#endif
157-
158154
struct pcie_port_service_driver *pcie_port_find_service(struct pci_dev *dev,
159155
u32 service);
160156
struct device *pcie_port_find_device(struct pci_dev *dev, u32 service);

0 commit comments

Comments
 (0)