提交 d5351256 编写于 作者: K Keith Busch 提交者: Caspar Zhang

PCI/AER: Abstract AER interrupt handling

task #29600094

commit 390e2db8248075ae2f31a7046a88eda0f9784310 upstream.
Backport summary: for 4.19 kernel ICX PCIe Gen4 support.

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: NKeith Busch <keith.busch@intel.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit 390e2db8248075ae2f31a7046a88eda0f9784310)
Signed-off-by: NEthan Zhao <haifeng.zhao@intel.com>
Signed-off-by: NArtie Ding <artie.ding@linux.alibaba.com>
Acked-by: NCaspar Zhang <caspar@linux.alibaba.com>
上级 75980905
...@@ -1229,7 +1229,7 @@ static irqreturn_t aer_isr(int irq, void *context) ...@@ -1229,7 +1229,7 @@ static irqreturn_t aer_isr(int irq, void *context)
* *
* Invoked when Root Port detects AER messages. * Invoked when Root Port detects AER messages.
*/ */
irqreturn_t aer_irq(int irq, void *context) static irqreturn_t aer_irq(int irq, void *context)
{ {
struct pcie_device *pdev = (struct pcie_device *)context; struct pcie_device *pdev = (struct pcie_device *)context;
struct aer_rpc *rpc = get_service_data(pdev); struct aer_rpc *rpc = get_service_data(pdev);
...@@ -1249,7 +1249,6 @@ irqreturn_t aer_irq(int irq, void *context) ...@@ -1249,7 +1249,6 @@ irqreturn_t aer_irq(int irq, void *context)
return IRQ_WAKE_THREAD; return IRQ_WAKE_THREAD;
} }
EXPORT_SYMBOL_GPL(aer_irq);
static int set_device_error_reporting(struct pci_dev *dev, void *data) static int set_device_error_reporting(struct pci_dev *dev, void *data)
{ {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -457,7 +458,9 @@ static int aer_inject(struct aer_error_inj *einj) ...@@ -457,7 +458,9 @@ static int aer_inject(struct aer_error_inj *einj)
dev_info(&edev->device, dev_info(&edev->device,
"aer_inject: Injecting errors %08x/%08x into device %s\n", "aer_inject: Injecting errors %08x/%08x into device %s\n",
einj->cor_status, einj->uncor_status, pci_name(dev)); einj->cor_status, einj->uncor_status, pci_name(dev));
aer_irq(-1, edev); local_irq_disable();
generic_handle_irq(edev->irq);
local_irq_enable();
} else { } else {
pci_err(rpdev, "aer_inject: AER device not found\n"); pci_err(rpdev, "aer_inject: AER device not found\n");
ret = -ENODEV; ret = -ENODEV;
......
...@@ -147,10 +147,6 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) ...@@ -147,10 +147,6 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
} }
#endif #endif
#ifdef CONFIG_PCIEAER
irqreturn_t aer_irq(int irq, void *context);
#endif
struct pcie_port_service_driver *pcie_port_find_service(struct pci_dev *dev, struct pcie_port_service_driver *pcie_port_find_service(struct pci_dev *dev,
u32 service); u32 service);
struct device *pcie_port_find_device(struct pci_dev *dev, u32 service); struct device *pcie_port_find_device(struct pci_dev *dev, u32 service);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册