Merge tag 'powerpc-4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[cascardo/linux.git] / arch / powerpc / kernel / irq.c
index 08887cf..3c05c31 100644 (file)
@@ -67,6 +67,7 @@
 #include <asm/smp.h>
 #include <asm/debug.h>
 #include <asm/livepatch.h>
+#include <asm/asm-prototypes.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/paca.h>
@@ -155,6 +156,15 @@ notrace unsigned int __check_irq_replay(void)
                lv1_get_version_info(&tmp, &tmp2);
        }
 
+       /*
+        * Check if an hypervisor Maintenance interrupt happened.
+        * This is a higher priority interrupt than the others, so
+        * replay it first.
+        */
+       local_paca->irq_happened &= ~PACA_IRQ_HMI;
+       if (happened & PACA_IRQ_HMI)
+               return 0xe60;
+
        /*
         * We may have missed a decrementer interrupt. We check the
         * decrementer itself rather than the paca irq_happened field
@@ -190,11 +200,6 @@ notrace unsigned int __check_irq_replay(void)
        }
 #endif /* CONFIG_PPC_BOOK3E */
 
-       /* Check if an hypervisor Maintenance interrupt happened */
-       local_paca->irq_happened &= ~PACA_IRQ_HMI;
-       if (happened & PACA_IRQ_HMI)
-               return 0xe60;
-
        /* There should be nothing left ! */
        BUG_ON(local_paca->irq_happened != 0);
 
@@ -514,7 +519,7 @@ void __do_irq(struct pt_regs *regs)
        may_hard_irq_enable();
 
        /* And finally process it */
-       if (unlikely(irq == NO_IRQ))
+       if (unlikely(!irq))
                __this_cpu_inc(irq_stat.spurious_irqs);
        else
                generic_handle_irq(irq);