aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/machine_kexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/machine_kexec.c')
-rw-r--r--arch/s390/kernel/machine_kexec.c78
1 files changed, 18 insertions, 60 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 60b1ea9f946b..f6d9bcc0f75b 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -1,15 +1,10 @@
1/* 1/*
2 * arch/s390/kernel/machine_kexec.c 2 * arch/s390/kernel/machine_kexec.c
3 * 3 *
4 * (C) Copyright IBM Corp. 2005 4 * Copyright IBM Corp. 2005,2006
5 * 5 *
6 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> 6 * Author(s): Rolf Adelsberger,
7 * 7 * Heiko Carstens <heiko.carstens@de.ibm.com>
8 */
9
10/*
11 * s390_machine_kexec.c - handle the transition of Linux booting another kernel
12 * on the S390 architecture.
13 */ 8 */
14 9
15#include <linux/device.h> 10#include <linux/device.h>
@@ -22,86 +17,49 @@
22#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
23#include <asm/system.h> 18#include <asm/system.h>
24#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/reset.h>
25 21
26static void kexec_halt_all_cpus(void *); 22typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long);
27
28typedef void (*relocate_kernel_t) (kimage_entry_t *, unsigned long);
29 23
30extern const unsigned char relocate_kernel[]; 24extern const unsigned char relocate_kernel[];
31extern const unsigned long long relocate_kernel_len; 25extern const unsigned long long relocate_kernel_len;
32 26
33int 27int machine_kexec_prepare(struct kimage *image)
34machine_kexec_prepare(struct kimage *image)
35{ 28{
36 unsigned long reboot_code_buffer; 29 void *reboot_code_buffer;
37 30
38 /* We don't support anything but the default image type for now. */ 31 /* We don't support anything but the default image type for now. */
39 if (image->type != KEXEC_TYPE_DEFAULT) 32 if (image->type != KEXEC_TYPE_DEFAULT)
40 return -EINVAL; 33 return -EINVAL;
41 34
42 /* Get the destination where the assembler code should be copied to.*/ 35 /* Get the destination where the assembler code should be copied to.*/
43 reboot_code_buffer = page_to_pfn(image->control_code_page)<<PAGE_SHIFT; 36 reboot_code_buffer = (void *) page_to_phys(image->control_code_page);
44 37
45 /* Then copy it */ 38 /* Then copy it */
46 memcpy((void *) reboot_code_buffer, relocate_kernel, 39 memcpy(reboot_code_buffer, relocate_kernel, relocate_kernel_len);
47 relocate_kernel_len);
48 return 0; 40 return 0;
49} 41}
50 42
51void 43void machine_kexec_cleanup(struct kimage *image)
52machine_kexec_cleanup(struct kimage *image)
53{ 44{
54} 45}
55 46
56void 47void machine_shutdown(void)
57machine_shutdown(void)
58{ 48{
59 printk(KERN_INFO "kexec: machine_shutdown called\n"); 49 printk(KERN_INFO "kexec: machine_shutdown called\n");
60} 50}
61 51
62NORET_TYPE void 52void machine_kexec(struct kimage *image)
63machine_kexec(struct kimage *image)
64{ 53{
65 clear_all_subchannels();
66 cio_reset_channel_paths();
67
68 /* Disable lowcore protection */
69 ctl_clear_bit(0,28);
70
71 on_each_cpu(kexec_halt_all_cpus, image, 0, 0);
72 for (;;);
73}
74
75extern void pfault_fini(void);
76
77static void
78kexec_halt_all_cpus(void *kernel_image)
79{
80 static atomic_t cpuid = ATOMIC_INIT(-1);
81 int cpu;
82 struct kimage *image;
83 relocate_kernel_t data_mover; 54 relocate_kernel_t data_mover;
84 55
85#ifdef CONFIG_PFAULT 56 smp_send_stop();
86 if (MACHINE_IS_VM) 57 pfault_fini();
87 pfault_fini(); 58 s390_reset_system();
88#endif
89 59
90 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1) 60 data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);
91 signal_processor(smp_processor_id(), sigp_stop);
92
93 /* Wait for all other cpus to enter stopped state */
94 for_each_online_cpu(cpu) {
95 if (cpu == smp_processor_id())
96 continue;
97 while (!smp_cpu_not_running(cpu))
98 cpu_relax();
99 }
100
101 image = (struct kimage *) kernel_image;
102 data_mover = (relocate_kernel_t)
103 (page_to_pfn(image->control_code_page) << PAGE_SHIFT);
104 61
105 /* Call the moving routine */ 62 /* Call the moving routine */
106 (*data_mover) (&image->head, image->start); 63 (*data_mover)(&image->head, image->start);
64 for (;;);
107} 65}