xref: /openbmc/linux/arch/arm/include/asm/smp.h (revision 5135d875e1457ef946a055003d8f80713e862135)
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  * Boot a secondary CPU, and assign it the specified idle task.
534baa9922SRussell King  * This also gives us the initial stack to use for this CPU.
544baa9922SRussell King  */
554baa9922SRussell King extern int boot_secondary(unsigned int cpu, struct task_struct *);
564baa9922SRussell King 
574baa9922SRussell King /*
584baa9922SRussell King  * Called from platform specific assembly code, this is the
594baa9922SRussell King  * secondary CPU entry point.
604baa9922SRussell King  */
614baa9922SRussell King asmlinkage void secondary_start_kernel(void);
624baa9922SRussell King 
6305c74a6cSRussell King 
6405c74a6cSRussell King /*
654baa9922SRussell King  * Initial data for bringing up a secondary CPU.
664baa9922SRussell King  */
674baa9922SRussell King struct secondary_data {
68eb08375eSJonathan Austin 	union {
69eb08375eSJonathan Austin 		unsigned long mpu_rgn_szr;
704baa9922SRussell King 		unsigned long pgdir;
71eb08375eSJonathan Austin 	};
72d427958aSCatalin Marinas 	unsigned long swapper_pg_dir;
734baa9922SRussell King 	void *stack;
744baa9922SRussell King };
754baa9922SRussell King extern struct secondary_data secondary_data;
7628e8e29cSMarc Zyngier extern volatile int pen_release;
774baa9922SRussell King 
784baa9922SRussell King extern int __cpu_disable(void);
794baa9922SRussell King 
804baa9922SRussell King extern void __cpu_die(unsigned int cpu);
814baa9922SRussell King extern void cpu_die(void);
824baa9922SRussell King 
834baa9922SRussell King extern void arch_send_call_function_single_ipi(int cpu);
8482668104SRussell King extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
85b62655f4SShawn Guo extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
864baa9922SRussell King 
87*5135d875SNicolas Pitre extern int register_ipi_completion(struct completion *completion, int cpu);
88*5135d875SNicolas Pitre 
89abcee5fbSMarc Zyngier struct smp_operations {
90abcee5fbSMarc Zyngier #ifdef CONFIG_SMP
91abcee5fbSMarc Zyngier 	/*
92abcee5fbSMarc Zyngier 	 * Setup the set of possible CPUs (via set_cpu_possible)
93abcee5fbSMarc Zyngier 	 */
94abcee5fbSMarc Zyngier 	void (*smp_init_cpus)(void);
95abcee5fbSMarc Zyngier 	/*
96abcee5fbSMarc Zyngier 	 * Initialize cpu_possible map, and enable coherency
97abcee5fbSMarc Zyngier 	 */
98abcee5fbSMarc Zyngier 	void (*smp_prepare_cpus)(unsigned int max_cpus);
99abcee5fbSMarc Zyngier 
100abcee5fbSMarc Zyngier 	/*
101abcee5fbSMarc Zyngier 	 * Perform platform specific initialisation of the specified CPU.
102abcee5fbSMarc Zyngier 	 */
103abcee5fbSMarc Zyngier 	void (*smp_secondary_init)(unsigned int cpu);
104abcee5fbSMarc Zyngier 	/*
105abcee5fbSMarc Zyngier 	 * Boot a secondary CPU, and assign it the specified idle task.
106abcee5fbSMarc Zyngier 	 * This also gives us the initial stack to use for this CPU.
107abcee5fbSMarc Zyngier 	 */
108abcee5fbSMarc Zyngier 	int  (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
109abcee5fbSMarc Zyngier #ifdef CONFIG_HOTPLUG_CPU
110abcee5fbSMarc Zyngier 	int  (*cpu_kill)(unsigned int cpu);
111abcee5fbSMarc Zyngier 	void (*cpu_die)(unsigned int cpu);
112abcee5fbSMarc Zyngier 	int  (*cpu_disable)(unsigned int cpu);
113abcee5fbSMarc Zyngier #endif
114abcee5fbSMarc Zyngier #endif
115abcee5fbSMarc Zyngier };
116abcee5fbSMarc Zyngier 
117abcee5fbSMarc Zyngier /*
118abcee5fbSMarc Zyngier  * set platform specific SMP operations
119abcee5fbSMarc Zyngier  */
120abcee5fbSMarc Zyngier extern void smp_set_ops(struct smp_operations *);
121abcee5fbSMarc Zyngier 
1224baa9922SRussell King #endif /* ifndef __ASM_ARM_SMP_H */
123