Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 ARM Ltd. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | #ifndef __ASM_SMP_H |
| 17 | #define __ASM_SMP_H |
| 18 | |
| 19 | #include <linux/threads.h> |
| 20 | #include <linux/cpumask.h> |
| 21 | #include <linux/thread_info.h> |
| 22 | |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 23 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
| 24 | |
| 25 | struct seq_file; |
| 26 | |
| 27 | /* |
| 28 | * generate IPI list text |
| 29 | */ |
| 30 | extern void show_ipi_list(struct seq_file *p, int prec); |
| 31 | |
| 32 | /* |
| 33 | * Called from C code, this handles an IPI. |
| 34 | */ |
| 35 | extern void handle_IPI(int ipinr, struct pt_regs *regs); |
| 36 | |
| 37 | /* |
Hanjun Guo | fccb9a8 | 2015-03-24 22:02:45 +0800 | [diff] [blame] | 38 | * Discover the set of possible CPUs and determine their |
| 39 | * SMP operations. |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 40 | */ |
Lorenzo Pieralisi | 0f07833 | 2015-05-13 14:12:47 +0100 | [diff] [blame] | 41 | extern void smp_init_cpus(void); |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 42 | |
| 43 | /* |
| 44 | * Provide a function to raise an IPI cross call on CPUs in callmap. |
| 45 | */ |
| 46 | extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); |
| 47 | |
Frederic Weisbecker | 3631073 | 2014-08-16 18:48:05 +0200 | [diff] [blame] | 48 | extern void (*__smp_cross_call)(const struct cpumask *, unsigned int); |
| 49 | |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 50 | /* |
| 51 | * Called from the secondary holding pen, this is the secondary CPU entry point. |
| 52 | */ |
| 53 | asmlinkage void secondary_start_kernel(void); |
| 54 | |
| 55 | /* |
| 56 | * Initial data for bringing up a secondary CPU. |
| 57 | */ |
| 58 | struct secondary_data { |
| 59 | void *stack; |
| 60 | }; |
| 61 | extern struct secondary_data secondary_data; |
Mark Rutland | 652af89 | 2013-10-24 20:30:16 +0100 | [diff] [blame] | 62 | extern void secondary_entry(void); |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 63 | |
| 64 | extern void arch_send_call_function_single_ipi(int cpu); |
| 65 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
| 66 | |
Lorenzo Pieralisi | 5e89c55 | 2016-01-26 11:10:38 +0000 | [diff] [blame] | 67 | #ifdef CONFIG_ARM64_ACPI_PARKING_PROTOCOL |
| 68 | extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask); |
| 69 | #else |
| 70 | static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) |
| 71 | { |
| 72 | BUILD_BUG(); |
| 73 | } |
| 74 | #endif |
| 75 | |
Mark Rutland | 9327e2c | 2013-10-24 20:30:18 +0100 | [diff] [blame] | 76 | extern int __cpu_disable(void); |
| 77 | |
| 78 | extern void __cpu_die(unsigned int cpu); |
| 79 | extern void cpu_die(void); |
Suzuki K Poulose | fce6361 | 2016-02-23 10:31:41 +0000 | [diff] [blame^] | 80 | extern void cpu_die_early(void); |
Mark Rutland | 9327e2c | 2013-10-24 20:30:18 +0100 | [diff] [blame] | 81 | |
Suzuki K Poulose | c4bc34d | 2016-02-23 10:31:39 +0000 | [diff] [blame] | 82 | static inline void cpu_park_loop(void) |
| 83 | { |
| 84 | for (;;) { |
| 85 | wfe(); |
| 86 | wfi(); |
| 87 | } |
| 88 | } |
| 89 | |
Catalin Marinas | 08e875c | 2012-03-05 11:49:30 +0000 | [diff] [blame] | 90 | #endif /* ifndef __ASM_SMP_H */ |