diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2005-06-25 17:58:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:51 -0400 |
commit | cf13f0eaffa31bf6a145c53c589654b11c72ddc7 (patch) | |
tree | 55c11d753422398b060ea9571698285b5fdc603b /arch/s390/kernel/machine_kexec.c | |
parent | fce0d5740322b98b863f9e609f5a9bd4c06703af (diff) |
[PATCH] kexec: s390 support
Add kexec support for s390 architecture.
From: Milton Miller <miltonm@bga.com>
- Fix passing of first argument to relocate_kernel assembly.
- Fix Kconfig description.
- Remove wrong comment and comments that describe obvious things.
- Allow only KEXEC_TYPE_DEFAULT as image type -> dump not supported.
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/s390/kernel/machine_kexec.c')
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c new file mode 100644 index 000000000000..7a94db76df46 --- /dev/null +++ b/arch/s390/kernel/machine_kexec.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * arch/s390/kernel/machine_kexec.c | ||
3 | * | ||
4 | * (C) Copyright IBM Corp. 2005 | ||
5 | * | ||
6 | * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * s390_machine_kexec.c - handle the transition of Linux booting another kernel | ||
12 | * on the S390 architecture. | ||
13 | */ | ||
14 | |||
15 | #include <asm/cio.h> | ||
16 | #include <asm/setup.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/mm.h> | ||
19 | #include <linux/kexec.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <asm/pgtable.h> | ||
22 | #include <asm/pgalloc.h> | ||
23 | #include <asm/system.h> | ||
24 | |||
25 | static void kexec_halt_all_cpus(void *); | ||
26 | |||
27 | typedef void (*relocate_kernel_t) (kimage_entry_t *, unsigned long); | ||
28 | |||
29 | const extern unsigned char relocate_kernel[]; | ||
30 | const extern unsigned long long relocate_kernel_len; | ||
31 | |||
32 | int | ||
33 | machine_kexec_prepare(struct kimage *image) | ||
34 | { | ||
35 | unsigned long reboot_code_buffer; | ||
36 | |||
37 | /* We don't support anything but the default image type for now. */ | ||
38 | if (image->type != KEXEC_TYPE_DEFAULT) | ||
39 | return -EINVAL; | ||
40 | |||
41 | /* Get the destination where the assembler code should be copied to.*/ | ||
42 | reboot_code_buffer = page_to_pfn(image->control_code_page)<<PAGE_SHIFT; | ||
43 | |||
44 | /* Then copy it */ | ||
45 | memcpy((void *) reboot_code_buffer, relocate_kernel, | ||
46 | relocate_kernel_len); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | void | ||
51 | machine_kexec_cleanup(struct kimage *image) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | void | ||
56 | machine_shutdown(void) | ||
57 | { | ||
58 | printk(KERN_INFO "kexec: machine_shutdown called\n"); | ||
59 | } | ||
60 | |||
61 | NORET_TYPE void | ||
62 | machine_kexec(struct kimage *image) | ||
63 | { | ||
64 | clear_all_subchannels(); | ||
65 | |||
66 | /* Disable lowcore protection */ | ||
67 | ctl_clear_bit(0,28); | ||
68 | |||
69 | on_each_cpu(kexec_halt_all_cpus, image, 0, 0); | ||
70 | for(;;); | ||
71 | } | ||
72 | |||
73 | static void | ||
74 | kexec_halt_all_cpus(void *kernel_image) | ||
75 | { | ||
76 | static atomic_t cpuid = ATOMIC_INIT(-1); | ||
77 | int cpu; | ||
78 | struct kimage *image; | ||
79 | relocate_kernel_t data_mover; | ||
80 | |||
81 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) | ||
82 | signal_processor(smp_processor_id(), sigp_stop); | ||
83 | |||
84 | /* Wait for all other cpus to enter stopped state */ | ||
85 | for_each_online_cpu(cpu) { | ||
86 | if (cpu == smp_processor_id()) | ||
87 | continue; | ||
88 | while(!smp_cpu_not_running(cpu)) | ||
89 | cpu_relax(); | ||
90 | } | ||
91 | |||
92 | image = (struct kimage *) kernel_image; | ||
93 | data_mover = (relocate_kernel_t) | ||
94 | (page_to_pfn(image->control_code_page) << PAGE_SHIFT); | ||
95 | |||
96 | /* Call the moving routine */ | ||
97 | (*data_mover) (&image->head, image->start); | ||
98 | } | ||