blob: ce26ac3cb162899a285e5812a39ea9b1b6ec0484 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02002 * Copyright IBM Corp. 1999, 2012
Heiko Carstensc20c89a2009-12-07 12:52:07 +01003 * Author(s): Denis Joseph Barrow,
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Heiko Carstens <heiko.carstens@de.ibm.com>,
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7#ifndef __ASM_SMP_H
8#define __ASM_SMP_H
9
Heiko Carstensc20c89a2009-12-07 12:52:07 +010010#ifdef CONFIG_SMP
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
David Howellsa0616cd2012-03-28 18:30:02 +010012#include <asm/lowcore.h>
Heiko Carstens2b67fc42007-02-05 21:16:47 +010013
Martin Schwidefsky7b468482009-03-26 15:24:42 +010014#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Heiko Carstensdbd70fb2008-04-17 07:46:12 +020016extern struct mutex smp_cpu_state_mutex;
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040017extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
18
Thomas Gleixner8239c252012-04-20 13:05:42 +000019extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
Heiko Carstensdbd70fb2008-04-17 07:46:12 +020020
Heiko Carstensca9fc752008-12-25 13:38:39 +010021extern void arch_send_call_function_single_ipi(int cpu);
Rusty Russell630cd042009-09-24 09:34:45 -060022extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
Heiko Carstensca9fc752008-12-25 13:38:39 +010023
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040024extern void smp_call_online_cpu(void (*func)(void *), void *);
25extern void smp_call_ipl_cpu(void (*func)(void *), void *);
Heiko Carstensc20c89a2009-12-07 12:52:07 +010026
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040027extern int smp_find_processor_id(u16 address);
28extern int smp_store_status(int cpu);
29extern int smp_vcpu_scheduled(int cpu);
30extern void smp_yield_cpu(int cpu);
31extern void smp_yield(void);
32extern void smp_stop_cpu(void);
Gerald Schaefer59b69782010-02-26 22:37:40 +010033
Heiko Carstens2c2df112010-02-26 22:37:34 +010034#else /* CONFIG_SMP */
35
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040036static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
Heiko Carstens2c2df112010-02-26 22:37:34 +010037{
38 func(data);
39}
40
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040041static inline void smp_call_online_cpu(void (*func)(void *), void *data)
Michael Holzheu1943f532011-10-30 15:16:38 +010042{
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040043 func(data);
Michael Holzheu1943f532011-10-30 15:16:38 +010044}
45
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040046static inline int smp_find_processor_id(int address) { return 0; }
Heiko Carstens29a877f2012-08-27 15:18:45 +020047static inline int smp_store_status(int cpu) { return 0; }
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040048static inline int smp_vcpu_scheduled(int cpu) { return 1; }
49static inline void smp_yield_cpu(int cpu) { }
50static inline void smp_yield(void) { }
51static inline void smp_stop_cpu(void) { }
Gerald Schaefer59b69782010-02-26 22:37:40 +010052
Heiko Carstensc20c89a2009-12-07 12:52:07 +010053#endif /* CONFIG_SMP */
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Heiko Carstens1e489512008-04-30 13:38:37 +020055#ifdef CONFIG_HOTPLUG_CPU
56extern int smp_rescan_cpus(void);
Heiko Carstensda7f51c2011-01-05 12:48:09 +010057extern void __noreturn cpu_die(void);
Martin Schwidefsky8b646bd2012-03-11 11:59:26 -040058extern void __cpu_die(unsigned int cpu);
59extern int __cpu_disable(void);
Heiko Carstens1e489512008-04-30 13:38:37 +020060#else
61static inline int smp_rescan_cpus(void) { return 0; }
Heiko Carstensda7f51c2011-01-05 12:48:09 +010062static inline void cpu_die(void) { }
Heiko Carstens1e489512008-04-30 13:38:37 +020063#endif
64
Heiko Carstensc20c89a2009-12-07 12:52:07 +010065#endif /* __ASM_SMP_H */