330-mips-add-crash-and-kdump-support.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. From eee16330c9de9adf7880cce9f1d32e13f89706bb Mon Sep 17 00:00:00 2001
  2. From: Wu Zhangjin <wuzhangjin@gmail.com>
  3. Date: Tue, 11 Jan 2011 13:16:47 +0000
  4. Subject: MIPS: Add crash and kdump support
  5. From: http://patchwork.linux-mips.org/patch/1025/
  6. Hello folks,
  7. Please find here MIPS crash and kdump patches.
  8. This is patch set of 3 patches:
  9. 1. generic MIPS changes (kernel);
  10. 2. MIPS Cavium Octeon board kexec/kdump code (kernel);
  11. 3. Kexec user space MIPS changes.
  12. Patches were tested on the latest linux-mips@ git kernel and the latest
  13. kexec-tools git on Cavium Octeon 50xx board.
  14. I also made the same code working on RMI XLR/XLS boards for both
  15. mips32 and mips64 kernels.
  16. Best regards,
  17. Maxim Uvarov.
  18. ------
  19. [ Zhangjin: Several trivial building failure has been fixed.
  20. Note: the 2nd patch can not be cleanly applied, but may be a good
  21. reference for the other board development:
  22. + MIPS Cavium Octeon board kexec,kdump support
  23. http://patchwork.linux-mips.org/patch/1026/
  24. And the 3rd patch has already been merged into the mainline kexec-tools:
  25. + some kexec MIPS improvements
  26. http://patchwork.linux-mips.org/patch/1027/
  27. kexec-tools is available here:
  28. + http://horms.net/projects/kexec/
  29. git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
  30. ]
  31. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
  32. ---
  33. (limited to 'arch/mips/kernel')
  34. --- a/arch/mips/kernel/Makefile
  35. +++ b/arch/mips/kernel/Makefile
  36. @@ -97,7 +97,8 @@ obj-$(CONFIG_I8253) += i8253.o
  37. obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
  38. -obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
  39. +obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
  40. +obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
  41. obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
  42. obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
  43. obj-$(CONFIG_MIPS_MACHINE) += mips_machine.o
  44. --- /dev/null
  45. +++ b/arch/mips/kernel/crash.c
  46. @@ -0,0 +1,75 @@
  47. +#include <linux/kernel.h>
  48. +#include <linux/smp.h>
  49. +#include <linux/reboot.h>
  50. +#include <linux/kexec.h>
  51. +#include <linux/bootmem.h>
  52. +#include <linux/crash_dump.h>
  53. +#include <linux/delay.h>
  54. +#include <linux/init.h>
  55. +#include <linux/irq.h>
  56. +#include <linux/types.h>
  57. +#include <linux/sched.h>
  58. +
  59. +#ifdef CONFIG_CRASH_DUMP
  60. +unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
  61. +#endif
  62. +
  63. +/* This keeps a track of which one is crashing cpu. */
  64. +int crashing_cpu = -1;
  65. +static cpumask_t cpus_in_crash = CPU_MASK_NONE;
  66. +
  67. +#ifdef CONFIG_SMP
  68. +void crash_shutdown_secondary(void *ignore)
  69. +{
  70. + struct pt_regs *regs;
  71. + int cpu = smp_processor_id();
  72. +
  73. + regs = task_pt_regs(current);
  74. +
  75. + if (!cpu_online(cpu))
  76. + return;
  77. +
  78. + local_irq_disable();
  79. + if (!cpu_isset(cpu, cpus_in_crash))
  80. + crash_save_cpu(regs, cpu);
  81. + cpu_set(cpu, cpus_in_crash);
  82. +
  83. + while (!atomic_read(&kexec_ready_to_reboot))
  84. + cpu_relax();
  85. + relocated_kexec_smp_wait(NULL);
  86. + /* NOTREACHED */
  87. +}
  88. +
  89. +static void crash_kexec_prepare_cpus(void)
  90. +{
  91. + unsigned int msecs;
  92. +
  93. + unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
  94. +
  95. + dump_send_ipi(crash_shutdown_secondary);
  96. + smp_wmb();
  97. +
  98. + /*
  99. + * The crash CPU sends an IPI and wait for other CPUs to
  100. + * respond. Delay of at least 10 seconds.
  101. + */
  102. + printk(KERN_EMERG "Sending IPI to other cpus...\n");
  103. + msecs = 10000;
  104. + while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
  105. + cpu_relax();
  106. + mdelay(1);
  107. + }
  108. +}
  109. +
  110. +#else
  111. +static void crash_kexec_prepare_cpus(void) {}
  112. +#endif
  113. +
  114. +void default_machine_crash_shutdown(struct pt_regs *regs)
  115. +{
  116. + local_irq_disable();
  117. + crashing_cpu = smp_processor_id();
  118. + crash_save_cpu(regs, crashing_cpu);
  119. + crash_kexec_prepare_cpus();
  120. + cpu_set(crashing_cpu, cpus_in_crash);
  121. +}
  122. --- /dev/null
  123. +++ b/arch/mips/kernel/crash_dump.c
  124. @@ -0,0 +1,86 @@
  125. +#include <linux/highmem.h>
  126. +#include <linux/bootmem.h>
  127. +#include <linux/crash_dump.h>
  128. +#include <asm/uaccess.h>
  129. +
  130. +#ifdef CONFIG_PROC_VMCORE
  131. +static int __init parse_elfcorehdr(char *p)
  132. +{
  133. + if (p)
  134. + elfcorehdr_addr = memparse(p, &p);
  135. + return 1;
  136. +}
  137. +__setup("elfcorehdr=", parse_elfcorehdr);
  138. +#endif
  139. +
  140. +static int __init parse_savemaxmem(char *p)
  141. +{
  142. + if (p)
  143. + saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
  144. +
  145. + return 1;
  146. +}
  147. +__setup("savemaxmem=", parse_savemaxmem);
  148. +
  149. +
  150. +static void *kdump_buf_page;
  151. +
  152. +/**
  153. + * copy_oldmem_page - copy one page from "oldmem"
  154. + * @pfn: page frame number to be copied
  155. + * @buf: target memory address for the copy; this can be in kernel address
  156. + * space or user address space (see @userbuf)
  157. + * @csize: number of bytes to copy
  158. + * @offset: offset in bytes into the page (based on pfn) to begin the copy
  159. + * @userbuf: if set, @buf is in user address space, use copy_to_user(),
  160. + * otherwise @buf is in kernel address space, use memcpy().
  161. + *
  162. + * Copy a page from "oldmem". For this page, there is no pte mapped
  163. + * in the current kernel.
  164. + *
  165. + * Calling copy_to_user() in atomic context is not desirable. Hence first
  166. + * copying the data to a pre-allocated kernel page and then copying to user
  167. + * space in non-atomic context.
  168. + */
  169. +ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
  170. + size_t csize, unsigned long offset, int userbuf)
  171. +{
  172. + void *vaddr;
  173. +
  174. + if (!csize)
  175. + return 0;
  176. +
  177. + vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
  178. +
  179. + if (!userbuf) {
  180. + memcpy(buf, (vaddr + offset), csize);
  181. + kunmap_atomic(vaddr, KM_PTE0);
  182. + } else {
  183. + if (!kdump_buf_page) {
  184. + printk(KERN_WARNING "Kdump: Kdump buffer page not"
  185. + " allocated\n");
  186. + return -EFAULT;
  187. + }
  188. + copy_page(kdump_buf_page, vaddr);
  189. + kunmap_atomic(vaddr, KM_PTE0);
  190. + if (copy_to_user(buf, (kdump_buf_page + offset), csize))
  191. + return -EFAULT;
  192. + }
  193. +
  194. + return csize;
  195. +}
  196. +
  197. +static int __init kdump_buf_page_init(void)
  198. +{
  199. + int ret = 0;
  200. +
  201. + kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
  202. + if (!kdump_buf_page) {
  203. + printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer"
  204. + " page\n");
  205. + ret = -ENOMEM;
  206. + }
  207. +
  208. + return ret;
  209. +}
  210. +arch_initcall(kdump_buf_page_init);
  211. --- a/arch/mips/kernel/machine_kexec.c
  212. +++ b/arch/mips/kernel/machine_kexec.c
  213. @@ -19,9 +19,19 @@ extern const size_t relocate_new_kernel_
  214. extern unsigned long kexec_start_address;
  215. extern unsigned long kexec_indirection_page;
  216. +int (*_machine_kexec_prepare)(struct kimage *) = NULL;
  217. +void (*_machine_kexec_shutdown)(void) = NULL;
  218. +void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
  219. +#ifdef CONFIG_SMP
  220. +void (*relocated_kexec_smp_wait) (void *);
  221. +atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
  222. +#endif
  223. +
  224. int
  225. machine_kexec_prepare(struct kimage *kimage)
  226. {
  227. + if (_machine_kexec_prepare)
  228. + return _machine_kexec_prepare(kimage);
  229. return 0;
  230. }
  231. @@ -33,11 +43,17 @@ machine_kexec_cleanup(struct kimage *kim
  232. void
  233. machine_shutdown(void)
  234. {
  235. + if (_machine_kexec_shutdown)
  236. + _machine_kexec_shutdown();
  237. }
  238. void
  239. machine_crash_shutdown(struct pt_regs *regs)
  240. {
  241. + if (_machine_crash_shutdown)
  242. + _machine_crash_shutdown(regs);
  243. + else
  244. + default_machine_crash_shutdown(regs);
  245. }
  246. typedef void (*noretfun_t)(void) __attribute__((noreturn));
  247. @@ -52,7 +68,9 @@ machine_kexec(struct kimage *image)
  248. reboot_code_buffer =
  249. (unsigned long)page_address(image->control_code_page);
  250. - kexec_start_address = (unsigned long) phys_to_virt(image->start);
  251. + kexec_start_address =
  252. + (unsigned long) phys_to_virt(image->start);
  253. +
  254. kexec_indirection_page =
  255. (unsigned long) phys_to_virt(image->head & PAGE_MASK);
  256. @@ -63,7 +81,7 @@ machine_kexec(struct kimage *image)
  257. * The generic kexec code builds a page list with physical
  258. * addresses. they are directly accessible through KSEG0 (or
  259. * CKSEG0 or XPHYS if on 64bit system), hence the
  260. - * pys_to_virt() call.
  261. + * phys_to_virt() call.
  262. */
  263. for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE);
  264. ptr = (entry & IND_INDIRECTION) ?
  265. @@ -81,5 +99,13 @@ machine_kexec(struct kimage *image)
  266. printk("Will call new kernel at %08lx\n", image->start);
  267. printk("Bye ...\n");
  268. __flush_cache_all();
  269. +#ifdef CONFIG_SMP
  270. + /* All secondary cpus now may jump to kexec_wait cycle */
  271. + relocated_kexec_smp_wait = reboot_code_buffer +
  272. + (void *)(kexec_smp_wait - relocate_new_kernel);
  273. + smp_wmb();
  274. + atomic_set(&kexec_ready_to_reboot, 1);
  275. +#endif
  276. ((noretfun_t) reboot_code_buffer)();
  277. }
  278. +
  279. --- a/arch/mips/kernel/relocate_kernel.S
  280. +++ b/arch/mips/kernel/relocate_kernel.S
  281. @@ -15,6 +15,11 @@
  282. #include <asm/addrspace.h>
  283. LEAF(relocate_new_kernel)
  284. + PTR_L a0, arg0
  285. + PTR_L a1, arg1
  286. + PTR_L a2, arg2
  287. + PTR_L a3, arg3
  288. +
  289. PTR_L s0, kexec_indirection_page
  290. PTR_L s1, kexec_start_address
  291. @@ -26,7 +31,6 @@ process_entry:
  292. and s3, s2, 0x1
  293. beq s3, zero, 1f
  294. and s4, s2, ~0x1 /* store destination addr in s4 */
  295. - move a0, s4
  296. b process_entry
  297. 1:
  298. @@ -60,23 +64,100 @@ copy_word:
  299. b process_entry
  300. done:
  301. +#ifdef CONFIG_SMP
  302. + /* kexec_flag reset is signal to other CPUs what kernel
  303. + was moved to it's location. Note - we need relocated address
  304. + of kexec_flag. */
  305. +
  306. + bal 1f
  307. + 1: move t1,ra;
  308. + PTR_LA t2,1b
  309. + PTR_LA t0,kexec_flag
  310. + PTR_SUB t0,t0,t2;
  311. + PTR_ADD t0,t1,t0;
  312. + LONG_S zero,(t0)
  313. +#endif
  314. +
  315. + sync
  316. /* jump to kexec_start_address */
  317. j s1
  318. END(relocate_new_kernel)
  319. -kexec_start_address:
  320. - EXPORT(kexec_start_address)
  321. +#ifdef CONFIG_SMP
  322. +/*
  323. + * Other CPUs should wait until code is relocated and
  324. + * then start at entry (?) point.
  325. + */
  326. +LEAF(kexec_smp_wait)
  327. + PTR_L a0, s_arg0
  328. + PTR_L a1, s_arg1
  329. + PTR_L a2, s_arg2
  330. + PTR_L a3, s_arg3
  331. + PTR_L s1, kexec_start_address
  332. +
  333. + /* Non-relocated address works for args and kexec_start_address ( old
  334. + * kernel is not overwritten). But we need relocated address of
  335. + * kexec_flag.
  336. + */
  337. +
  338. + bal 1f
  339. +1: move t1,ra;
  340. + PTR_LA t2,1b
  341. + PTR_LA t0,kexec_flag
  342. + PTR_SUB t0,t0,t2;
  343. + PTR_ADD t0,t1,t0;
  344. +
  345. +1: LONG_L s0, (t0)
  346. + bne s0, zero,1b
  347. +
  348. + sync
  349. + j s1
  350. + END(kexec_smp_wait)
  351. +#endif
  352. +
  353. +#ifdef __mips64
  354. + /* all PTR's must be aligned to 8 byte in 64-bit mode */
  355. + .align 3
  356. +#endif
  357. +
  358. +/* All parameters to new kernel are passed in registers a0-a3.
  359. + * kexec_args[0..3] are uses to prepare register values.
  360. + */
  361. +
  362. +EXPORT(kexec_args)
  363. +arg0: PTR 0x0
  364. +arg1: PTR 0x0
  365. +arg2: PTR 0x0
  366. +arg3: PTR 0x0
  367. + .size kexec_args,PTRSIZE*4
  368. +
  369. +#ifdef CONFIG_SMP
  370. +/*
  371. + * Secondary CPUs may have different kernel parameters in
  372. + * their registers a0-a3. secondary_kexec_args[0..3] are used
  373. + * to prepare register values.
  374. + */
  375. +EXPORT(secondary_kexec_args)
  376. +s_arg0: PTR 0x0
  377. +s_arg1: PTR 0x0
  378. +s_arg2: PTR 0x0
  379. +s_arg3: PTR 0x0
  380. + .size secondary_kexec_args,PTRSIZE*4
  381. +kexec_flag:
  382. + LONG 0x1
  383. +
  384. +#endif
  385. +
  386. +EXPORT(kexec_start_address)
  387. PTR 0x0
  388. .size kexec_start_address, PTRSIZE
  389. -kexec_indirection_page:
  390. - EXPORT(kexec_indirection_page)
  391. +EXPORT(kexec_indirection_page)
  392. PTR 0
  393. .size kexec_indirection_page, PTRSIZE
  394. relocate_new_kernel_end:
  395. -relocate_new_kernel_size:
  396. - EXPORT(relocate_new_kernel_size)
  397. +EXPORT(relocate_new_kernel_size)
  398. PTR relocate_new_kernel_end - relocate_new_kernel
  399. .size relocate_new_kernel_size, PTRSIZE
  400. --- a/arch/mips/kernel/setup.c
  401. +++ b/arch/mips/kernel/setup.c
  402. @@ -22,6 +22,7 @@
  403. #include <linux/console.h>
  404. #include <linux/pfn.h>
  405. #include <linux/debugfs.h>
  406. +#include <linux/kexec.h>
  407. #include <asm/addrspace.h>
  408. #include <asm/bootinfo.h>
  409. @@ -523,12 +524,62 @@ static void __init arch_mem_init(char **
  410. }
  411. bootmem_init();
  412. +#ifdef CONFIG_KEXEC
  413. + if (crashk_res.start != crashk_res.end)
  414. + reserve_bootmem(crashk_res.start,
  415. + crashk_res.end - crashk_res.start + 1,
  416. + BOOTMEM_DEFAULT);
  417. +#endif
  418. device_tree_init();
  419. sparse_init();
  420. plat_swiotlb_setup();
  421. paging_init();
  422. }
  423. +#ifdef CONFIG_KEXEC
  424. +static inline unsigned long long get_total_mem(void)
  425. +{
  426. + unsigned long long total;
  427. + total = max_pfn - min_low_pfn;
  428. + return total << PAGE_SHIFT;
  429. +}
  430. +
  431. +static void __init mips_parse_crashkernel(void)
  432. +{
  433. + unsigned long long total_mem;
  434. + unsigned long long crash_size, crash_base;
  435. + int ret;
  436. +
  437. + total_mem = get_total_mem();
  438. + ret = parse_crashkernel(boot_command_line, total_mem,
  439. + &crash_size, &crash_base);
  440. + if (ret != 0 || crash_size <= 0)
  441. + return;
  442. +
  443. + crashk_res.start = crash_base;
  444. + crashk_res.end = crash_base + crash_size - 1;
  445. +}
  446. +static void __init request_crashkernel(struct resource *res)
  447. +{
  448. + int ret;
  449. +
  450. + ret = request_resource(res, &crashk_res);
  451. + if (!ret)
  452. + printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
  453. + "for crashkernel\n",
  454. + (unsigned long)((crashk_res.end -
  455. + crashk_res.start + 1) >> 20),
  456. + (unsigned long)(crashk_res.start >> 20));
  457. +}
  458. +#else
  459. +static void __init mips_parse_crashkernel(void)
  460. +{
  461. +}
  462. +static void __init request_crashkernel(struct resource *res)
  463. +{
  464. +}
  465. +#endif
  466. +
  467. static void __init resource_init(void)
  468. {
  469. int i;
  470. @@ -544,6 +595,8 @@ static void __init resource_init(void)
  471. /*
  472. * Request address space for all standard RAM.
  473. */
  474. + mips_parse_crashkernel();
  475. +
  476. for (i = 0; i < boot_mem_map.nr_map; i++) {
  477. struct resource *res;
  478. unsigned long start, end;
  479. @@ -580,6 +633,7 @@ static void __init resource_init(void)
  480. */
  481. request_resource(res, &code_resource);
  482. request_resource(res, &data_resource);
  483. + request_crashkernel(res);
  484. }
  485. }
  486. --- a/arch/mips/kernel/smp.c
  487. +++ b/arch/mips/kernel/smp.c
  488. @@ -433,3 +433,21 @@ void flush_tlb_one(unsigned long vaddr)
  489. EXPORT_SYMBOL(flush_tlb_page);
  490. EXPORT_SYMBOL(flush_tlb_one);
  491. +
  492. +#if defined(CONFIG_KEXEC)
  493. +void (*dump_ipi_function_ptr)(void *) = NULL;
  494. +void dump_send_ipi(void (*dump_ipi_callback)(void *))
  495. +{
  496. + int i;
  497. + int cpu = smp_processor_id();
  498. +
  499. + dump_ipi_function_ptr = dump_ipi_callback;
  500. + smp_mb();
  501. + for_each_online_cpu(i)
  502. + if (i != cpu)
  503. + core_send_ipi(i, SMP_DUMP);
  504. +
  505. +}
  506. +EXPORT_SYMBOL(dump_send_ipi);
  507. +#endif
  508. +
  509. --- a/arch/mips/include/asm/kexec.h
  510. +++ b/arch/mips/include/asm/kexec.h
  511. @@ -9,22 +9,45 @@
  512. #ifndef _MIPS_KEXEC
  513. # define _MIPS_KEXEC
  514. +#include <asm/stacktrace.h>
  515. +
  516. +extern unsigned long long elfcorehdr_addr;
  517. +
  518. /* Maximum physical address we can use pages from */
  519. #define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
  520. /* Maximum address we can reach in physical address mode */
  521. #define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
  522. /* Maximum address we can use for the control code buffer */
  523. #define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
  524. -
  525. -#define KEXEC_CONTROL_PAGE_SIZE 4096
  526. +/* Reserve 3*4096 bytes for board-specific info */
  527. +#define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096)
  528. /* The native architecture */
  529. #define KEXEC_ARCH KEXEC_ARCH_MIPS
  530. +#define MAX_NOTE_BYTES 1024
  531. static inline void crash_setup_regs(struct pt_regs *newregs,
  532. - struct pt_regs *oldregs)
  533. + struct pt_regs *oldregs)
  534. {
  535. - /* Dummy implementation for now */
  536. + if (oldregs)
  537. + memcpy(newregs, oldregs, sizeof(*newregs));
  538. + else
  539. + prepare_frametrace(newregs);
  540. }
  541. +#ifdef CONFIG_KEXEC
  542. +struct kimage;
  543. +extern unsigned long kexec_args[4];
  544. +extern int (*_machine_kexec_prepare)(struct kimage *);
  545. +extern void (*_machine_kexec_shutdown)(void);
  546. +extern void (*_machine_crash_shutdown)(struct pt_regs *regs);
  547. +extern void default_machine_crash_shutdown(struct pt_regs *regs);
  548. +#ifdef CONFIG_SMP
  549. +extern const unsigned char kexec_smp_wait[];
  550. +extern unsigned long secondary_kexec_args[4];
  551. +extern void (*relocated_kexec_smp_wait) (void *);
  552. +extern atomic_t kexec_ready_to_reboot;
  553. +#endif
  554. +#endif
  555. +
  556. #endif /* !_MIPS_KEXEC */
  557. --- a/arch/mips/include/asm/smp.h
  558. +++ b/arch/mips/include/asm/smp.h
  559. @@ -40,6 +40,8 @@ extern int __cpu_logical_map[NR_CPUS];
  560. #define SMP_CALL_FUNCTION 0x2
  561. /* Octeon - Tell another core to flush its icache */
  562. #define SMP_ICACHE_FLUSH 0x4
  563. +/* Used by kexec crashdump to save all cpu's state */
  564. +#define SMP_DUMP 0x8
  565. extern volatile cpumask_t cpu_callin_map;
  566. @@ -91,4 +93,9 @@ static inline void arch_send_call_functi
  567. mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
  568. }
  569. +extern void core_send_ipi(int cpu, unsigned int action);
  570. +#if defined(CONFIG_KEXEC)
  571. +extern void (*dump_ipi_function_ptr)(void *);
  572. +void dump_send_ipi(void (*dump_ipi_callback)(void *));
  573. +#endif
  574. #endif /* __ASM_SMP_H */