1793b08e2SChristophe Leroy // SPDX-License-Identifier: GPL-2.0-only
2793b08e2SChristophe Leroy /*
3793b08e2SChristophe Leroy * Architecture specific (PPC64) functions for kexec based crash dumps.
4793b08e2SChristophe Leroy *
5793b08e2SChristophe Leroy * Copyright (C) 2005, IBM Corp.
6793b08e2SChristophe Leroy *
7793b08e2SChristophe Leroy * Created by: Haren Myneni
8793b08e2SChristophe Leroy */
9793b08e2SChristophe Leroy
10793b08e2SChristophe Leroy #include <linux/kernel.h>
11793b08e2SChristophe Leroy #include <linux/smp.h>
12793b08e2SChristophe Leroy #include <linux/reboot.h>
13793b08e2SChristophe Leroy #include <linux/kexec.h>
14793b08e2SChristophe Leroy #include <linux/export.h>
15793b08e2SChristophe Leroy #include <linux/crash_dump.h>
16793b08e2SChristophe Leroy #include <linux/delay.h>
17793b08e2SChristophe Leroy #include <linux/irq.h>
18793b08e2SChristophe Leroy #include <linux/types.h>
19793b08e2SChristophe Leroy
20793b08e2SChristophe Leroy #include <asm/processor.h>
21793b08e2SChristophe Leroy #include <asm/machdep.h>
22793b08e2SChristophe Leroy #include <asm/kexec.h>
23793b08e2SChristophe Leroy #include <asm/smp.h>
24793b08e2SChristophe Leroy #include <asm/setjmp.h>
25793b08e2SChristophe Leroy #include <asm/debug.h>
267153d4bfSXiongwei Song #include <asm/interrupt.h>
27793b08e2SChristophe Leroy
28793b08e2SChristophe Leroy /*
29793b08e2SChristophe Leroy * The primary CPU waits a while for all secondary CPUs to enter. This is to
30793b08e2SChristophe Leroy * avoid sending an IPI if the secondary CPUs are entering
31793b08e2SChristophe Leroy * crash_kexec_secondary on their own (eg via a system reset).
32793b08e2SChristophe Leroy *
33793b08e2SChristophe Leroy * The secondary timeout has to be longer than the primary. Both timeouts are
34793b08e2SChristophe Leroy * in milliseconds.
35793b08e2SChristophe Leroy */
36793b08e2SChristophe Leroy #define PRIMARY_TIMEOUT 500
37793b08e2SChristophe Leroy #define SECONDARY_TIMEOUT 1000
38793b08e2SChristophe Leroy
39793b08e2SChristophe Leroy #define IPI_TIMEOUT 10000
40793b08e2SChristophe Leroy #define REAL_MODE_TIMEOUT 10000
41793b08e2SChristophe Leroy
42793b08e2SChristophe Leroy static int time_to_dump;
43c7255058SHari Bathini
44c7255058SHari Bathini /*
45c7255058SHari Bathini * In case of system reset, secondary CPUs enter crash_kexec_secondary with out
46c7255058SHari Bathini * having to send an IPI explicitly. So, indicate if the crash is via
47c7255058SHari Bathini * system reset to avoid sending another IPI.
48c7255058SHari Bathini */
49c7255058SHari Bathini static int is_via_system_reset;
50c7255058SHari Bathini
51793b08e2SChristophe Leroy /*
52793b08e2SChristophe Leroy * crash_wake_offline should be set to 1 by platforms that intend to wake
53793b08e2SChristophe Leroy * up offline cpus prior to jumping to a kdump kernel. Currently powernv
54793b08e2SChristophe Leroy * sets it to 1, since we want to avoid things from happening when an
55793b08e2SChristophe Leroy * offline CPU wakes up due to something like an HMI (malfunction error),
56793b08e2SChristophe Leroy * which propagates to all threads.
57793b08e2SChristophe Leroy */
58793b08e2SChristophe Leroy int crash_wake_offline;
59793b08e2SChristophe Leroy
60793b08e2SChristophe Leroy #define CRASH_HANDLER_MAX 3
61793b08e2SChristophe Leroy /* List of shutdown handles */
62793b08e2SChristophe Leroy static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX];
63793b08e2SChristophe Leroy static DEFINE_SPINLOCK(crash_handlers_lock);
64793b08e2SChristophe Leroy
65793b08e2SChristophe Leroy static unsigned long crash_shutdown_buf[JMP_BUF_LEN];
66793b08e2SChristophe Leroy static int crash_shutdown_cpu = -1;
67793b08e2SChristophe Leroy
handle_fault(struct pt_regs * regs)68793b08e2SChristophe Leroy static int handle_fault(struct pt_regs *regs)
69793b08e2SChristophe Leroy {
70793b08e2SChristophe Leroy if (crash_shutdown_cpu == smp_processor_id())
71793b08e2SChristophe Leroy longjmp(crash_shutdown_buf, 1);
72793b08e2SChristophe Leroy return 0;
73793b08e2SChristophe Leroy }
74793b08e2SChristophe Leroy
75793b08e2SChristophe Leroy #ifdef CONFIG_SMP
76793b08e2SChristophe Leroy
77793b08e2SChristophe Leroy static atomic_t cpus_in_crash;
crash_ipi_callback(struct pt_regs * regs)78793b08e2SChristophe Leroy void crash_ipi_callback(struct pt_regs *regs)
79793b08e2SChristophe Leroy {
80793b08e2SChristophe Leroy static cpumask_t cpus_state_saved = CPU_MASK_NONE;
81793b08e2SChristophe Leroy
82793b08e2SChristophe Leroy int cpu = smp_processor_id();
83793b08e2SChristophe Leroy
84793b08e2SChristophe Leroy hard_irq_disable();
85793b08e2SChristophe Leroy if (!cpumask_test_cpu(cpu, &cpus_state_saved)) {
86793b08e2SChristophe Leroy crash_save_cpu(regs, cpu);
87793b08e2SChristophe Leroy cpumask_set_cpu(cpu, &cpus_state_saved);
88793b08e2SChristophe Leroy }
89793b08e2SChristophe Leroy
90793b08e2SChristophe Leroy atomic_inc(&cpus_in_crash);
91793b08e2SChristophe Leroy smp_mb__after_atomic();
92793b08e2SChristophe Leroy
93793b08e2SChristophe Leroy /*
94793b08e2SChristophe Leroy * Starting the kdump boot.
95793b08e2SChristophe Leroy * This barrier is needed to make sure that all CPUs are stopped.
96793b08e2SChristophe Leroy */
97793b08e2SChristophe Leroy while (!time_to_dump)
98793b08e2SChristophe Leroy cpu_relax();
99793b08e2SChristophe Leroy
100793b08e2SChristophe Leroy if (ppc_md.kexec_cpu_down)
101793b08e2SChristophe Leroy ppc_md.kexec_cpu_down(1, 1);
102793b08e2SChristophe Leroy
103793b08e2SChristophe Leroy #ifdef CONFIG_PPC64
104793b08e2SChristophe Leroy kexec_smp_wait();
105793b08e2SChristophe Leroy #else
106793b08e2SChristophe Leroy for (;;); /* FIXME */
107793b08e2SChristophe Leroy #endif
108793b08e2SChristophe Leroy
109793b08e2SChristophe Leroy /* NOTREACHED */
110793b08e2SChristophe Leroy }
111793b08e2SChristophe Leroy
crash_kexec_prepare_cpus(void)112c7255058SHari Bathini static void crash_kexec_prepare_cpus(void)
113793b08e2SChristophe Leroy {
114793b08e2SChristophe Leroy unsigned int msecs;
115a2305e3dSArnd Bergmann volatile unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
116a2305e3dSArnd Bergmann volatile int tries = 0;
117793b08e2SChristophe Leroy int (*old_handler)(struct pt_regs *regs);
118793b08e2SChristophe Leroy
119793b08e2SChristophe Leroy printk(KERN_EMERG "Sending IPI to other CPUs\n");
120793b08e2SChristophe Leroy
121793b08e2SChristophe Leroy if (crash_wake_offline)
122793b08e2SChristophe Leroy ncpus = num_present_cpus() - 1;
123793b08e2SChristophe Leroy
124c7255058SHari Bathini /*
125c7255058SHari Bathini * If we came in via system reset, secondaries enter via crash_kexec_secondary().
126c7255058SHari Bathini * So, wait a while for the secondary CPUs to enter for that case.
127c7255058SHari Bathini * Else, send IPI to all other CPUs.
128c7255058SHari Bathini */
129c7255058SHari Bathini if (is_via_system_reset)
130c7255058SHari Bathini mdelay(PRIMARY_TIMEOUT);
131c7255058SHari Bathini else
132793b08e2SChristophe Leroy crash_send_ipi(crash_ipi_callback);
133793b08e2SChristophe Leroy smp_wmb();
134793b08e2SChristophe Leroy
135793b08e2SChristophe Leroy again:
136793b08e2SChristophe Leroy /*
137793b08e2SChristophe Leroy * FIXME: Until we will have the way to stop other CPUs reliably,
138793b08e2SChristophe Leroy * the crash CPU will send an IPI and wait for other CPUs to
139793b08e2SChristophe Leroy * respond.
140793b08e2SChristophe Leroy */
141793b08e2SChristophe Leroy msecs = IPI_TIMEOUT;
142793b08e2SChristophe Leroy while ((atomic_read(&cpus_in_crash) < ncpus) && (--msecs > 0))
143793b08e2SChristophe Leroy mdelay(1);
144793b08e2SChristophe Leroy
145793b08e2SChristophe Leroy /* Would it be better to replace the trap vector here? */
146793b08e2SChristophe Leroy
147793b08e2SChristophe Leroy if (atomic_read(&cpus_in_crash) >= ncpus) {
148793b08e2SChristophe Leroy printk(KERN_EMERG "IPI complete\n");
149793b08e2SChristophe Leroy return;
150793b08e2SChristophe Leroy }
151793b08e2SChristophe Leroy
152793b08e2SChristophe Leroy printk(KERN_EMERG "ERROR: %d cpu(s) not responding\n",
153793b08e2SChristophe Leroy ncpus - atomic_read(&cpus_in_crash));
154793b08e2SChristophe Leroy
155793b08e2SChristophe Leroy /*
156793b08e2SChristophe Leroy * If we have a panic timeout set then we can't wait indefinitely
157793b08e2SChristophe Leroy * for someone to activate system reset. We also give up on the
158793b08e2SChristophe Leroy * second time through if system reset fail to work.
159793b08e2SChristophe Leroy */
160793b08e2SChristophe Leroy if ((panic_timeout > 0) || (tries > 0))
161793b08e2SChristophe Leroy return;
162793b08e2SChristophe Leroy
163793b08e2SChristophe Leroy /*
164793b08e2SChristophe Leroy * A system reset will cause all CPUs to take an 0x100 exception.
165793b08e2SChristophe Leroy * The primary CPU returns here via setjmp, and the secondary
166793b08e2SChristophe Leroy * CPUs reexecute the crash_kexec_secondary path.
167793b08e2SChristophe Leroy */
168793b08e2SChristophe Leroy old_handler = __debugger;
169793b08e2SChristophe Leroy __debugger = handle_fault;
170793b08e2SChristophe Leroy crash_shutdown_cpu = smp_processor_id();
171793b08e2SChristophe Leroy
172793b08e2SChristophe Leroy if (setjmp(crash_shutdown_buf) == 0) {
173793b08e2SChristophe Leroy printk(KERN_EMERG "Activate system reset (dumprestart) "
174793b08e2SChristophe Leroy "to stop other cpu(s)\n");
175793b08e2SChristophe Leroy
176793b08e2SChristophe Leroy /*
177793b08e2SChristophe Leroy * A system reset will force all CPUs to execute the
178793b08e2SChristophe Leroy * crash code again. We need to reset cpus_in_crash so we
179793b08e2SChristophe Leroy * wait for everyone to do this.
180793b08e2SChristophe Leroy */
181793b08e2SChristophe Leroy atomic_set(&cpus_in_crash, 0);
182793b08e2SChristophe Leroy smp_mb();
183793b08e2SChristophe Leroy
184793b08e2SChristophe Leroy while (atomic_read(&cpus_in_crash) < ncpus)
185793b08e2SChristophe Leroy cpu_relax();
186793b08e2SChristophe Leroy }
187793b08e2SChristophe Leroy
188793b08e2SChristophe Leroy crash_shutdown_cpu = -1;
189793b08e2SChristophe Leroy __debugger = old_handler;
190793b08e2SChristophe Leroy
191793b08e2SChristophe Leroy tries++;
192793b08e2SChristophe Leroy goto again;
193793b08e2SChristophe Leroy }
194793b08e2SChristophe Leroy
195793b08e2SChristophe Leroy /*
196793b08e2SChristophe Leroy * This function will be called by secondary cpus.
197793b08e2SChristophe Leroy */
crash_kexec_secondary(struct pt_regs * regs)198793b08e2SChristophe Leroy void crash_kexec_secondary(struct pt_regs *regs)
199793b08e2SChristophe Leroy {
200793b08e2SChristophe Leroy unsigned long flags;
201793b08e2SChristophe Leroy int msecs = SECONDARY_TIMEOUT;
202793b08e2SChristophe Leroy
203793b08e2SChristophe Leroy local_irq_save(flags);
204793b08e2SChristophe Leroy
205793b08e2SChristophe Leroy /* Wait for the primary crash CPU to signal its progress */
206793b08e2SChristophe Leroy while (crashing_cpu < 0) {
207793b08e2SChristophe Leroy if (--msecs < 0) {
208793b08e2SChristophe Leroy /* No response, kdump image may not have been loaded */
209793b08e2SChristophe Leroy local_irq_restore(flags);
210793b08e2SChristophe Leroy return;
211793b08e2SChristophe Leroy }
212793b08e2SChristophe Leroy
213793b08e2SChristophe Leroy mdelay(1);
214793b08e2SChristophe Leroy }
215793b08e2SChristophe Leroy
216793b08e2SChristophe Leroy crash_ipi_callback(regs);
217793b08e2SChristophe Leroy }
218793b08e2SChristophe Leroy
219793b08e2SChristophe Leroy #else /* ! CONFIG_SMP */
220793b08e2SChristophe Leroy
crash_kexec_prepare_cpus(void)221c7255058SHari Bathini static void crash_kexec_prepare_cpus(void)
222793b08e2SChristophe Leroy {
223793b08e2SChristophe Leroy /*
224793b08e2SChristophe Leroy * move the secondaries to us so that we can copy
225793b08e2SChristophe Leroy * the new kernel 0-0x100 safely
226793b08e2SChristophe Leroy *
227793b08e2SChristophe Leroy * do this if kexec in setup.c ?
228793b08e2SChristophe Leroy */
229793b08e2SChristophe Leroy #ifdef CONFIG_PPC64
230793b08e2SChristophe Leroy smp_release_cpus();
231793b08e2SChristophe Leroy #else
232793b08e2SChristophe Leroy /* FIXME */
233793b08e2SChristophe Leroy #endif
234793b08e2SChristophe Leroy }
235793b08e2SChristophe Leroy
crash_kexec_secondary(struct pt_regs * regs)236793b08e2SChristophe Leroy void crash_kexec_secondary(struct pt_regs *regs)
237793b08e2SChristophe Leroy {
238793b08e2SChristophe Leroy }
239793b08e2SChristophe Leroy #endif /* CONFIG_SMP */
240793b08e2SChristophe Leroy
241793b08e2SChristophe Leroy /* wait for all the CPUs to hit real mode but timeout if they don't come in */
242793b08e2SChristophe Leroy #if defined(CONFIG_SMP) && defined(CONFIG_PPC64)
crash_kexec_wait_realmode(int cpu)243743cdb7bSPaul Mackerras noinstr static void __maybe_unused crash_kexec_wait_realmode(int cpu)
244793b08e2SChristophe Leroy {
245793b08e2SChristophe Leroy unsigned int msecs;
246793b08e2SChristophe Leroy int i;
247793b08e2SChristophe Leroy
248793b08e2SChristophe Leroy msecs = REAL_MODE_TIMEOUT;
249793b08e2SChristophe Leroy for (i=0; i < nr_cpu_ids && msecs > 0; i++) {
250793b08e2SChristophe Leroy if (i == cpu)
251793b08e2SChristophe Leroy continue;
252793b08e2SChristophe Leroy
253793b08e2SChristophe Leroy while (paca_ptrs[i]->kexec_state < KEXEC_STATE_REAL_MODE) {
254793b08e2SChristophe Leroy barrier();
255793b08e2SChristophe Leroy if (!cpu_possible(i) || !cpu_online(i) || (msecs <= 0))
256793b08e2SChristophe Leroy break;
257793b08e2SChristophe Leroy msecs--;
258793b08e2SChristophe Leroy mdelay(1);
259793b08e2SChristophe Leroy }
260793b08e2SChristophe Leroy }
261793b08e2SChristophe Leroy mb();
262793b08e2SChristophe Leroy }
263793b08e2SChristophe Leroy #else
crash_kexec_wait_realmode(int cpu)264793b08e2SChristophe Leroy static inline void crash_kexec_wait_realmode(int cpu) {}
265793b08e2SChristophe Leroy #endif /* CONFIG_SMP && CONFIG_PPC64 */
266793b08e2SChristophe Leroy
crash_kexec_prepare(void)267c7255058SHari Bathini void crash_kexec_prepare(void)
268c7255058SHari Bathini {
269c7255058SHari Bathini /* Avoid hardlocking with irresponsive CPU holding logbuf_lock */
270c7255058SHari Bathini printk_deferred_enter();
271c7255058SHari Bathini
272c7255058SHari Bathini /*
273c7255058SHari Bathini * This function is only called after the system
274c7255058SHari Bathini * has panicked or is otherwise in a critical state.
275c7255058SHari Bathini * The minimum amount of code to allow a kexec'd kernel
276c7255058SHari Bathini * to run successfully needs to happen here.
277c7255058SHari Bathini *
278c7255058SHari Bathini * In practice this means stopping other cpus in
279c7255058SHari Bathini * an SMP system.
280c7255058SHari Bathini * The kernel is broken so disable interrupts.
281c7255058SHari Bathini */
282c7255058SHari Bathini hard_irq_disable();
283c7255058SHari Bathini
284c7255058SHari Bathini /*
285c7255058SHari Bathini * Make a note of crashing cpu. Will be used in machine_kexec
286c7255058SHari Bathini * such that another IPI will not be sent.
287c7255058SHari Bathini */
288c7255058SHari Bathini crashing_cpu = smp_processor_id();
289c7255058SHari Bathini
290c7255058SHari Bathini crash_kexec_prepare_cpus();
291c7255058SHari Bathini }
292c7255058SHari Bathini
293793b08e2SChristophe Leroy /*
294793b08e2SChristophe Leroy * Register a function to be called on shutdown. Only use this if you
295793b08e2SChristophe Leroy * can't reset your device in the second kernel.
296793b08e2SChristophe Leroy */
crash_shutdown_register(crash_shutdown_t handler)297793b08e2SChristophe Leroy int crash_shutdown_register(crash_shutdown_t handler)
298793b08e2SChristophe Leroy {
299793b08e2SChristophe Leroy unsigned int i, rc;
300793b08e2SChristophe Leroy
301793b08e2SChristophe Leroy spin_lock(&crash_handlers_lock);
302793b08e2SChristophe Leroy for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
303793b08e2SChristophe Leroy if (!crash_shutdown_handles[i]) {
304793b08e2SChristophe Leroy /* Insert handle at first empty entry */
305793b08e2SChristophe Leroy crash_shutdown_handles[i] = handler;
306793b08e2SChristophe Leroy rc = 0;
307793b08e2SChristophe Leroy break;
308793b08e2SChristophe Leroy }
309793b08e2SChristophe Leroy
310793b08e2SChristophe Leroy if (i == CRASH_HANDLER_MAX) {
311793b08e2SChristophe Leroy printk(KERN_ERR "Crash shutdown handles full, "
312793b08e2SChristophe Leroy "not registered.\n");
313793b08e2SChristophe Leroy rc = 1;
314793b08e2SChristophe Leroy }
315793b08e2SChristophe Leroy
316793b08e2SChristophe Leroy spin_unlock(&crash_handlers_lock);
317793b08e2SChristophe Leroy return rc;
318793b08e2SChristophe Leroy }
319793b08e2SChristophe Leroy EXPORT_SYMBOL(crash_shutdown_register);
320793b08e2SChristophe Leroy
crash_shutdown_unregister(crash_shutdown_t handler)321793b08e2SChristophe Leroy int crash_shutdown_unregister(crash_shutdown_t handler)
322793b08e2SChristophe Leroy {
323793b08e2SChristophe Leroy unsigned int i, rc;
324793b08e2SChristophe Leroy
325793b08e2SChristophe Leroy spin_lock(&crash_handlers_lock);
326793b08e2SChristophe Leroy for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
327793b08e2SChristophe Leroy if (crash_shutdown_handles[i] == handler)
328793b08e2SChristophe Leroy break;
329793b08e2SChristophe Leroy
330793b08e2SChristophe Leroy if (i == CRASH_HANDLER_MAX) {
331793b08e2SChristophe Leroy printk(KERN_ERR "Crash shutdown handle not found\n");
332793b08e2SChristophe Leroy rc = 1;
333793b08e2SChristophe Leroy } else {
334793b08e2SChristophe Leroy /* Shift handles down */
335793b08e2SChristophe Leroy for (; i < (CRASH_HANDLER_MAX - 1); i++)
336793b08e2SChristophe Leroy crash_shutdown_handles[i] =
337793b08e2SChristophe Leroy crash_shutdown_handles[i+1];
338793b08e2SChristophe Leroy /*
339793b08e2SChristophe Leroy * Reset last entry to NULL now that it has been shifted down,
340793b08e2SChristophe Leroy * this will allow new handles to be added here.
341793b08e2SChristophe Leroy */
342793b08e2SChristophe Leroy crash_shutdown_handles[i] = NULL;
343793b08e2SChristophe Leroy rc = 0;
344793b08e2SChristophe Leroy }
345793b08e2SChristophe Leroy
346793b08e2SChristophe Leroy spin_unlock(&crash_handlers_lock);
347793b08e2SChristophe Leroy return rc;
348793b08e2SChristophe Leroy }
349793b08e2SChristophe Leroy EXPORT_SYMBOL(crash_shutdown_unregister);
350793b08e2SChristophe Leroy
default_machine_crash_shutdown(struct pt_regs * regs)351793b08e2SChristophe Leroy void default_machine_crash_shutdown(struct pt_regs *regs)
352793b08e2SChristophe Leroy {
353*0f7ce21aSArnd Bergmann volatile unsigned int i;
354793b08e2SChristophe Leroy int (*old_handler)(struct pt_regs *regs);
355793b08e2SChristophe Leroy
3567153d4bfSXiongwei Song if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
357c7255058SHari Bathini is_via_system_reset = 1;
358793b08e2SChristophe Leroy
359c7255058SHari Bathini crash_smp_send_stop();
360793b08e2SChristophe Leroy
361793b08e2SChristophe Leroy crash_save_cpu(regs, crashing_cpu);
362793b08e2SChristophe Leroy
363793b08e2SChristophe Leroy time_to_dump = 1;
364793b08e2SChristophe Leroy
365793b08e2SChristophe Leroy crash_kexec_wait_realmode(crashing_cpu);
366793b08e2SChristophe Leroy
367793b08e2SChristophe Leroy machine_kexec_mask_interrupts();
368793b08e2SChristophe Leroy
369793b08e2SChristophe Leroy /*
370793b08e2SChristophe Leroy * Call registered shutdown routines safely. Swap out
371793b08e2SChristophe Leroy * __debugger_fault_handler, and replace on exit.
372793b08e2SChristophe Leroy */
373793b08e2SChristophe Leroy old_handler = __debugger_fault_handler;
374793b08e2SChristophe Leroy __debugger_fault_handler = handle_fault;
375793b08e2SChristophe Leroy crash_shutdown_cpu = smp_processor_id();
376793b08e2SChristophe Leroy for (i = 0; i < CRASH_HANDLER_MAX && crash_shutdown_handles[i]; i++) {
377793b08e2SChristophe Leroy if (setjmp(crash_shutdown_buf) == 0) {
378793b08e2SChristophe Leroy /*
379793b08e2SChristophe Leroy * Insert syncs and delay to ensure
380793b08e2SChristophe Leroy * instructions in the dangerous region don't
381793b08e2SChristophe Leroy * leak away from this protected region.
382793b08e2SChristophe Leroy */
383793b08e2SChristophe Leroy asm volatile("sync; isync");
384793b08e2SChristophe Leroy /* dangerous region */
385793b08e2SChristophe Leroy crash_shutdown_handles[i]();
386793b08e2SChristophe Leroy asm volatile("sync; isync");
387793b08e2SChristophe Leroy }
388793b08e2SChristophe Leroy }
389793b08e2SChristophe Leroy crash_shutdown_cpu = -1;
390793b08e2SChristophe Leroy __debugger_fault_handler = old_handler;
391793b08e2SChristophe Leroy
392793b08e2SChristophe Leroy if (ppc_md.kexec_cpu_down)
393793b08e2SChristophe Leroy ppc_md.kexec_cpu_down(1, 0);
394793b08e2SChristophe Leroy }
395