These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / powerpc / platforms / powernv / opal-elog.c
index 38ce757..37f959b 100644 (file)
@@ -10,6 +10,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
@@ -236,7 +237,7 @@ static struct elog_obj *create_elog_obj(uint64_t id, size_t size, uint64_t type)
        return elog;
 }
 
-static void elog_work_fn(struct work_struct *work)
+static irqreturn_t elog_event(int irq, void *data)
 {
        __be64 size;
        __be64 id;
@@ -250,7 +251,7 @@ static void elog_work_fn(struct work_struct *work)
        rc = opal_get_elog_size(&id, &size, &type);
        if (rc != OPAL_SUCCESS) {
                pr_err("ELOG: OPAL log info read failed\n");
-               return;
+               return IRQ_HANDLED;
        }
 
        elog_size = be64_to_cpu(size);
@@ -269,31 +270,16 @@ static void elog_work_fn(struct work_struct *work)
         * entries.
         */
        if (kset_find_obj(elog_kset, name))
-               return;
+               return IRQ_HANDLED;
 
        create_elog_obj(log_id, elog_size, elog_type);
-}
-
-static DECLARE_WORK(elog_work, elog_work_fn);
 
-static int elog_event(struct notifier_block *nb,
-                               unsigned long events, void *change)
-{
-       /* check for error log event */
-       if (events & OPAL_EVENT_ERROR_LOG_AVAIL)
-               schedule_work(&elog_work);
-       return 0;
+       return IRQ_HANDLED;
 }
 
-static struct notifier_block elog_nb = {
-       .notifier_call  = elog_event,
-       .next           = NULL,
-       .priority       = 0
-};
-
 int __init opal_elog_init(void)
 {
-       int rc = 0;
+       int rc = 0, irq;
 
        /* ELOG not supported by firmware */
        if (!opal_check_token(OPAL_ELOG_READ))
@@ -305,10 +291,18 @@ int __init opal_elog_init(void)
                return -1;
        }
 
-       rc = opal_notifier_register(&elog_nb);
+       irq = opal_event_request(ilog2(OPAL_EVENT_ERROR_LOG_AVAIL));
+       if (!irq) {
+               pr_err("%s: Can't register OPAL event irq (%d)\n",
+                      __func__, irq);
+               return irq;
+       }
+
+       rc = request_threaded_irq(irq, NULL, elog_event,
+                       IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "opal-elog", NULL);
        if (rc) {
-               pr_err("%s: Can't register OPAL event notifier (%d)\n",
-               __func__, rc);
+               pr_err("%s: Can't request OPAL event irq (%d)\n",
+                      __func__, rc);
                return rc;
        }