Merge tag 'linux-kselftest-kunit-fixes-5.11-rc3' of git://git.kernel.org/pub/scm...
[linux/fpc-iii.git] / arch / m68k / kernel / machine_kexec.c
blob206f849831203ca1bfd40045732b630903b4950d
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * machine_kexec.c - handle transition of Linux booting another kernel
4 */
5 #include <linux/compiler.h>
6 #include <linux/kexec.h>
7 #include <linux/mm.h>
8 #include <linux/delay.h>
10 #include <asm/cacheflush.h>
11 #include <asm/page.h>
12 #include <asm/setup.h>
14 extern const unsigned char relocate_new_kernel[];
15 extern const size_t relocate_new_kernel_size;
17 int machine_kexec_prepare(struct kimage *kimage)
19 return 0;
22 void machine_kexec_cleanup(struct kimage *kimage)
26 void machine_shutdown(void)
30 void machine_crash_shutdown(struct pt_regs *regs)
34 typedef void (*relocate_kernel_t)(unsigned long ptr,
35 unsigned long start,
36 unsigned long cpu_mmu_flags) __noreturn;
38 void machine_kexec(struct kimage *image)
40 void *reboot_code_buffer;
41 unsigned long cpu_mmu_flags;
43 reboot_code_buffer = page_address(image->control_code_page);
45 memcpy(reboot_code_buffer, relocate_new_kernel,
46 relocate_new_kernel_size);
49 * we do not want to be bothered.
51 local_irq_disable();
53 pr_info("Will call new kernel at 0x%08lx. Bye...\n", image->start);
54 __flush_cache_all();
55 cpu_mmu_flags = m68k_cputype | m68k_mmutype << 8;
56 ((relocate_kernel_t) reboot_code_buffer)(image->head & PAGE_MASK,
57 image->start,
58 cpu_mmu_flags);