Commit c71635d2 authored by Matthew McClintock's avatar Matthew McClintock Committed by Kumar Gala

powerpc/kexec: make masking/disabling interrupts generic

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: default avatarMatthew McClintock <msm@freescale.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent fbdd7144
...@@ -91,6 +91,7 @@ extern void machine_kexec_simple(struct kimage *image); ...@@ -91,6 +91,7 @@ extern void machine_kexec_simple(struct kimage *image);
extern void crash_kexec_secondary(struct pt_regs *regs); extern void crash_kexec_secondary(struct pt_regs *regs);
extern int overlaps_crashkernel(unsigned long start, unsigned long size); extern int overlaps_crashkernel(unsigned long start, unsigned long size);
extern void reserve_crashkernel(void); extern void reserve_crashkernel(void);
extern void machine_kexec_mask_interrupts(void);
#else /* !CONFIG_KEXEC */ #else /* !CONFIG_KEXEC */
static inline int kexec_sr_activated(int cpu) { return 0; } static inline int kexec_sr_activated(int cpu) { return 0; }
......
...@@ -414,18 +414,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs) ...@@ -414,18 +414,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
crash_kexec_wait_realmode(crashing_cpu); crash_kexec_wait_realmode(crashing_cpu);
#endif #endif
for_each_irq(i) { machine_kexec_mask_interrupts();
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);
}
/* /*
* Call registered shutdown routines savely. Swap out * Call registered shutdown routines savely. Swap out
......
...@@ -14,10 +14,34 @@ ...@@ -14,10 +14,34 @@
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/irq.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/sections.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) void machine_crash_shutdown(struct pt_regs *regs)
{ {
if (ppc_md.machine_crash_shutdown) if (ppc_md.machine_crash_shutdown)
......
...@@ -39,6 +39,10 @@ void default_machine_kexec(struct kimage *image) ...@@ -39,6 +39,10 @@ void default_machine_kexec(struct kimage *image)
/* Interrupts aren't acceptable while we reboot */ /* Interrupts aren't acceptable while we reboot */
local_irq_disable(); 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; page_list = image->head;
/* we need both effective and real address here */ /* we need both effective and real address here */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment