The patch intends to register OPAL event notifier and process the
PCI errors from firmware. If we have pending PCI errors, the kthread
will be invoked to handle that in turn.
Signed-off-by: Gavin Shan <redacted>
---
arch/powerpc/platforms/powernv/pci-err.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-err.c b/arch/powerpc/platforms/powernv/pci-err.c
index e54135b..9b5c4ae 100644
--- a/arch/powerpc/platforms/powernv/pci-err.c
+++ b/arch/powerpc/platforms/powernv/pci-err.c
@@ -425,6 +425,13 @@ static void pci_err_process(struct pci_controller *hose,
}
}
+static void pci_err_event(u64 event)
+{
+ /* Notify kthread to process error */
+ if (event & OPAL_EVENT_PCI_ERROR)
+ up(&pci_err_int_sem);
+}
+
static int pci_err_handler(void *dummy)
{
struct pnv_phb *phb;@@ -513,6 +520,16 @@ static int __init pci_err_init(void)
return ret;
}
+ /* Register OPAL event notifier */
+ ret = opal_notifier_register(OPAL_EVENT_PCI_ERROR, pci_err_event);
+ if (ret) {
+ kthread_stop(pci_err_thread);
+ free_page((unsigned long)pci_err_diag);
+ pr_err("%s: Failed to register OPAL notifier, rc=%d\n",
+ __func__, ret);
+ return ret;
+ }
+
return 0;
}
--
1.7.5.4