2 * arch/s390/kernel/machine_kexec.c
4 * (C) Copyright IBM Corp. 2005
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
11 * s390_machine_kexec.c - handle the transition of Linux booting another kernel
12 * on the S390 architecture.
15 #include <linux/device.h>
17 #include <linux/kexec.h>
18 #include <linux/delay.h>
20 #include <asm/setup.h>
21 #include <asm/pgtable.h>
22 #include <asm/pgalloc.h>
23 #include <asm/system.h>
26 static void kexec_halt_all_cpus(void *);
28 typedef void (*relocate_kernel_t) (kimage_entry_t *, unsigned long);
30 extern const unsigned char relocate_kernel[];
31 extern const unsigned long long relocate_kernel_len;
34 machine_kexec_prepare(struct kimage *image)
36 unsigned long reboot_code_buffer;
38 /* We don't support anything but the default image type for now. */
39 if (image->type != KEXEC_TYPE_DEFAULT)
42 /* Get the destination where the assembler code should be copied to.*/
43 reboot_code_buffer = page_to_pfn(image->control_code_page)<<PAGE_SHIFT;
46 memcpy((void *) reboot_code_buffer, relocate_kernel,
52 machine_kexec_cleanup(struct kimage *image)
57 machine_shutdown(void)
59 printk(KERN_INFO "kexec: machine_shutdown called\n");
63 machine_kexec(struct kimage *image)
65 clear_all_subchannels();
66 cio_reset_channel_paths();
68 /* Disable lowcore protection */
71 on_each_cpu(kexec_halt_all_cpus, image, 0, 0);
75 extern void pfault_fini(void);
78 kexec_halt_all_cpus(void *kernel_image)
80 static atomic_t cpuid = ATOMIC_INIT(-1);
83 relocate_kernel_t data_mover;
90 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
91 signal_processor(smp_processor_id(), sigp_stop);
93 /* Wait for all other cpus to enter stopped state */
94 for_each_online_cpu(cpu) {
95 if (cpu == smp_processor_id())
97 while (!smp_cpu_not_running(cpu))
101 image = (struct kimage *) kernel_image;
102 data_mover = (relocate_kernel_t)
103 (page_to_pfn(image->control_code_page) << PAGE_SHIFT);
105 /* Call the moving routine */
106 (*data_mover) (&image->head, image->start);