diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2006-12-04 09:40:33 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-12-04 09:40:33 -0500 |
commit | c6b5b847a7cf11f131c43fe0041443ec11697fc7 (patch) | |
tree | d15fb7302bd446394ab373128be0a77826566e30 /arch/s390/kernel/machine_kexec.c | |
parent | 740b5706b9c4b3767f597b3ea76654c6f2a800b2 (diff) |
[S390] cpu shutdown rework
Let one master cpu kill all other cpus instead of sending an external
interrupt to all other cpus so they can kill themselves.
Simplifies reipl/shutdown functions a lot.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/machine_kexec.c')
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c index 202bf1fdfe39..def5caf8f72f 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> |
@@ -24,81 +19,53 @@ | |||
24 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
25 | #include <asm/reset.h> | 20 | #include <asm/reset.h> |
26 | 21 | ||
27 | static void kexec_halt_all_cpus(void *); | 22 | typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long); |
28 | |||
29 | typedef void (*relocate_kernel_t) (kimage_entry_t *, unsigned long); | ||
30 | 23 | ||
31 | extern const unsigned char relocate_kernel[]; | 24 | extern const unsigned char relocate_kernel[]; |
32 | extern const unsigned long long relocate_kernel_len; | 25 | extern const unsigned long long relocate_kernel_len; |
33 | 26 | ||
34 | int | 27 | int machine_kexec_prepare(struct kimage *image) |
35 | machine_kexec_prepare(struct kimage *image) | ||
36 | { | 28 | { |
37 | unsigned long reboot_code_buffer; | 29 | void *reboot_code_buffer; |
38 | 30 | ||
39 | /* 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. */ |
40 | if (image->type != KEXEC_TYPE_DEFAULT) | 32 | if (image->type != KEXEC_TYPE_DEFAULT) |
41 | return -EINVAL; | 33 | return -EINVAL; |
42 | 34 | ||
43 | /* Get the destination where the assembler code should be copied to.*/ | 35 | /* Get the destination where the assembler code should be copied to.*/ |
44 | reboot_code_buffer = page_to_pfn(image->control_code_page)<<PAGE_SHIFT; | 36 | reboot_code_buffer = (void *) page_to_phys(image->control_code_page); |
45 | 37 | ||
46 | /* Then copy it */ | 38 | /* Then copy it */ |
47 | memcpy((void *) reboot_code_buffer, relocate_kernel, | 39 | memcpy(reboot_code_buffer, relocate_kernel, relocate_kernel_len); |
48 | relocate_kernel_len); | ||
49 | return 0; | 40 | return 0; |
50 | } | 41 | } |
51 | 42 | ||
52 | void | 43 | void machine_kexec_cleanup(struct kimage *image) |
53 | machine_kexec_cleanup(struct kimage *image) | ||
54 | { | 44 | { |
55 | } | 45 | } |
56 | 46 | ||
57 | void | 47 | void machine_shutdown(void) |
58 | machine_shutdown(void) | ||
59 | { | 48 | { |
60 | printk(KERN_INFO "kexec: machine_shutdown called\n"); | 49 | printk(KERN_INFO "kexec: machine_shutdown called\n"); |
61 | } | 50 | } |
62 | 51 | ||
63 | NORET_TYPE void | ||
64 | machine_kexec(struct kimage *image) | ||
65 | { | ||
66 | on_each_cpu(kexec_halt_all_cpus, image, 0, 0); | ||
67 | for (;;); | ||
68 | } | ||
69 | |||
70 | extern void pfault_fini(void); | 52 | extern void pfault_fini(void); |
71 | 53 | ||
72 | static void | 54 | void machine_kexec(struct kimage *image) |
73 | kexec_halt_all_cpus(void *kernel_image) | ||
74 | { | 55 | { |
75 | static atomic_t cpuid = ATOMIC_INIT(-1); | ||
76 | int cpu; | ||
77 | struct kimage *image; | ||
78 | relocate_kernel_t data_mover; | 56 | relocate_kernel_t data_mover; |
79 | 57 | ||
58 | preempt_disable(); | ||
80 | #ifdef CONFIG_PFAULT | 59 | #ifdef CONFIG_PFAULT |
81 | if (MACHINE_IS_VM) | 60 | if (MACHINE_IS_VM) |
82 | pfault_fini(); | 61 | pfault_fini(); |
83 | #endif | 62 | #endif |
84 | 63 | smp_send_stop(); | |
85 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1) | ||
86 | signal_processor(smp_processor_id(), sigp_stop); | ||
87 | |||
88 | /* Wait for all other cpus to enter stopped state */ | ||
89 | for_each_online_cpu(cpu) { | ||
90 | if (cpu == smp_processor_id()) | ||
91 | continue; | ||
92 | while (!smp_cpu_not_running(cpu)) | ||
93 | cpu_relax(); | ||
94 | } | ||
95 | |||
96 | s390_reset_system(); | 64 | s390_reset_system(); |
97 | 65 | ||
98 | image = (struct kimage *) kernel_image; | 66 | data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page); |
99 | data_mover = (relocate_kernel_t) | ||
100 | (page_to_pfn(image->control_code_page) << PAGE_SHIFT); | ||
101 | 67 | ||
102 | /* Call the moving routine */ | 68 | /* Call the moving routine */ |
103 | (*data_mover) (&image->head, image->start); | 69 | (*data_mover)(&image->head, image->start); |
70 | for (;;); | ||
104 | } | 71 | } |