diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-03-11 11:59:26 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-03-11 11:59:28 -0400 |
commit | 8b646bd759086f6090fe27acf414c0b5faa737f4 (patch) | |
tree | 29475659031c57ccf2ca43899614ab5c6b1899a0 /arch/s390/include/asm/smp.h | |
parent | 7e180bd8020d213bb0de15c3606968f8a9262439 (diff) |
[S390] rework smp code
Define struct pcpu and merge some of the NR_CPUS arrays into it, including
__cpu_logical_map, current_set and smp_cpu_state. Split smp related
functions to those operating on physical cpus and the functions operating
on a logical cpu number. Make the functions for physical cpus use a
pointer to a struct pcpu. This hides the knowledge about cpu addresses in
smp.c, entry[64].S and swsusp_asm64.S, thus remove the sigp.h header.
The PSW restart mechanism is used to start secondary cpus, calling a
function on an online cpu, calling a function on the ipl cpu, and for
the nmi signal. Replace the different assembler functions with a
single function restart_int_handler. The new entry point calls a function
whose pointer is stored in the lowcore of the target cpu and it can wait
for the source cpu to stop. This covers all existing use cases.
Overall the code is now simpler and there are ~380 lines less code.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/smp.h')
-rw-r--r-- | arch/s390/include/asm/smp.h | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index c32e9123b40c..797f78729680 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 1999,2009 | 2 | * Copyright IBM Corp. 1999,2012 |
3 | * Author(s): Denis Joseph Barrow, | 3 | * Author(s): Denis Joseph Barrow, |
4 | * Martin Schwidefsky <schwidefsky@de.ibm.com>, | 4 | * Martin Schwidefsky <schwidefsky@de.ibm.com>, |
5 | * Heiko Carstens <heiko.carstens@de.ibm.com>, | 5 | * Heiko Carstens <heiko.carstens@de.ibm.com>, |
@@ -10,71 +10,52 @@ | |||
10 | #ifdef CONFIG_SMP | 10 | #ifdef CONFIG_SMP |
11 | 11 | ||
12 | #include <asm/system.h> | 12 | #include <asm/system.h> |
13 | #include <asm/sigp.h> | ||
14 | |||
15 | extern void machine_restart_smp(char *); | ||
16 | extern void machine_halt_smp(void); | ||
17 | extern void machine_power_off_smp(void); | ||
18 | 13 | ||
19 | #define raw_smp_processor_id() (S390_lowcore.cpu_nr) | 14 | #define raw_smp_processor_id() (S390_lowcore.cpu_nr) |
20 | 15 | ||
21 | extern int __cpu_disable (void); | ||
22 | extern void __cpu_die (unsigned int cpu); | ||
23 | extern int __cpu_up (unsigned int cpu); | ||
24 | |||
25 | extern struct mutex smp_cpu_state_mutex; | 16 | extern struct mutex smp_cpu_state_mutex; |
17 | extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; | ||
18 | |||
19 | extern int __cpu_up(unsigned int cpu); | ||
26 | 20 | ||
27 | extern void arch_send_call_function_single_ipi(int cpu); | 21 | extern void arch_send_call_function_single_ipi(int cpu); |
28 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 22 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
29 | 23 | ||
30 | extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; | 24 | extern void smp_call_online_cpu(void (*func)(void *), void *); |
31 | 25 | extern void smp_call_ipl_cpu(void (*func)(void *), void *); | |
32 | extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *); | ||
33 | extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp, | ||
34 | int from, int to); | ||
35 | extern void smp_restart_with_online_cpu(void); | ||
36 | extern void smp_restart_cpu(void); | ||
37 | 26 | ||
38 | /* | 27 | extern int smp_find_processor_id(u16 address); |
39 | * returns 1 if (virtual) cpu is scheduled | 28 | extern int smp_store_status(int cpu); |
40 | * returns 0 otherwise | 29 | extern int smp_vcpu_scheduled(int cpu); |
41 | */ | 30 | extern void smp_yield_cpu(int cpu); |
42 | static inline int smp_vcpu_scheduled(int cpu) | 31 | extern void smp_yield(void); |
43 | { | 32 | extern void smp_stop_cpu(void); |
44 | u32 status; | ||
45 | |||
46 | switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) { | ||
47 | case sigp_status_stored: | ||
48 | /* Check for running status */ | ||
49 | if (status & 0x400) | ||
50 | return 0; | ||
51 | break; | ||
52 | case sigp_not_operational: | ||
53 | return 0; | ||
54 | default: | ||
55 | break; | ||
56 | } | ||
57 | return 1; | ||
58 | } | ||
59 | 33 | ||
60 | #else /* CONFIG_SMP */ | 34 | #else /* CONFIG_SMP */ |
61 | 35 | ||
62 | static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data) | 36 | static inline void smp_call_ipl_cpu(void (*func)(void *), void *data) |
63 | { | 37 | { |
64 | func(data); | 38 | func(data); |
65 | } | 39 | } |
66 | 40 | ||
67 | static inline void smp_restart_with_online_cpu(void) | 41 | static inline void smp_call_online_cpu(void (*func)(void *), void *data) |
68 | { | 42 | { |
43 | func(data); | ||
69 | } | 44 | } |
70 | 45 | ||
71 | #define smp_vcpu_scheduled (1) | 46 | static inline int smp_find_processor_id(int address) { return 0; } |
47 | static inline int smp_vcpu_scheduled(int cpu) { return 1; } | ||
48 | static inline void smp_yield_cpu(int cpu) { } | ||
49 | static inline void smp_yield(void) { } | ||
50 | static inline void smp_stop_cpu(void) { } | ||
72 | 51 | ||
73 | #endif /* CONFIG_SMP */ | 52 | #endif /* CONFIG_SMP */ |
74 | 53 | ||
75 | #ifdef CONFIG_HOTPLUG_CPU | 54 | #ifdef CONFIG_HOTPLUG_CPU |
76 | extern int smp_rescan_cpus(void); | 55 | extern int smp_rescan_cpus(void); |
77 | extern void __noreturn cpu_die(void); | 56 | extern void __noreturn cpu_die(void); |
57 | extern void __cpu_die(unsigned int cpu); | ||
58 | extern int __cpu_disable(void); | ||
78 | #else | 59 | #else |
79 | static inline int smp_rescan_cpus(void) { return 0; } | 60 | static inline int smp_rescan_cpus(void) { return 0; } |
80 | static inline void cpu_die(void) { } | 61 | static inline void cpu_die(void) { } |