xref: /openbmc/linux/arch/s390/include/asm/smp.h (revision d2168146)
1 /*
2  *    Copyright IBM Corp. 1999, 2012
3  *    Author(s): Denis Joseph Barrow,
4  *		 Martin Schwidefsky <schwidefsky@de.ibm.com>,
5  *		 Heiko Carstens <heiko.carstens@de.ibm.com>,
6  */
7 #ifndef __ASM_SMP_H
8 #define __ASM_SMP_H
9 
10 #include <asm/sigp.h>
11 
12 #ifdef CONFIG_SMP
13 
14 #include <asm/lowcore.h>
15 
16 #define raw_smp_processor_id()	(S390_lowcore.cpu_nr)
17 
18 extern struct mutex smp_cpu_state_mutex;
19 
20 extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
21 
22 extern void arch_send_call_function_single_ipi(int cpu);
23 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
24 
25 extern void smp_call_online_cpu(void (*func)(void *), void *);
26 extern void smp_call_ipl_cpu(void (*func)(void *), void *);
27 
28 extern int smp_find_processor_id(u16 address);
29 extern int smp_store_status(int cpu);
30 extern int smp_vcpu_scheduled(int cpu);
31 extern void smp_yield_cpu(int cpu);
32 extern void smp_yield(void);
33 extern void smp_cpu_set_polarization(int cpu, int val);
34 extern int smp_cpu_get_polarization(int cpu);
35 extern void smp_fill_possible_mask(void);
36 
37 #else /* CONFIG_SMP */
38 
39 static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
40 {
41 	func(data);
42 }
43 
44 static inline void smp_call_online_cpu(void (*func)(void *), void *data)
45 {
46 	func(data);
47 }
48 
49 static inline int smp_find_processor_id(u16 address) { return 0; }
50 static inline int smp_store_status(int cpu) { return 0; }
51 static inline int smp_vcpu_scheduled(int cpu) { return 1; }
52 static inline void smp_yield_cpu(int cpu) { }
53 static inline void smp_yield(void) { }
54 static inline void smp_fill_possible_mask(void) { }
55 
56 #endif /* CONFIG_SMP */
57 
58 static inline void smp_stop_cpu(void)
59 {
60 	u16 pcpu = stap();
61 
62 	for (;;) {
63 		__pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
64 		cpu_relax();
65 	}
66 }
67 
68 #ifdef CONFIG_HOTPLUG_CPU
69 extern int smp_rescan_cpus(void);
70 extern void __noreturn cpu_die(void);
71 extern void __cpu_die(unsigned int cpu);
72 extern int __cpu_disable(void);
73 #else
74 static inline int smp_rescan_cpus(void) { return 0; }
75 static inline void cpu_die(void) { }
76 #endif
77 
78 #endif /* __ASM_SMP_H */
79