blob: a91f21e3c5b598ff97b9f7c81d6e1e1d9365ab70 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Russell King4baa9922008-08-02 10:55:55 +01003 * arch/arm/include/asm/smp.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Copyright (C) 2004-2005 ARM Ltd.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7#ifndef __ASM_ARM_SMP_H
8#define __ASM_ARM_SMP_H
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/threads.h>
11#include <linux/cpumask.h>
12#include <linux/thread_info.h>
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#ifndef CONFIG_SMP
Russell King4baa9922008-08-02 10:55:55 +010015# error "<asm/smp.h> included in non-SMP build"
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#endif
17
Ingo Molnar39c715b2005-06-21 17:14:34 -070018#define raw_smp_processor_id() (current_thread_info()->cpu)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Linus Torvalds1da177e2005-04-16 15:20:36 -070020struct seq_file;
21
22/*
23 * generate IPI list text
24 */
Russell Kingf13cd412010-11-15 14:33:51 +000025extern void show_ipi_list(struct seq_file *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27/*
Russell King3b6353f2005-11-08 15:35:23 +000028 * Called from assembly code, this handles an IPI.
29 */
Russell Kingad3b69932010-11-15 09:42:08 +000030asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
Russell King3b6353f2005-11-08 15:35:23 +000031
32/*
Shawn Guo0b5a1b952011-10-06 15:18:14 +010033 * Called from C code, this handles an IPI.
34 */
35void handle_IPI(int ipinr, struct pt_regs *regs);
36
37/*
Russell Kinge03cdad2009-05-28 14:16:52 +010038 * Setup the set of possible CPUs (via set_cpu_possible)
Russell King7bbb7942006-02-16 11:08:09 +000039 */
40extern void smp_init_cpus(void);
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
43/*
Russell King0f7b3322011-04-03 13:01:30 +010044 * Provide a function to raise an IPI cross call on CPUs in callmap.
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 */
Russell King0f7b3322011-04-03 13:01:30 +010046extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
Russell Kingdbebb4c2005-11-08 10:40:10 +000047
48/*
Russell King3b6353f2005-11-08 15:35:23 +000049 * Called from platform specific assembly code, this is the
50 * secondary CPU entry point.
51 */
52asmlinkage void secondary_start_kernel(void);
53
Russell King05c74a62010-12-03 11:09:48 +000054
55/*
Russell Kinge65f38e2005-06-18 09:33:31 +010056 * Initial data for bringing up a secondary CPU.
57 */
58struct secondary_data {
Jonathan Austineb083752013-02-22 18:51:30 +000059 union {
Vladimir Murzina0995c082017-10-16 12:54:05 +010060 struct mpu_rgn_info *mpu_rgn_info;
Russell Kingb2c3e382015-04-04 20:09:46 +010061 u64 pgdir;
Jonathan Austineb083752013-02-22 18:51:30 +000062 };
Catalin Marinasd4279582011-05-26 11:22:44 +010063 unsigned long swapper_pg_dir;
Russell Kinge65f38e2005-06-18 09:33:31 +010064 void *stack;
65};
66extern struct secondary_data secondary_data;
Arnd Bergmann1146b602014-03-16 18:04:54 +010067extern void secondary_startup(void);
Yingjoe Chen29d2e562015-05-18 09:06:13 +010068extern void secondary_startup_arm(void);
Russell Kinge65f38e2005-06-18 09:33:31 +010069
Russell Kinga054a812005-11-02 22:24:33 +000070extern int __cpu_disable(void);
Russell Kinga054a812005-11-02 22:24:33 +000071
72extern void __cpu_die(unsigned int cpu);
Russell Kinga054a812005-11-02 22:24:33 +000073
Jens Axboef6dd9fa2008-06-10 20:48:30 +020074extern void arch_send_call_function_single_ipi(int cpu);
Russell King82668102009-05-17 16:20:18 +010075extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
Shawn Guob62655f2012-11-06 03:48:40 +010076extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
Jens Axboef6dd9fa2008-06-10 20:48:30 +020077
Nicolas Pitre5135d872012-11-27 21:54:41 -050078extern int register_ipi_completion(struct completion *completion, int cpu);
79
Marc Zyngierabcee5f2011-09-08 09:06:10 +010080struct smp_operations {
81#ifdef CONFIG_SMP
82 /*
83 * Setup the set of possible CPUs (via set_cpu_possible)
84 */
85 void (*smp_init_cpus)(void);
86 /*
87 * Initialize cpu_possible map, and enable coherency
88 */
89 void (*smp_prepare_cpus)(unsigned int max_cpus);
90
91 /*
92 * Perform platform specific initialisation of the specified CPU.
93 */
94 void (*smp_secondary_init)(unsigned int cpu);
95 /*
96 * Boot a secondary CPU, and assign it the specified idle task.
97 * This also gives us the initial stack to use for this CPU.
98 */
99 int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
100#ifdef CONFIG_HOTPLUG_CPU
101 int (*cpu_kill)(unsigned int cpu);
102 void (*cpu_die)(unsigned int cpu);
Stephen Boyd787047e2015-07-29 00:34:48 +0100103 bool (*cpu_can_disable)(unsigned int cpu);
Marc Zyngierabcee5f2011-09-08 09:06:10 +0100104 int (*cpu_disable)(unsigned int cpu);
105#endif
106#endif
107};
108
Stephen Boyd6c3ff8b2013-10-30 18:21:09 -0700109struct of_cpu_method {
110 const char *method;
Masahiro Yamadaf460b6a2015-08-26 07:49:12 +0100111 const struct smp_operations *ops;
Stephen Boyd6c3ff8b2013-10-30 18:21:09 -0700112};
113
114#define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
115 static const struct of_cpu_method __cpu_method_of_table_##name \
116 __used __section(__cpu_method_of_table) \
117 = { .method = _method, .ops = _ops }
Marc Zyngierabcee5f2011-09-08 09:06:10 +0100118/*
119 * set platform specific SMP operations
120 */
Masahiro Yamada4caa9dd2015-08-26 07:49:11 +0100121extern void smp_set_ops(const struct smp_operations *);
Marc Zyngierabcee5f2011-09-08 09:06:10 +0100122
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123#endif /* ifndef __ASM_ARM_SMP_H */