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