Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 2 | * Copyright IBM Corp. 1999, 2012 |
Heiko Carstens | c20c89a | 2009-12-07 12:52:07 +0100 | [diff] [blame] | 3 | * Author(s): Denis Joseph Barrow, |
| 4 | * Martin Schwidefsky <schwidefsky@de.ibm.com>, |
| 5 | * Heiko Carstens <heiko.carstens@de.ibm.com>, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | #ifndef __ASM_SMP_H |
| 8 | #define __ASM_SMP_H |
| 9 | |
Heiko Carstens | e7c46c6 | 2014-04-04 11:23:03 +0200 | [diff] [blame] | 10 | #include <asm/sigp.h> |
| 11 | |
Heiko Carstens | c20c89a | 2009-12-07 12:52:07 +0100 | [diff] [blame] | 12 | #ifdef CONFIG_SMP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
David Howells | a0616cd | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 14 | #include <asm/lowcore.h> |
Heiko Carstens | 2b67fc4 | 2007-02-05 21:16:47 +0100 | [diff] [blame] | 15 | |
Martin Schwidefsky | 7b46848 | 2009-03-26 15:24:42 +0100 | [diff] [blame] | 16 | #define raw_smp_processor_id() (S390_lowcore.cpu_nr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Heiko Carstens | dbd70fb | 2008-04-17 07:46:12 +0200 | [diff] [blame] | 18 | extern struct mutex smp_cpu_state_mutex; |
Martin Schwidefsky | 10ad34b | 2015-01-14 17:52:10 +0100 | [diff] [blame] | 19 | extern unsigned int smp_cpu_mt_shift; |
| 20 | extern unsigned int smp_cpu_mtid; |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 21 | |
Thomas Gleixner | 8239c25 | 2012-04-20 13:05:42 +0000 | [diff] [blame] | 22 | extern int __cpu_up(unsigned int cpu, struct task_struct *tidle); |
Heiko Carstens | dbd70fb | 2008-04-17 07:46:12 +0200 | [diff] [blame] | 23 | |
Heiko Carstens | ca9fc75 | 2008-12-25 13:38:39 +0100 | [diff] [blame] | 24 | extern void arch_send_call_function_single_ipi(int cpu); |
Rusty Russell | 630cd04 | 2009-09-24 09:34:45 -0600 | [diff] [blame] | 25 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
Heiko Carstens | ca9fc75 | 2008-12-25 13:38:39 +0100 | [diff] [blame] | 26 | |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 27 | extern void smp_call_online_cpu(void (*func)(void *), void *); |
| 28 | extern void smp_call_ipl_cpu(void (*func)(void *), void *); |
Heiko Carstens | c20c89a | 2009-12-07 12:52:07 +0100 | [diff] [blame] | 29 | |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 30 | extern int smp_find_processor_id(u16 address); |
| 31 | extern int smp_store_status(int cpu); |
Michael Holzheu | 1592a8e | 2015-05-26 19:05:23 +0200 | [diff] [blame] | 32 | extern void smp_save_dump_cpus(void); |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 33 | extern int smp_vcpu_scheduled(int cpu); |
| 34 | extern void smp_yield_cpu(int cpu); |
Heiko Carstens | 50ab9a9 | 2012-09-04 17:36:16 +0200 | [diff] [blame] | 35 | extern void smp_cpu_set_polarization(int cpu, int val); |
| 36 | extern int smp_cpu_get_polarization(int cpu); |
Heiko Carstens | d80512f | 2013-12-16 14:31:26 +0100 | [diff] [blame] | 37 | extern void smp_fill_possible_mask(void); |
Gerald Schaefer | 59b6978 | 2010-02-26 22:37:40 +0100 | [diff] [blame] | 38 | |
Heiko Carstens | 2c2df11 | 2010-02-26 22:37:34 +0100 | [diff] [blame] | 39 | #else /* CONFIG_SMP */ |
| 40 | |
Martin Schwidefsky | 10ad34b | 2015-01-14 17:52:10 +0100 | [diff] [blame] | 41 | #define smp_cpu_mtid 0 |
| 42 | |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 43 | static inline void smp_call_ipl_cpu(void (*func)(void *), void *data) |
Heiko Carstens | 2c2df11 | 2010-02-26 22:37:34 +0100 | [diff] [blame] | 44 | { |
| 45 | func(data); |
| 46 | } |
| 47 | |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 48 | static inline void smp_call_online_cpu(void (*func)(void *), void *data) |
Michael Holzheu | 1943f53 | 2011-10-30 15:16:38 +0100 | [diff] [blame] | 49 | { |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 50 | func(data); |
Michael Holzheu | 1943f53 | 2011-10-30 15:16:38 +0100 | [diff] [blame] | 51 | } |
| 52 | |
Heiko Carstens | 0d0e471 | 2012-08-27 15:38:19 +0200 | [diff] [blame] | 53 | static inline int smp_find_processor_id(u16 address) { return 0; } |
Heiko Carstens | 29a877f | 2012-08-27 15:18:45 +0200 | [diff] [blame] | 54 | static inline int smp_store_status(int cpu) { return 0; } |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 55 | static inline int smp_vcpu_scheduled(int cpu) { return 1; } |
| 56 | static inline void smp_yield_cpu(int cpu) { } |
Heiko Carstens | d80512f | 2013-12-16 14:31:26 +0100 | [diff] [blame] | 57 | static inline void smp_fill_possible_mask(void) { } |
Heiko Carstens | 1af135a | 2015-06-26 12:10:49 +0200 | [diff] [blame] | 58 | static inline void smp_save_dump_cpus(void) { } |
Gerald Schaefer | 59b6978 | 2010-02-26 22:37:40 +0100 | [diff] [blame] | 59 | |
Michael Holzheu | f4192bf | 2014-04-15 11:25:28 +0200 | [diff] [blame] | 60 | #endif /* CONFIG_SMP */ |
| 61 | |
Heiko Carstens | e7c46c6 | 2014-04-04 11:23:03 +0200 | [diff] [blame] | 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 | |
Heiko Carstens | 1e48951 | 2008-04-30 13:38:37 +0200 | [diff] [blame] | 72 | #ifdef CONFIG_HOTPLUG_CPU |
| 73 | extern int smp_rescan_cpus(void); |
Heiko Carstens | da7f51c | 2011-01-05 12:48:09 +0100 | [diff] [blame] | 74 | extern void __noreturn cpu_die(void); |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 75 | extern void __cpu_die(unsigned int cpu); |
| 76 | extern int __cpu_disable(void); |
Heiko Carstens | 1e48951 | 2008-04-30 13:38:37 +0200 | [diff] [blame] | 77 | #else |
| 78 | static inline int smp_rescan_cpus(void) { return 0; } |
Heiko Carstens | da7f51c | 2011-01-05 12:48:09 +0100 | [diff] [blame] | 79 | static inline void cpu_die(void) { } |
Heiko Carstens | 1e48951 | 2008-04-30 13:38:37 +0200 | [diff] [blame] | 80 | #endif |
| 81 | |
Heiko Carstens | c20c89a | 2009-12-07 12:52:07 +0100 | [diff] [blame] | 82 | #endif /* __ASM_SMP_H */ |