smp.h 2.1 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
2
 *    Copyright IBM Corp. 1999, 2012
3 4 5
 *    Author(s): Denis Joseph Barrow,
 *		 Martin Schwidefsky <schwidefsky@de.ibm.com>,
 *		 Heiko Carstens <heiko.carstens@de.ibm.com>,
L
Linus Torvalds 已提交
6 7 8 9
 */
#ifndef __ASM_SMP_H
#define __ASM_SMP_H

10 11
#include <asm/sigp.h>

12
#ifdef CONFIG_SMP
L
Linus Torvalds 已提交
13

14
#include <asm/lowcore.h>
15

16
#define raw_smp_processor_id()	(S390_lowcore.cpu_nr)
L
Linus Torvalds 已提交
17

18
extern struct mutex smp_cpu_state_mutex;
M
Martin Schwidefsky 已提交
19 20
extern unsigned int smp_cpu_mt_shift;
extern unsigned int smp_cpu_mtid;
21
extern __vector128 __initdata boot_cpu_vector_save_area[__NUM_VXRS];
M
Martin Schwidefsky 已提交
22

23
extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
24

25
extern void arch_send_call_function_single_ipi(int cpu);
26
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
27

M
Martin Schwidefsky 已提交
28 29
extern void smp_call_online_cpu(void (*func)(void *), void *);
extern void smp_call_ipl_cpu(void (*func)(void *), void *);
30

M
Martin Schwidefsky 已提交
31 32
extern int smp_find_processor_id(u16 address);
extern int smp_store_status(int cpu);
33
extern void smp_save_dump_cpus(void);
M
Martin Schwidefsky 已提交
34 35
extern int smp_vcpu_scheduled(int cpu);
extern void smp_yield_cpu(int cpu);
36 37
extern void smp_cpu_set_polarization(int cpu, int val);
extern int smp_cpu_get_polarization(int cpu);
38
extern void smp_fill_possible_mask(void);
39

40 41
#else /* CONFIG_SMP */

M
Martin Schwidefsky 已提交
42 43
#define smp_cpu_mtid	0

M
Martin Schwidefsky 已提交
44
static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
45 46 47 48
{
	func(data);
}

M
Martin Schwidefsky 已提交
49
static inline void smp_call_online_cpu(void (*func)(void *), void *data)
50
{
M
Martin Schwidefsky 已提交
51
	func(data);
52 53
}

54
static inline int smp_find_processor_id(u16 address) { return 0; }
55
static inline int smp_store_status(int cpu) { return 0; }
M
Martin Schwidefsky 已提交
56 57
static inline int smp_vcpu_scheduled(int cpu) { return 1; }
static inline void smp_yield_cpu(int cpu) { }
58
static inline void smp_fill_possible_mask(void) { }
59

60 61
#endif /* CONFIG_SMP */

62 63 64 65 66 67 68 69 70 71
static inline void smp_stop_cpu(void)
{
	u16 pcpu = stap();

	for (;;) {
		__pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
		cpu_relax();
	}
}

72 73
#ifdef CONFIG_HOTPLUG_CPU
extern int smp_rescan_cpus(void);
74
extern void __noreturn cpu_die(void);
M
Martin Schwidefsky 已提交
75 76
extern void __cpu_die(unsigned int cpu);
extern int __cpu_disable(void);
77 78
#else
static inline int smp_rescan_cpus(void) { return 0; }
79
static inline void cpu_die(void) { }
80 81
#endif

82
#endif /* __ASM_SMP_H */