powerpc/kexec: make masking/disabling interrupts generic
authorMatthew McClintock <msm@freescale.com>
Thu, 16 Sep 2010 22:58:23 +0000 (17:58 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Thu, 14 Oct 2010 05:52:46 +0000 (00:52 -0500)
Right now just the kexec crash pathway turns turns off the interrupts.
Pull that out and make a generic version for use elsewhere

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/include/asm/kexec.h
arch/powerpc/kernel/crash.c
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/machine_kexec_32.c

index 076327f2eff777b2cdbd4e15de8336ce7b03faa6..f54408d995b5b9df718f818f4fdf16d37c796517 100644 (file)
@@ -91,6 +91,7 @@ extern void machine_kexec_simple(struct kimage *image);
 extern void crash_kexec_secondary(struct pt_regs *regs);
 extern int overlaps_crashkernel(unsigned long start, unsigned long size);
 extern void reserve_crashkernel(void);
+extern void machine_kexec_mask_interrupts(void);
 
 #else /* !CONFIG_KEXEC */
 static inline int kexec_sr_activated(int cpu) { return 0; }
index 4457382f8667a7e770f51c9cb82ee09f9531fb1b..832c8c4db2541225ad007f5592b60ec8fe14776d 100644 (file)
@@ -414,18 +414,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
        crash_kexec_wait_realmode(crashing_cpu);
 #endif
 
-       for_each_irq(i) {
-               struct irq_desc *desc = irq_to_desc(i);
-
-               if (!desc || !desc->chip || !desc->chip->eoi)
-                       continue;
-
-               if (desc->status & IRQ_INPROGRESS)
-                       desc->chip->eoi(i);
-
-               if (!(desc->status & IRQ_DISABLED))
-                       desc->chip->shutdown(i);
-       }
+       machine_kexec_mask_interrupts();
 
        /*
         * Call registered shutdown routines savely.  Swap out
index dd6c141f166261b7970c42023f8b96a0ccf3085f..df7e20c191cda3190c1396bc60921bd8c8df003f 100644 (file)
 #include <linux/threads.h>
 #include <linux/memblock.h>
 #include <linux/of.h>
+#include <linux/irq.h>
+
 #include <asm/machdep.h>
 #include <asm/prom.h>
 #include <asm/sections.h>
 
+void machine_kexec_mask_interrupts(void) {
+       unsigned int i;
+
+       for_each_irq(i) {
+               struct irq_desc *desc = irq_to_desc(i);
+
+               if (!desc || !desc->chip)
+                       continue;
+
+               if (desc->chip->eoi &&
+                   desc->status & IRQ_INPROGRESS)
+                       desc->chip->eoi(i);
+
+               if (desc->chip->mask)
+                       desc->chip->mask(i);
+
+               if (desc->chip->disable &&
+                   !(desc->status & IRQ_DISABLED))
+                       desc->chip->disable(i);
+       }
+}
+
 void machine_crash_shutdown(struct pt_regs *regs)
 {
        if (ppc_md.machine_crash_shutdown)
index ae63a964b858049f63a47e446e96bb54295a6c0c..e63f2e7d2efb029fca417c344ecee0d9e96daf88 100644 (file)
@@ -39,6 +39,10 @@ void default_machine_kexec(struct kimage *image)
        /* Interrupts aren't acceptable while we reboot */
        local_irq_disable();
 
+       /* mask each interrupt so we are in a more sane state for the
+        * kexec kernel */
+       machine_kexec_mask_interrupts();
+
        page_list = image->head;
 
        /* we need both effective and real address here */