xref: /openbmc/linux/arch/arm/include/asm/smp.h (revision 29d2e5631ca25fc45d68373817cd3f2b5ee7d8d0)
14baa9922SRussell King /*
24baa9922SRussell King  *  arch/arm/include/asm/smp.h
34baa9922SRussell King  *
44baa9922SRussell King  *  Copyright (C) 2004-2005 ARM Ltd.
54baa9922SRussell King  *
64baa9922SRussell King  * This program is free software; you can redistribute it and/or modify
74baa9922SRussell King  * it under the terms of the GNU General Public License version 2 as
84baa9922SRussell King  * published by the Free Software Foundation.
94baa9922SRussell King  */
104baa9922SRussell King #ifndef __ASM_ARM_SMP_H
114baa9922SRussell King #define __ASM_ARM_SMP_H
124baa9922SRussell King 
134baa9922SRussell King #include <linux/threads.h>
144baa9922SRussell King #include <linux/cpumask.h>
154baa9922SRussell King #include <linux/thread_info.h>
164baa9922SRussell King 
174baa9922SRussell King #ifndef CONFIG_SMP
184baa9922SRussell King # error "<asm/smp.h> included in non-SMP build"
194baa9922SRussell King #endif
204baa9922SRussell King 
214baa9922SRussell King #define raw_smp_processor_id() (current_thread_info()->cpu)
224baa9922SRussell King 
234baa9922SRussell King struct seq_file;
244baa9922SRussell King 
254baa9922SRussell King /*
264baa9922SRussell King  * generate IPI list text
274baa9922SRussell King  */
28f13cd417SRussell King extern void show_ipi_list(struct seq_file *, int);
294baa9922SRussell King 
304baa9922SRussell King /*
314baa9922SRussell King  * Called from assembly code, this handles an IPI.
324baa9922SRussell King  */
33ad3b6993SRussell King asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
344baa9922SRussell King 
354baa9922SRussell King /*
360b5a1b95SShawn Guo  * Called from C code, this handles an IPI.
370b5a1b95SShawn Guo  */
380b5a1b95SShawn Guo void handle_IPI(int ipinr, struct pt_regs *regs);
390b5a1b95SShawn Guo 
400b5a1b95SShawn Guo /*
41e03cdadeSRussell King  * Setup the set of possible CPUs (via set_cpu_possible)
424baa9922SRussell King  */
434baa9922SRussell King extern void smp_init_cpus(void);
444baa9922SRussell King 
454baa9922SRussell King 
464baa9922SRussell King /*
470f7b332fSRussell King  * Provide a function to raise an IPI cross call on CPUs in callmap.
484baa9922SRussell King  */
490f7b332fSRussell King extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
504baa9922SRussell King 
514baa9922SRussell King /*
524baa9922SRussell King  * Called from platform specific assembly code, this is the
534baa9922SRussell King  * secondary CPU entry point.
544baa9922SRussell King  */
554baa9922SRussell King asmlinkage void secondary_start_kernel(void);
564baa9922SRussell King 
5705c74a6cSRussell King 
5805c74a6cSRussell King /*
594baa9922SRussell King  * Initial data for bringing up a secondary CPU.
604baa9922SRussell King  */
614baa9922SRussell King struct secondary_data {
62eb08375eSJonathan Austin 	union {
63eb08375eSJonathan Austin 		unsigned long mpu_rgn_szr;
644baa9922SRussell King 		unsigned long pgdir;
65eb08375eSJonathan Austin 	};
66d427958aSCatalin Marinas 	unsigned long swapper_pg_dir;
674baa9922SRussell King 	void *stack;
684baa9922SRussell King };
694baa9922SRussell King extern struct secondary_data secondary_data;
7028e8e29cSMarc Zyngier extern volatile int pen_release;
711146b600SArnd Bergmann extern void secondary_startup(void);
72*29d2e563SYingjoe Chen extern void secondary_startup_arm(void);
734baa9922SRussell King 
744baa9922SRussell King extern int __cpu_disable(void);
754baa9922SRussell King 
764baa9922SRussell King extern void __cpu_die(unsigned int cpu);
774baa9922SRussell King extern void cpu_die(void);
784baa9922SRussell King 
794baa9922SRussell King extern void arch_send_call_function_single_ipi(int cpu);
8082668104SRussell King extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
81b62655f4SShawn Guo extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
824baa9922SRussell King 
835135d875SNicolas Pitre extern int register_ipi_completion(struct completion *completion, int cpu);
845135d875SNicolas Pitre 
85abcee5fbSMarc Zyngier struct smp_operations {
86abcee5fbSMarc Zyngier #ifdef CONFIG_SMP
87abcee5fbSMarc Zyngier 	/*
88abcee5fbSMarc Zyngier 	 * Setup the set of possible CPUs (via set_cpu_possible)
89abcee5fbSMarc Zyngier 	 */
90abcee5fbSMarc Zyngier 	void (*smp_init_cpus)(void);
91abcee5fbSMarc Zyngier 	/*
92abcee5fbSMarc Zyngier 	 * Initialize cpu_possible map, and enable coherency
93abcee5fbSMarc Zyngier 	 */
94abcee5fbSMarc Zyngier 	void (*smp_prepare_cpus)(unsigned int max_cpus);
95abcee5fbSMarc Zyngier 
96abcee5fbSMarc Zyngier 	/*
97abcee5fbSMarc Zyngier 	 * Perform platform specific initialisation of the specified CPU.
98abcee5fbSMarc Zyngier 	 */
99abcee5fbSMarc Zyngier 	void (*smp_secondary_init)(unsigned int cpu);
100abcee5fbSMarc Zyngier 	/*
101abcee5fbSMarc Zyngier 	 * Boot a secondary CPU, and assign it the specified idle task.
102abcee5fbSMarc Zyngier 	 * This also gives us the initial stack to use for this CPU.
103abcee5fbSMarc Zyngier 	 */
104abcee5fbSMarc Zyngier 	int  (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
105abcee5fbSMarc Zyngier #ifdef CONFIG_HOTPLUG_CPU
106abcee5fbSMarc Zyngier 	int  (*cpu_kill)(unsigned int cpu);
107abcee5fbSMarc Zyngier 	void (*cpu_die)(unsigned int cpu);
108abcee5fbSMarc Zyngier 	int  (*cpu_disable)(unsigned int cpu);
109abcee5fbSMarc Zyngier #endif
110abcee5fbSMarc Zyngier #endif
111abcee5fbSMarc Zyngier };
112abcee5fbSMarc Zyngier 
1136c3ff8b1SStephen Boyd struct of_cpu_method {
1146c3ff8b1SStephen Boyd 	const char *method;
1156c3ff8b1SStephen Boyd 	struct smp_operations *ops;
1166c3ff8b1SStephen Boyd };
1176c3ff8b1SStephen Boyd 
1186c3ff8b1SStephen Boyd #define CPU_METHOD_OF_DECLARE(name, _method, _ops)			\
1196c3ff8b1SStephen Boyd 	static const struct of_cpu_method __cpu_method_of_table_##name	\
1206c3ff8b1SStephen Boyd 		__used __section(__cpu_method_of_table)			\
1216c3ff8b1SStephen Boyd 		= { .method = _method, .ops = _ops }
122abcee5fbSMarc Zyngier /*
123abcee5fbSMarc Zyngier  * set platform specific SMP operations
124abcee5fbSMarc Zyngier  */
125abcee5fbSMarc Zyngier extern void smp_set_ops(struct smp_operations *);
126abcee5fbSMarc Zyngier 
1274baa9922SRussell King #endif /* ifndef __ASM_ARM_SMP_H */
128