fix usage of smp_call_function
[openwrt/openwrt.git] / target / linux / generic-2.6 / patches-2.6.30 / 029-mips_kexec.patch
1 This patch updates kernel part of kexec for MIPS platform to support
2 kdump, 64-bit, SMP and simplify code adaptation to new boards. It does
3 the following:
4
5 - hooks for machine-specific actions are introduced
6 (_machine_kexec_prepare,
7 _machine_kexec_shutdown, _machine_crash_shutdown);
8 - kexec reboot on SMP machine is implemented;
9 - add boot parameters passing to new kernel (array kexec_args[] is
10 copied to
11 registers a0-a3 on reboot );
12 - crash dump functionality is added (boot kernel with non-default physical
13 start, parse "crashkernel=..." command line parameter, copy_oldmem_page()
14 is implemeted to read memory dump after reboot-on-crashi,
15 crash_setup_regs()
16 is updated to correctly store registers on crash);
17
18 kexec/kdump funtionality was tested on several Cavium Octeon boards
19 (mips64 SMP). The way we do it was the following:
20 - _machine_kexec_prepare was find kexec segment with command line and
21 save it's pointed into internal bootloader structure.
22 - _machine_kexec_shutdown was used to stop boards IO and make all non-boot
23 CPUs spin in function relocated_kexec_smp_wait()
24 - _machine_crash_shutdown just calls default_machine_crash_shutdown()
25 We tested 1) 'common' kexec reboot (by 'kexec -e'), 2) kexec-on-panic
26 ('kexec -p ...') and 3) access to/proc/vmcore (with gdb).
27
28 Signed-off-by: Maxim Syrchin <[11]msyrchin at ru.mvista.com>
29 ---
30 arch/mips/Kconfig | 23 +++++++++
31 arch/mips/Makefile | 4 ++
32 arch/mips/kernel/Makefile | 3 +-
33 arch/mips/kernel/crash.c | 91 ++++++++++++++++++++++++++++++++++
34 arch/mips/kernel/crash_dump.c | 96 ++++++++++++++++++++++++++++++++++++
35 arch/mips/kernel/machine_kexec.c | 52 ++++++++++++++++++-
36 arch/mips/kernel/relocate_kernel.S | 93 ++++++++++++++++++++++++++++++++++-
37 arch/mips/kernel/setup.c | 10 +++-
38 arch/mips/include/asm/kexec.h | 21 ++++++++-
39 9 files changed, 386 insertions(+), 7 deletions(-)
40 create mode 100644 arch/mips/kernel/crash.c
41 create mode 100644 arch/mips/kernel/crash_dump.c
42
43 ---
44 arch/mips/Kconfig | 23 23 + 0 - 0 !
45 arch/mips/Makefile | 4 4 + 0 - 0 !
46 arch/mips/kernel/Makefile | 3 2 + 1 - 0 !
47 arch/mips/kernel/crash.c | 90 90 + 0 - 0 !
48 arch/mips/kernel/crash_dump.c | 96 96 + 0 - 0 !
49 arch/mips/kernel/machine_kexec.c | 66 60 + 6 - 0 !
50 arch/mips/kernel/relocate_kernel.S | 96 95 + 1 - 0 !
51 arch/mips/kernel/setup.c | 10 9 + 1 - 0 !
52 arch/mips/include/asm/kexec.h | 21 20 + 1 - 0 !
53 9 files changed, 399 insertions(+), 10 deletions(-)
54
55 Index: linux-2.6.30.7/arch/mips/Kconfig
56 ===================================================================
57 --- linux-2.6.30.7.orig/arch/mips/Kconfig 2009-09-27 20:41:06.000000000 +0200
58 +++ linux-2.6.30.7/arch/mips/Kconfig 2009-09-27 21:02:55.000000000 +0200
59 @@ -1966,6 +1966,29 @@
60 support. As of this writing the exact hardware interface is
61 strongly in flux, so no good recommendation can be made.
62
63 +config CRASH_DUMP
64 + bool "kernel crash dumps (EXPERIMENTAL)"
65 + depends on EXPERIMENTAL
66 + help
67 + Generate crash dump after being started by kexec.
68 + This should be normally only set in special crash dump kernels
69 + which are loaded in the main kernel with kexec-tools into
70 + a specially reserved region and then later executed after
71 + a crash by kdump/kexec. The crash dump kernel must be compiled
72 + to a memory address not used by the main kernel or BIOS using
73 + PHYSICAL_START.
74 +
75 +config PHYSICAL_START
76 + hex "Physical address where the kernel is loaded"
77 + default "0xffffffff84000000"
78 + depends on CRASH_DUMP
79 + help
80 + This gives the CKSEG0 or KSEG0 address where the kernel is loaded.
81 + If you plan to use kernel for capturing the crash dump change
82 + this value to start of the reserved region (the "X" value as
83 + specified in the "crashkernel=[12]YM at XM" command line boot parameter
84 + passed to the panic-ed kernel).
85 +
86 config SECCOMP
87 bool "Enable seccomp to safely compute untrusted bytecode"
88 depends on PROC_FS
89 Index: linux-2.6.30.7/arch/mips/Makefile
90 ===================================================================
91 --- linux-2.6.30.7.orig/arch/mips/Makefile 2009-09-27 20:41:07.000000000 +0200
92 +++ linux-2.6.30.7/arch/mips/Makefile 2009-09-27 21:03:31.000000000 +0200
93 @@ -603,6 +603,10 @@
94 load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000
95 endif
96
97 +ifdef CONFIG_PHYSICAL_START
98 +load-y = $(CONFIG_PHYSICAL_START)
99 +endif
100 +
101 cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
102 drivers-$(CONFIG_PCI) += arch/mips/pci/
103
104 Index: linux-2.6.30.7/arch/mips/kernel/Makefile
105 ===================================================================
106 --- linux-2.6.30.7.orig/arch/mips/kernel/Makefile 2009-09-27 20:41:06.000000000 +0200
107 +++ linux-2.6.30.7/arch/mips/kernel/Makefile 2009-09-27 21:02:55.000000000 +0200
108 @@ -83,7 +83,8 @@
109
110 obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
111
112 -obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
113 +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
114 +obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
115 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
116 obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
117
118 Index: linux-2.6.30.7/arch/mips/kernel/crash.c
119 ===================================================================
120 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
121 +++ linux-2.6.30.7/arch/mips/kernel/crash.c 2009-09-27 21:02:55.000000000 +0200
122 @@ -0,0 +1,90 @@
123 +/*
124 + * Architecture specific (MIPS) functions for kexec based crash dumps.
125 + *
126 + * Copyright (C) 2005, IBM Corp.
127 + * Copyright (C) 2008, MontaVista Software Inc.
128 + *
129 + * This source code is licensed under the GNU General Public License,
130 + * Version 2. See the file COPYING for more details.
131 + *
132 + */
133 +
134 +#undef DEBUG
135 +
136 +#include <linux/kernel.h>
137 +#include <linux/smp.h>
138 +#include <linux/reboot.h>
139 +#include <linux/kexec.h>
140 +#include <linux/bootmem.h>
141 +#include <linux/crash_dump.h>
142 +#include <linux/delay.h>
143 +#include <linux/init.h>
144 +#include <linux/irq.h>
145 +#include <linux/types.h>
146 +#include <linux/sched.h>
147 +
148 +
149 +
150 +/* This keeps a track of which one is crashing cpu. */
151 +int crashing_cpu = -1;
152 +static cpumask_t cpus_in_crash = CPU_MASK_NONE;
153 +
154 +#ifdef CONFIG_SMP
155 +
156 +void crash_shutdown_secondary(void *ignore)
157 +{
158 + struct pt_regs* regs;
159 + int cpu = smp_processor_id();
160 +
161 + regs = task_pt_regs(current);
162 + if (!cpu_online(cpu))
163 + return;
164 +
165 + local_irq_disable();
166 + if (!cpu_isset(cpu, cpus_in_crash))
167 + crash_save_cpu(regs, cpu);
168 + cpu_set(cpu, cpus_in_crash);
169 +
170 + while(!atomic_read(&kexec_ready_to_reboot)) {
171 + cpu_relax();
172 + }
173 + relocated_kexec_smp_wait(NULL);
174 + /* NOTREACHED */
175 +}
176 +
177 +static void crash_kexec_prepare_cpus(void)
178 +{
179 + unsigned int msecs;
180 +
181 + unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
182 +
183 + smp_call_function (crash_shutdown_secondary, NULL, 0);
184 + smp_wmb();
185 +
186 + /*
187 + * FIXME: Until we will have the way to stop other CPUSs reliabally,
188 + * the crash CPU will send an IPI and wait for other CPUs to
189 + * respond.
190 + * Delay of at least 10 seconds.
191 + */
192 + printk(KERN_EMERG "Sending IPI to other cpus...\n");
193 + msecs = 10000;
194 + while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
195 + cpu_relax();
196 + mdelay(1);
197 + }
198 +
199 +}
200 +
201 +#else
202 +static void crash_kexec_prepare_cpus(void) {}
203 +#endif
204 +
205 +void default_machine_crash_shutdown(struct pt_regs *regs)
206 +{
207 + local_irq_disable();
208 + crashing_cpu = smp_processor_id();
209 + crash_save_cpu(regs, crashing_cpu);
210 + crash_kexec_prepare_cpus();
211 + cpu_set(crashing_cpu, cpus_in_crash);
212 +}
213 Index: linux-2.6.30.7/arch/mips/kernel/crash_dump.c
214 ===================================================================
215 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
216 +++ linux-2.6.30.7/arch/mips/kernel/crash_dump.c 2009-09-27 21:02:55.000000000 +0200
217 @@ -0,0 +1,96 @@
218 +/*
219 + * Routines for doing kexec-based kdump.
220 + *
221 + * Copyright (C) 2005, IBM Corp.
222 + * Copyright (C) 2008, MontaVista Software Inc.
223 + *
224 + * This source code is licensed under the GNU General Public License,
225 + * Version 2. See the file COPYING for more details.
226 + */
227 +
228 +#include <linux/highmem.h>
229 +#include <linux/bootmem.h>
230 +#include <linux/crash_dump.h>
231 +#include <asm/uaccess.h>
232 +
233 +#ifdef CONFIG_PROC_VMCORE
234 +static int __init parse_elfcorehdr(char *p)
235 +{
236 + if (p)
237 + elfcorehdr_addr = memparse(p, &p);
238 + return 1;
239 +}
240 +__setup("elfcorehdr=", parse_elfcorehdr);
241 +#endif
242 +
243 +static int __init parse_savemaxmem(char *p)
244 +{
245 + if (p)
246 + saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
247 +
248 + return 1;
249 +}
250 +__setup("savemaxmem=", parse_savemaxmem);
251 +
252 +
253 +static void *kdump_buf_page;
254 +
255 +/**
256 + * copy_oldmem_page - copy one page from "oldmem"
257 + * @pfn: page frame number to be copied
258 + * @buf: target memory address for the copy; this can be in kernel address
259 + * space or user address space (see @userbuf)
260 + * @csize: number of bytes to copy
261 + * @offset: offset in bytes into the page (based on pfn) to begin the copy
262 + * @userbuf: if set, @buf is in user address space, use copy_to_user(),
263 + * otherwise @buf is in kernel address space, use memcpy().
264 + *
265 + * Copy a page from "oldmem". For this page, there is no pte mapped
266 + * in the current kernel.
267 + *
268 + * Calling copy_to_user() in atomic context is not desirable. Hence first
269 + * copying the data to a pre-allocated kernel page and then copying to user
270 + * space in non-atomic context.
271 + */
272 +ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
273 + size_t csize, unsigned long offset, int userbuf)
274 +{
275 + void *vaddr;
276 +
277 + if (!csize)
278 + return 0;
279 +
280 + vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
281 +
282 + if (!userbuf) {
283 + memcpy(buf, (vaddr + offset), csize);
284 + kunmap_atomic(vaddr, KM_PTE0);
285 + } else {
286 + if (!kdump_buf_page) {
287 + printk(KERN_WARNING "Kdump: Kdump buffer page not"
288 + " allocated\n");
289 + return -EFAULT;
290 + }
291 + copy_page(kdump_buf_page, vaddr);
292 + kunmap_atomic(vaddr, KM_PTE0);
293 + if (copy_to_user(buf, (kdump_buf_page + offset), csize))
294 + return -EFAULT;
295 + }
296 +
297 + return csize;
298 +}
299 +
300 +static int __init kdump_buf_page_init(void)
301 +{
302 + int ret = 0;
303 +
304 + kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
305 + if (!kdump_buf_page) {
306 + printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer"
307 + " page\n");
308 + ret = -ENOMEM;
309 + }
310 +
311 + return ret;
312 +}
313 +arch_initcall(kdump_buf_page_init);
314 Index: linux-2.6.30.7/arch/mips/kernel/machine_kexec.c
315 ===================================================================
316 --- linux-2.6.30.7.orig/arch/mips/kernel/machine_kexec.c 2009-09-15 19:46:05.000000000 +0200
317 +++ linux-2.6.30.7/arch/mips/kernel/machine_kexec.c 2009-09-27 21:02:55.000000000 +0200
318 @@ -19,9 +19,25 @@
319 extern unsigned long kexec_start_address;
320 extern unsigned long kexec_indirection_page;
321
322 +extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
323 +
324 +int (*_machine_kexec_prepare)(struct kimage *) = NULL;
325 +void (*_machine_kexec_shutdown)(void) = NULL;
326 +void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
327 +#ifdef CONFIG_SMP
328 +void (*relocated_kexec_smp_wait) (void *);
329 +atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
330 +#endif
331 +
332 int
333 machine_kexec_prepare(struct kimage *kimage)
334 {
335 + kexec_args[0] = fw_arg0;
336 + kexec_args[1] = fw_arg1;
337 + kexec_args[2] = fw_arg2;
338 + kexec_args[3] = fw_arg3;
339 + if (_machine_kexec_prepare)
340 + return _machine_kexec_prepare(kimage);
341 return 0;
342 }
343
344 @@ -33,13 +49,18 @@
345 void
346 machine_shutdown(void)
347 {
348 + if (_machine_kexec_shutdown)
349 + _machine_kexec_shutdown();
350 }
351
352 void
353 machine_crash_shutdown(struct pt_regs *regs)
354 {
355 + if (_machine_crash_shutdown)
356 + _machine_crash_shutdown(regs);
357 + else
358 + default_machine_crash_shutdown(regs);
359 }
360 -
361 typedef void (*noretfun_t)(void) __attribute__((noreturn));
362
363 void
364 @@ -52,7 +73,9 @@
365 reboot_code_buffer =
366 (unsigned long)page_address(image->control_code_page);
367
368 - kexec_start_address = image->start;
369 + kexec_start_address =
370 + (unsigned long) phys_to_virt(image->start);
371 +
372 kexec_indirection_page =
373 (unsigned long) phys_to_virt(image->head & PAGE_MASK);
374
375 @@ -63,7 +86,7 @@
376 * The generic kexec code builds a page list with physical
377 * addresses. they are directly accessible through KSEG0 (or
378 * CKSEG0 or XPHYS if on 64bit system), hence the
379 - * pys_to_virt() call.
380 + * phys_to_virt() call.
381 */
382 for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE);
383 ptr = (entry & IND_INDIRECTION) ?
384 @@ -78,8 +101,39 @@
385 */
386 local_irq_disable();
387
388 - printk("Will call new kernel at %08lx\n", image->start);
389 - printk("Bye ...\n");
390 + printk(KERN_EMERG "Will call new kernel at %08lx\n", image->start);
391 + printk(KERN_EMERG "Bye ...\n");
392 __flush_cache_all();
393 - ((noretfun_t) reboot_code_buffer)();
394 +#ifdef CONFIG_SMP
395 + /* All secondary cpus now may jump to kexec_wait cycle */
396 + relocated_kexec_smp_wait = (void *)(reboot_code_buffer +
397 + (kexec_smp_wait - relocate_new_kernel));
398 + smp_wmb();
399 + atomic_set(&kexec_ready_to_reboot,1);
400 +#endif
401 +
402 + ((noretfun_t) reboot_code_buffer)();
403 + printk(KERN_EMERG "Bye ...\n");
404 +}
405 +
406 +/* crashkernel=[13]size at addr specifies the location to reserve for
407 + * a crash kernel. By reserving this memory we guarantee
408 + * that linux never sets it up as a DMA target.
409 + * Useful for holding code to do something appropriate
410 + * after a kernel panic.
411 + */
412 +static int __init parse_crashkernel_cmdline(char *arg)
413 +{
414 + unsigned long size, base;
415 + size = memparse(arg, &arg);
416 + if (*arg == '@') {
417 + base = memparse(arg+1, &arg);
418 + /* FIXME: Do I want a sanity check
419 + * to validate the memory range?
420 + */
421 + crashk_res.start = base;
422 + crashk_res.end = base + size - 1;
423 + }
424 + return 0;
425 }
426 +early_param("crashkernel", parse_crashkernel_cmdline);
427 Index: linux-2.6.30.7/arch/mips/kernel/relocate_kernel.S
428 ===================================================================
429 --- linux-2.6.30.7.orig/arch/mips/kernel/relocate_kernel.S 2009-09-15 19:46:05.000000000 +0200
430 +++ linux-2.6.30.7/arch/mips/kernel/relocate_kernel.S 2009-09-27 21:02:55.000000000 +0200
431 @@ -14,7 +14,13 @@
432 #include <asm/stackframe.h>
433 #include <asm/addrspace.h>
434
435 +
436 LEAF(relocate_new_kernel)
437 + PTR_L a0, arg0
438 + PTR_L a1, arg1
439 + PTR_L a2, arg2
440 + PTR_L a3, arg3
441 +
442 PTR_L s0, kexec_indirection_page
443 PTR_L s1, kexec_start_address
444
445 @@ -26,7 +32,6 @@
446 and s3, s2, 0x1
447 beq s3, zero, 1f
448 and s4, s2, ~0x1 /* store destination addr in s4 */
449 - move a0, s4
450 b process_entry
451
452 1:
453 @@ -40,6 +45,7 @@
454 /* done page */
455 and s3, s2, 0x4
456 beq s3, zero, 1f
457 + nop
458 b done
459 1:
460 /* source page */
461 @@ -56,14 +62,102 @@
462 PTR_ADD s2, s2, SZREG
463 LONG_SUB s6, s6, 1
464 beq s6, zero, process_entry
465 + nop
466 b copy_word
467 + nop
468 b process_entry
469
470 done:
471 +#ifdef CONFIG_SMP
472 + /* kexec_flag reset is signal to other CPUs what kernel
473 + was moved to it's location. Note - we need relocated address
474 + of kexec_flag. */
475 +
476 + bal 1f
477 + 1: move t1,ra;
478 + PTR_LA t2,1b
479 + PTR_LA t0,kexec_flag
480 + PTR_SUB t0,t0,t2;
481 + PTR_ADD t0,t1,t0;
482 + LONG_S zero,(t0)
483 +#endif
484 +
485 + /* Some platforms need I-cache to be flushed before
486 + * jumping to new kernel.
487 + */
488 +
489 /* jump to kexec_start_address */
490 j s1
491 END(relocate_new_kernel)
492
493 +#ifdef CONFIG_SMP
494 +/*
495 + * Other CPUs should wait until code is relocated and
496 + * then start at entry point.
497 + */
498 +LEAF(kexec_smp_wait)
499 + PTR_L a0, s_arg0
500 + PTR_L a1, s_arg1
501 + PTR_L a2, s_arg2
502 + PTR_L a3, s_arg3
503 + PTR_L s1, kexec_start_address
504 +
505 + /* Non-relocated address works for args and kexec_start_address ( old
506 + * kernel is not overwritten). But we need relocated address of
507 + * kexec_flag.
508 + */
509 +
510 + bal 1f
511 +1: move t1,ra;
512 + PTR_LA t2,1b
513 + PTR_LA t0,kexec_flag
514 + PTR_SUB t0,t0,t2;
515 + PTR_ADD t0,t1,t0;
516 +
517 +1: LONG_L s0, (t0)
518 + bne s0, zero,1b
519 +
520 + j s1
521 + END(kexec_smp_wait)
522 +#endif
523 +
524 +
525 +#ifdef __mips64
526 + /* all PTR's must be aligned to 8 byte in 64-bit mode */
527 + .align 3
528 +#endif
529 +
530 +/* All parameters to new kernel are passed in registers a0-a3.
531 + * kexec_args[0..3] are uses to prepare register values.
532 + */
533 +
534 +kexec_args:
535 + EXPORT(kexec_args)
536 +arg0: PTR 0x0
537 +arg1: PTR 0x0
538 +arg2: PTR 0x0
539 +arg3: PTR 0x0
540 + .size kexec_args,PTRSIZE*4
541 +
542 +#ifdef CONFIG_SMP
543 +/*
544 + * Secondary CPUs may have different kernel parameters in
545 + * their registers a0-a3. secondary_kexec_args[0..3] are used
546 + * to prepare register values.
547 + */
548 +secondary_kexec_args:
549 + EXPORT(secondary_kexec_args)
550 +s_arg0: PTR 0x0
551 +s_arg1: PTR 0x0
552 +s_arg2: PTR 0x0
553 +s_arg3: PTR 0x0
554 + .size secondary_kexec_args,PTRSIZE*4
555 +kexec_flag:
556 + LONG 0x1
557 +
558 +#endif
559 +
560 +
561 kexec_start_address:
562 EXPORT(kexec_start_address)
563 PTR 0x0
564 Index: linux-2.6.30.7/arch/mips/kernel/setup.c
565 ===================================================================
566 --- linux-2.6.30.7.orig/arch/mips/kernel/setup.c 2009-09-15 19:46:05.000000000 +0200
567 +++ linux-2.6.30.7/arch/mips/kernel/setup.c 2009-09-27 21:02:55.000000000 +0200
568 @@ -21,7 +21,7 @@
569 #include <linux/console.h>
570 #include <linux/pfn.h>
571 #include <linux/debugfs.h>
572 -
573 +#include <linux/kexec.h>
574 #include <asm/addrspace.h>
575 #include <asm/bootinfo.h>
576 #include <asm/bugs.h>
577 @@ -489,6 +489,11 @@
578 }
579
580 bootmem_init();
581 +#ifdef CONFIG_CRASH_DUMP
582 + if (crashk_res.start != crashk_res.end)
583 + reserve_bootmem(crashk_res.start,
584 + crashk_res.end - crashk_res.start + 1);
585 +#endif
586 sparse_init();
587 paging_init();
588 }
589 @@ -543,6 +548,9 @@
590 */
591 request_resource(res, &code_resource);
592 request_resource(res, &data_resource);
593 +#ifdef CONFIG_KEXEC
594 + request_resource(res, &crashk_res);
595 +#endif
596 }
597 }
598
599 Index: linux-2.6.30.7/arch/mips/include/asm/kexec.h
600 ===================================================================
601 --- linux-2.6.30.7.orig/arch/mips/include/asm/kexec.h 2009-09-15 19:46:05.000000000 +0200
602 +++ linux-2.6.30.7/arch/mips/include/asm/kexec.h 2009-09-27 21:02:55.000000000 +0200
603 @@ -9,6 +9,8 @@
604 #ifndef _MIPS_KEXEC
605 # define _MIPS_KEXEC
606
607 +#include <asm/stacktrace.h>
608 +
609 /* Maximum physical address we can use pages from */
610 #define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
611 /* Maximum address we can reach in physical address mode */
612 @@ -24,7 +26,24 @@
613 static inline void crash_setup_regs(struct pt_regs *newregs,
614 struct pt_regs *oldregs)
615 {
616 - /* Dummy implementation for now */
617 + if (oldregs)
618 + memcpy(newregs, oldregs, sizeof(*newregs));
619 + else
620 + prepare_frametrace(newregs);
621 }
622
623 +#ifdef CONFIG_KEXEC
624 +struct kimage;
625 +extern unsigned long kexec_args[4];
626 +extern int (*_machine_kexec_prepare)(struct kimage *);
627 +extern void (*_machine_kexec_shutdown)(void);
628 +extern void (*_machine_crash_shutdown)(struct pt_regs *regs);
629 +extern void default_machine_crash_shutdown(struct pt_regs *regs);
630 +#ifdef CONFIG_SMP
631 +extern const unsigned char kexec_smp_wait[];
632 +extern unsigned long secondary_kexec_args[4];
633 +extern void (*relocated_kexec_smp_wait) (void *);
634 +extern atomic_t kexec_ready_to_reboot;
635 +#endif
636 +#endif
637 #endif /* !_MIPS_KEXEC */