2019-06-03 13:44:46 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-12-04 15:39:43 +08:00
|
|
|
/*
|
|
|
|
* Architecture specific (PPC64) functions for kexec based crash dumps.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005, IBM Corp.
|
|
|
|
*
|
|
|
|
* Created by: Haren Myneni
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/reboot.h>
|
|
|
|
#include <linux/kexec.h>
|
2011-05-27 22:46:24 +08:00
|
|
|
#include <linux/export.h>
|
2005-12-04 15:39:43 +08:00
|
|
|
#include <linux/crash_dump.h>
|
|
|
|
#include <linux/delay.h>
|
2006-04-04 19:43:01 +08:00
|
|
|
#include <linux/irq.h>
|
2005-12-04 15:39:43 +08:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/machdep.h>
|
2006-06-24 06:29:34 +08:00
|
|
|
#include <asm/kexec.h>
|
2008-02-14 08:56:49 +08:00
|
|
|
#include <asm/prom.h>
|
2006-01-11 11:25:25 +08:00
|
|
|
#include <asm/smp.h>
|
2008-01-18 12:50:30 +08:00
|
|
|
#include <asm/setjmp.h>
|
2012-03-29 01:30:02 +08:00
|
|
|
#include <asm/debug.h>
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2011-11-30 08:23:16 +08:00
|
|
|
/*
|
|
|
|
* The primary CPU waits a while for all secondary CPUs to enter. This is to
|
|
|
|
* avoid sending an IPI if the secondary CPUs are entering
|
|
|
|
* crash_kexec_secondary on their own (eg via a system reset).
|
|
|
|
*
|
|
|
|
* The secondary timeout has to be longer than the primary. Both timeouts are
|
|
|
|
* in milliseconds.
|
|
|
|
*/
|
|
|
|
#define PRIMARY_TIMEOUT 500
|
|
|
|
#define SECONDARY_TIMEOUT 1000
|
|
|
|
|
|
|
|
#define IPI_TIMEOUT 10000
|
|
|
|
#define REAL_MODE_TIMEOUT 10000
|
|
|
|
|
2011-11-30 08:23:17 +08:00
|
|
|
static int time_to_dump;
|
2017-12-15 16:14:55 +08:00
|
|
|
/*
|
|
|
|
* crash_wake_offline should be set to 1 by platforms that intend to wake
|
|
|
|
* up offline cpus prior to jumping to a kdump kernel. Currently powernv
|
|
|
|
* sets it to 1, since we want to avoid things from happening when an
|
|
|
|
* offline CPU wakes up due to something like an HMI (malfunction error),
|
|
|
|
* which propagates to all threads.
|
|
|
|
*/
|
|
|
|
int crash_wake_offline;
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2011-01-21 10:43:59 +08:00
|
|
|
#define CRASH_HANDLER_MAX 3
|
2016-05-11 08:57:32 +08:00
|
|
|
/* List of shutdown handles */
|
|
|
|
static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX];
|
2008-01-18 12:50:30 +08:00
|
|
|
static DEFINE_SPINLOCK(crash_handlers_lock);
|
|
|
|
|
2011-11-30 08:23:11 +08:00
|
|
|
static unsigned long crash_shutdown_buf[JMP_BUF_LEN];
|
|
|
|
static int crash_shutdown_cpu = -1;
|
|
|
|
|
|
|
|
static int handle_fault(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
if (crash_shutdown_cpu == smp_processor_id())
|
|
|
|
longjmp(crash_shutdown_buf, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
|
2012-01-18 03:13:05 +08:00
|
|
|
static atomic_t cpus_in_crash;
|
2017-12-15 16:14:55 +08:00
|
|
|
void crash_ipi_callback(struct pt_regs *regs)
|
2005-12-04 15:39:43 +08:00
|
|
|
{
|
2011-11-30 08:23:17 +08:00
|
|
|
static cpumask_t cpus_state_saved = CPU_MASK_NONE;
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
int cpu = smp_processor_id();
|
|
|
|
|
[POWERPC] Lazy interrupt disabling for 64-bit machines
This implements a lazy strategy for disabling interrupts. This means
that local_irq_disable() et al. just clear the 'interrupts are
enabled' flag in the paca. If an interrupt comes along, the interrupt
entry code notices that interrupts are supposed to be disabled, and
clears the EE bit in SRR1, clears the 'interrupts are hard-enabled'
flag in the paca, and returns. This means that interrupts only
actually get disabled in the processor when an interrupt comes along.
When interrupts are enabled by local_irq_enable() et al., the code
sets the interrupts-enabled flag in the paca, and then checks whether
interrupts got hard-disabled. If so, it also sets the EE bit in the
MSR to hard-enable the interrupts.
This has the potential to improve performance, and also makes it
easier to make a kernel that can boot on iSeries and on other 64-bit
machines, since this lazy-disable strategy is very similar to the
soft-disable strategy that iSeries already uses.
This version renames paca->proc_enabled to paca->soft_enabled, and
changes a couple of soft-disables in the kexec code to hard-disables,
which should fix the crash that Michael Ellerman saw. This doesn't
yet use a reserved CR field for the soft_enabled and hard_enabled
flags. This applies on top of Stephen Rothwell's patches to make it
possible to build a combined iSeries/other kernel.
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-04 14:47:49 +08:00
|
|
|
hard_irq_disable();
|
2011-11-30 08:23:17 +08:00
|
|
|
if (!cpumask_test_cpu(cpu, &cpus_state_saved)) {
|
2006-12-07 12:40:41 +08:00
|
|
|
crash_save_cpu(regs, cpu);
|
2011-11-30 08:23:17 +08:00
|
|
|
cpumask_set_cpu(cpu, &cpus_state_saved);
|
|
|
|
}
|
|
|
|
|
|
|
|
atomic_inc(&cpus_in_crash);
|
2014-03-14 02:00:35 +08:00
|
|
|
smp_mb__after_atomic();
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
/*
|
|
|
|
* Starting the kdump boot.
|
|
|
|
* This barrier is needed to make sure that all CPUs are stopped.
|
|
|
|
*/
|
2011-11-30 08:23:17 +08:00
|
|
|
while (!time_to_dump)
|
2006-06-24 06:29:34 +08:00
|
|
|
cpu_relax();
|
|
|
|
|
|
|
|
if (ppc_md.kexec_cpu_down)
|
|
|
|
ppc_md.kexec_cpu_down(1, 1);
|
2006-07-05 12:39:43 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_PPC64
|
2005-12-04 15:39:43 +08:00
|
|
|
kexec_smp_wait();
|
2006-07-05 12:39:43 +08:00
|
|
|
#else
|
|
|
|
for (;;); /* FIXME */
|
|
|
|
#endif
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
/* NOTREACHED */
|
|
|
|
}
|
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
static void crash_kexec_prepare_cpus(int cpu)
|
2005-12-04 15:39:43 +08:00
|
|
|
{
|
|
|
|
unsigned int msecs;
|
2006-06-24 06:29:34 +08:00
|
|
|
unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
|
2011-11-30 08:23:11 +08:00
|
|
|
int tries = 0;
|
|
|
|
int (*old_handler)(struct pt_regs *regs);
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2011-11-30 08:23:10 +08:00
|
|
|
printk(KERN_EMERG "Sending IPI to other CPUs\n");
|
|
|
|
|
2017-12-15 16:14:55 +08:00
|
|
|
if (crash_wake_offline)
|
|
|
|
ncpus = num_present_cpus() - 1;
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
crash_send_ipi(crash_ipi_callback);
|
|
|
|
smp_wmb();
|
|
|
|
|
2011-11-30 08:23:11 +08:00
|
|
|
again:
|
2005-12-04 15:39:43 +08:00
|
|
|
/*
|
2011-01-21 10:43:59 +08:00
|
|
|
* FIXME: Until we will have the way to stop other CPUs reliably,
|
2005-12-04 15:39:43 +08:00
|
|
|
* the crash CPU will send an IPI and wait for other CPUs to
|
2006-06-24 06:29:34 +08:00
|
|
|
* respond.
|
2005-12-04 15:39:43 +08:00
|
|
|
*/
|
2011-11-30 08:23:16 +08:00
|
|
|
msecs = IPI_TIMEOUT;
|
2011-11-30 08:23:17 +08:00
|
|
|
while ((atomic_read(&cpus_in_crash) < ncpus) && (--msecs > 0))
|
2005-12-04 15:39:43 +08:00
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
/* Would it be better to replace the trap vector here? */
|
|
|
|
|
2011-11-30 08:23:17 +08:00
|
|
|
if (atomic_read(&cpus_in_crash) >= ncpus) {
|
2011-11-30 08:23:11 +08:00
|
|
|
printk(KERN_EMERG "IPI complete\n");
|
|
|
|
return;
|
2006-06-24 06:29:34 +08:00
|
|
|
}
|
2011-11-30 08:23:10 +08:00
|
|
|
|
2011-11-30 08:23:11 +08:00
|
|
|
printk(KERN_EMERG "ERROR: %d cpu(s) not responding\n",
|
2011-11-30 08:23:17 +08:00
|
|
|
ncpus - atomic_read(&cpus_in_crash));
|
2011-11-30 08:23:11 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we have a panic timeout set then we can't wait indefinitely
|
|
|
|
* for someone to activate system reset. We also give up on the
|
|
|
|
* second time through if system reset fail to work.
|
|
|
|
*/
|
|
|
|
if ((panic_timeout > 0) || (tries > 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A system reset will cause all CPUs to take an 0x100 exception.
|
|
|
|
* The primary CPU returns here via setjmp, and the secondary
|
|
|
|
* CPUs reexecute the crash_kexec_secondary path.
|
|
|
|
*/
|
|
|
|
old_handler = __debugger;
|
|
|
|
__debugger = handle_fault;
|
|
|
|
crash_shutdown_cpu = smp_processor_id();
|
|
|
|
|
|
|
|
if (setjmp(crash_shutdown_buf) == 0) {
|
|
|
|
printk(KERN_EMERG "Activate system reset (dumprestart) "
|
|
|
|
"to stop other cpu(s)\n");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A system reset will force all CPUs to execute the
|
|
|
|
* crash code again. We need to reset cpus_in_crash so we
|
|
|
|
* wait for everyone to do this.
|
|
|
|
*/
|
2011-11-30 08:23:17 +08:00
|
|
|
atomic_set(&cpus_in_crash, 0);
|
2011-11-30 08:23:11 +08:00
|
|
|
smp_mb();
|
|
|
|
|
2011-11-30 08:23:17 +08:00
|
|
|
while (atomic_read(&cpus_in_crash) < ncpus)
|
2011-11-30 08:23:11 +08:00
|
|
|
cpu_relax();
|
|
|
|
}
|
|
|
|
|
|
|
|
crash_shutdown_cpu = -1;
|
|
|
|
__debugger = old_handler;
|
|
|
|
|
|
|
|
tries++;
|
|
|
|
goto again;
|
2005-12-04 15:39:43 +08:00
|
|
|
}
|
2006-06-24 06:29:34 +08:00
|
|
|
|
|
|
|
/*
|
2011-11-30 08:23:10 +08:00
|
|
|
* This function will be called by secondary cpus.
|
2006-06-24 06:29:34 +08:00
|
|
|
*/
|
|
|
|
void crash_kexec_secondary(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
2011-11-30 08:23:16 +08:00
|
|
|
int msecs = SECONDARY_TIMEOUT;
|
2006-06-24 06:29:34 +08:00
|
|
|
|
|
|
|
local_irq_save(flags);
|
2011-11-30 08:23:10 +08:00
|
|
|
|
2011-11-30 08:23:16 +08:00
|
|
|
/* Wait for the primary crash CPU to signal its progress */
|
2006-06-24 06:29:34 +08:00
|
|
|
while (crashing_cpu < 0) {
|
|
|
|
if (--msecs < 0) {
|
2011-11-30 08:23:10 +08:00
|
|
|
/* No response, kdump image may not have been loaded */
|
2006-06-24 06:29:34 +08:00
|
|
|
local_irq_restore(flags);
|
|
|
|
return;
|
|
|
|
}
|
2011-11-30 08:23:10 +08:00
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
mdelay(1);
|
|
|
|
}
|
2011-11-30 08:23:10 +08:00
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
crash_ipi_callback(regs);
|
|
|
|
}
|
|
|
|
|
2011-04-13 14:30:08 +08:00
|
|
|
#else /* ! CONFIG_SMP */
|
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
static void crash_kexec_prepare_cpus(int cpu)
|
2005-12-04 15:39:43 +08:00
|
|
|
{
|
|
|
|
/*
|
2011-11-30 08:23:12 +08:00
|
|
|
* move the secondaries to us so that we can copy
|
2005-12-04 15:39:43 +08:00
|
|
|
* the new kernel 0-0x100 safely
|
|
|
|
*
|
|
|
|
* do this if kexec in setup.c ?
|
|
|
|
*/
|
2006-07-05 12:39:43 +08:00
|
|
|
#ifdef CONFIG_PPC64
|
2005-12-04 15:39:43 +08:00
|
|
|
smp_release_cpus();
|
2006-07-05 12:39:43 +08:00
|
|
|
#else
|
|
|
|
/* FIXME */
|
|
|
|
#endif
|
2005-12-04 15:39:43 +08:00
|
|
|
}
|
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
void crash_kexec_secondary(struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
}
|
2011-04-13 14:30:08 +08:00
|
|
|
#endif /* CONFIG_SMP */
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2011-04-24 23:04:31 +08:00
|
|
|
/* wait for all the CPUs to hit real mode but timeout if they don't come in */
|
2015-10-07 11:48:16 +08:00
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_PPC64)
|
|
|
|
static void __maybe_unused crash_kexec_wait_realmode(int cpu)
|
2011-04-24 23:04:31 +08:00
|
|
|
{
|
|
|
|
unsigned int msecs;
|
|
|
|
int i;
|
|
|
|
|
2011-11-30 08:23:16 +08:00
|
|
|
msecs = REAL_MODE_TIMEOUT;
|
2011-05-11 03:28:41 +08:00
|
|
|
for (i=0; i < nr_cpu_ids && msecs > 0; i++) {
|
2011-04-24 23:04:31 +08:00
|
|
|
if (i == cpu)
|
|
|
|
continue;
|
|
|
|
|
2018-02-13 23:08:12 +08:00
|
|
|
while (paca_ptrs[i]->kexec_state < KEXEC_STATE_REAL_MODE) {
|
2011-04-24 23:04:31 +08:00
|
|
|
barrier();
|
2011-07-05 04:40:10 +08:00
|
|
|
if (!cpu_possible(i) || !cpu_online(i) || (msecs <= 0))
|
2011-04-24 23:04:31 +08:00
|
|
|
break;
|
|
|
|
msecs--;
|
|
|
|
mdelay(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mb();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void crash_kexec_wait_realmode(int cpu) {}
|
2015-10-07 11:48:16 +08:00
|
|
|
#endif /* CONFIG_SMP && CONFIG_PPC64 */
|
2011-04-24 23:04:31 +08:00
|
|
|
|
2008-01-18 12:50:30 +08:00
|
|
|
/*
|
|
|
|
* Register a function to be called on shutdown. Only use this if you
|
|
|
|
* can't reset your device in the second kernel.
|
|
|
|
*/
|
|
|
|
int crash_shutdown_register(crash_shutdown_t handler)
|
|
|
|
{
|
|
|
|
unsigned int i, rc;
|
|
|
|
|
|
|
|
spin_lock(&crash_handlers_lock);
|
|
|
|
for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
|
|
|
|
if (!crash_shutdown_handles[i]) {
|
|
|
|
/* Insert handle at first empty entry */
|
|
|
|
crash_shutdown_handles[i] = handler;
|
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == CRASH_HANDLER_MAX) {
|
|
|
|
printk(KERN_ERR "Crash shutdown handles full, "
|
|
|
|
"not registered.\n");
|
|
|
|
rc = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock(&crash_handlers_lock);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(crash_shutdown_register);
|
|
|
|
|
|
|
|
int crash_shutdown_unregister(crash_shutdown_t handler)
|
|
|
|
{
|
|
|
|
unsigned int i, rc;
|
|
|
|
|
|
|
|
spin_lock(&crash_handlers_lock);
|
|
|
|
for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
|
|
|
|
if (crash_shutdown_handles[i] == handler)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == CRASH_HANDLER_MAX) {
|
|
|
|
printk(KERN_ERR "Crash shutdown handle not found\n");
|
|
|
|
rc = 1;
|
|
|
|
} else {
|
|
|
|
/* Shift handles down */
|
2016-05-11 08:57:32 +08:00
|
|
|
for (; i < (CRASH_HANDLER_MAX - 1); i++)
|
2008-01-18 12:50:30 +08:00
|
|
|
crash_shutdown_handles[i] =
|
|
|
|
crash_shutdown_handles[i+1];
|
2016-05-11 08:57:32 +08:00
|
|
|
/*
|
|
|
|
* Reset last entry to NULL now that it has been shifted down,
|
|
|
|
* this will allow new handles to be added here.
|
|
|
|
*/
|
|
|
|
crash_shutdown_handles[i] = NULL;
|
2008-01-18 12:50:30 +08:00
|
|
|
rc = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock(&crash_handlers_lock);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(crash_shutdown_unregister);
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
void default_machine_crash_shutdown(struct pt_regs *regs)
|
|
|
|
{
|
2008-01-18 12:50:30 +08:00
|
|
|
unsigned int i;
|
|
|
|
int (*old_handler)(struct pt_regs *regs);
|
|
|
|
|
2005-12-04 15:39:43 +08:00
|
|
|
/*
|
|
|
|
* This function is only called after the system
|
2006-06-27 00:30:00 +08:00
|
|
|
* has panicked or is otherwise in a critical state.
|
2005-12-04 15:39:43 +08:00
|
|
|
* The minimum amount of code to allow a kexec'd kernel
|
|
|
|
* to run successfully needs to happen here.
|
|
|
|
*
|
|
|
|
* In practice this means stopping other cpus in
|
|
|
|
* an SMP system.
|
|
|
|
* The kernel is broken so disable interrupts.
|
|
|
|
*/
|
[POWERPC] Lazy interrupt disabling for 64-bit machines
This implements a lazy strategy for disabling interrupts. This means
that local_irq_disable() et al. just clear the 'interrupts are
enabled' flag in the paca. If an interrupt comes along, the interrupt
entry code notices that interrupts are supposed to be disabled, and
clears the EE bit in SRR1, clears the 'interrupts are hard-enabled'
flag in the paca, and returns. This means that interrupts only
actually get disabled in the processor when an interrupt comes along.
When interrupts are enabled by local_irq_enable() et al., the code
sets the interrupts-enabled flag in the paca, and then checks whether
interrupts got hard-disabled. If so, it also sets the EE bit in the
MSR to hard-enable the interrupts.
This has the potential to improve performance, and also makes it
easier to make a kernel that can boot on iSeries and on other 64-bit
machines, since this lazy-disable strategy is very similar to the
soft-disable strategy that iSeries already uses.
This version renames paca->proc_enabled to paca->soft_enabled, and
changes a couple of soft-disables in the kexec code to hard-disables,
which should fix the crash that Michael Ellerman saw. This doesn't
yet use a reserved CR field for the soft_enabled and hard_enabled
flags. This applies on top of Stephen Rothwell's patches to make it
possible to build a combined iSeries/other kernel.
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-04 14:47:49 +08:00
|
|
|
hard_irq_disable();
|
2005-12-04 15:39:43 +08:00
|
|
|
|
2010-08-03 04:39:41 +08:00
|
|
|
/*
|
|
|
|
* Make a note of crashing cpu. Will be used in machine_kexec
|
|
|
|
* such that another IPI will not be sent.
|
|
|
|
*/
|
|
|
|
crashing_cpu = smp_processor_id();
|
2011-11-30 08:23:16 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If we came in via system reset, wait a while for the secondary
|
|
|
|
* CPUs to enter.
|
|
|
|
*/
|
|
|
|
if (TRAP(regs) == 0x100)
|
|
|
|
mdelay(PRIMARY_TIMEOUT);
|
|
|
|
|
2010-08-03 04:39:41 +08:00
|
|
|
crash_kexec_prepare_cpus(crashing_cpu);
|
2011-11-30 08:23:17 +08:00
|
|
|
|
|
|
|
crash_save_cpu(regs, crashing_cpu);
|
|
|
|
|
|
|
|
time_to_dump = 1;
|
|
|
|
|
2010-08-03 04:39:41 +08:00
|
|
|
crash_kexec_wait_realmode(crashing_cpu);
|
|
|
|
|
2010-09-17 06:58:23 +08:00
|
|
|
machine_kexec_mask_interrupts();
|
2008-01-18 12:50:30 +08:00
|
|
|
|
|
|
|
/*
|
2011-11-30 08:23:12 +08:00
|
|
|
* Call registered shutdown routines safely. Swap out
|
2008-01-18 12:50:30 +08:00
|
|
|
* __debugger_fault_handler, and replace on exit.
|
|
|
|
*/
|
|
|
|
old_handler = __debugger_fault_handler;
|
|
|
|
__debugger_fault_handler = handle_fault;
|
2010-05-11 00:25:51 +08:00
|
|
|
crash_shutdown_cpu = smp_processor_id();
|
2016-07-11 12:17:31 +08:00
|
|
|
for (i = 0; i < CRASH_HANDLER_MAX && crash_shutdown_handles[i]; i++) {
|
2008-01-18 12:50:30 +08:00
|
|
|
if (setjmp(crash_shutdown_buf) == 0) {
|
|
|
|
/*
|
|
|
|
* Insert syncs and delay to ensure
|
|
|
|
* instructions in the dangerous region don't
|
|
|
|
* leak away from this protected region.
|
|
|
|
*/
|
|
|
|
asm volatile("sync; isync");
|
|
|
|
/* dangerous region */
|
|
|
|
crash_shutdown_handles[i]();
|
|
|
|
asm volatile("sync; isync");
|
|
|
|
}
|
2006-04-04 19:43:01 +08:00
|
|
|
}
|
2010-05-11 00:25:51 +08:00
|
|
|
crash_shutdown_cpu = -1;
|
2008-01-18 12:50:30 +08:00
|
|
|
__debugger_fault_handler = old_handler;
|
2006-04-04 19:43:01 +08:00
|
|
|
|
2006-06-24 06:29:34 +08:00
|
|
|
if (ppc_md.kexec_cpu_down)
|
|
|
|
ppc_md.kexec_cpu_down(1, 0);
|
2005-12-04 15:39:43 +08:00
|
|
|
}
|