These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / s390 / include / asm / smp.h
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 extern unsigned int smp_cpu_mt_shift;
20 extern unsigned int smp_cpu_mtid;
21
22 extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
23
24 extern void arch_send_call_function_single_ipi(int cpu);
25 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
26
27 extern void smp_call_online_cpu(void (*func)(void *), void *);
28 extern void smp_call_ipl_cpu(void (*func)(void *), void *);
29
30 extern int smp_find_processor_id(u16 address);
31 extern int smp_store_status(int cpu);
32 extern void smp_save_dump_cpus(void);
33 extern int smp_vcpu_scheduled(int cpu);
34 extern void smp_yield_cpu(int cpu);
35 extern void smp_cpu_set_polarization(int cpu, int val);
36 extern int smp_cpu_get_polarization(int cpu);
37 extern void smp_fill_possible_mask(void);
38
39 #else /* CONFIG_SMP */
40
41 #define smp_cpu_mtid    0
42
43 static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
44 {
45         func(data);
46 }
47
48 static inline void smp_call_online_cpu(void (*func)(void *), void *data)
49 {
50         func(data);
51 }
52
53 static inline int smp_find_processor_id(u16 address) { return 0; }
54 static inline int smp_store_status(int cpu) { return 0; }
55 static inline int smp_vcpu_scheduled(int cpu) { return 1; }
56 static inline void smp_yield_cpu(int cpu) { }
57 static inline void smp_fill_possible_mask(void) { }
58 static inline void smp_save_dump_cpus(void) { }
59
60 #endif /* CONFIG_SMP */
61
62 static inline void smp_stop_cpu(void)
63 {
64         u16 pcpu = stap();
65
66         for (;;) {
67                 __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
68                 cpu_relax();
69         }
70 }
71
72 #ifdef CONFIG_HOTPLUG_CPU
73 extern int smp_rescan_cpus(void);
74 extern void __noreturn cpu_die(void);
75 extern void __cpu_die(unsigned int cpu);
76 extern int __cpu_disable(void);
77 #else
78 static inline int smp_rescan_cpus(void) { return 0; }
79 static inline void cpu_die(void) { }
80 #endif
81
82 #endif /* __ASM_SMP_H */