[PATCH 4/8] powernv/eeh: Update the EEH code to use the opal irq domain
Alistair Popple
alistair at popple.id.au
Thu Apr 2 14:22:28 AEDT 2015
The eeh code currently uses the old notifier method to get eeh events
from OPAL. It also contains some logic to filter opal events which has
been moved into the virtual irqchip. This patch converts the eeh code
to the new event interface which simplifies event handling.
Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
arch/powerpc/platforms/powernv/eeh-ioda.c | 39 ++++++++++++++-----------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 2809c98..6eee1d1 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -15,6 +15,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/msi.h>
#include <linux/notifier.h>
@@ -36,34 +37,20 @@
static int ioda_eeh_nb_init = 0;
-static int ioda_eeh_event(struct notifier_block *nb,
- unsigned long events, void *change)
+static irqreturn_t ioda_eeh_event(int irq, void *data)
{
- uint64_t changed_evts = (uint64_t)change;
-
/*
* We simply send special EEH event if EEH has
* been enabled, or clear pending events in
* case that we enable EEH soon
*/
- if (!(changed_evts & OPAL_EVENT_PCI_ERROR) ||
- !(events & OPAL_EVENT_PCI_ERROR))
- return 0;
if (eeh_enabled())
eeh_send_failure_event(NULL);
- else
- opal_notifier_update_evt(OPAL_EVENT_PCI_ERROR, 0x0ul);
- return 0;
+ return IRQ_HANDLED;
}
-static struct notifier_block ioda_eeh_nb = {
- .notifier_call = ioda_eeh_event,
- .next = NULL,
- .priority = 0
-};
-
#ifdef CONFIG_DEBUG_FS
static ssize_t ioda_eeh_ei_write(struct file *filp,
const char __user *user_buf,
@@ -181,14 +168,23 @@ DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get,
static int ioda_eeh_post_init(struct pci_controller *hose)
{
struct pnv_phb *phb = hose->private_data;
- int ret;
+ int irq, ret;
/* Register OPAL event notifier */
if (!ioda_eeh_nb_init) {
- ret = opal_notifier_register(&ioda_eeh_nb);
- if (ret) {
- pr_err("%s: Can't register OPAL event notifier (%d)\n",
- __func__, ret);
+ irq = opal_event_request(ilog2(OPAL_EVENT_PCI_ERROR));
+ if (irq < 0) {
+ pr_err("%s: Can't register OPAL event interrupt (%d)\n",
+ __func__, irq);
+ return irq;
+ }
+
+ ret = request_irq(irq, ioda_eeh_event, IRQ_TYPE_EDGE_RISING,
+ "opal-eeh", NULL);
+ if (ret < 0) {
+ irq_dispose_mapping(irq);
+ pr_err("%s: Can't request OPAL event interrupt (%d)\n",
+ __func__, irq);
return ret;
}
@@ -969,7 +965,6 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
* between the kernel and firmware.
*/
eeh_remove_event(NULL, false);
- opal_notifier_update_evt(OPAL_EVENT_PCI_ERROR, 0x0ul);
list_for_each_entry(hose, &hose_list, list_node) {
/*
--
1.8.3.2
More information about the Linuxppc-dev
mailing list