xref: /openbmc/linux/arch/arm/include/asm/smp.h (revision b62655f4c6f3e4d21934eee14ac2ac5cd479c97c)
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 {
684baa9922SRussell King 	unsigned long pgdir;
69d427958aSCatalin Marinas 	unsigned long swapper_pg_dir;
704baa9922SRussell King 	void *stack;
714baa9922SRussell King };
724baa9922SRussell King extern struct secondary_data secondary_data;
7328e8e29cSMarc Zyngier extern volatile int pen_release;
744baa9922SRussell King 
754baa9922SRussell King extern int __cpu_disable(void);
764baa9922SRussell King 
774baa9922SRussell King extern void __cpu_die(unsigned int cpu);
784baa9922SRussell King extern void cpu_die(void);
794baa9922SRussell King 
804baa9922SRussell King extern void arch_send_call_function_single_ipi(int cpu);
8182668104SRussell King extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
82*b62655f4SShawn Guo extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
834baa9922SRussell King 
84abcee5fbSMarc Zyngier struct smp_operations {
85abcee5fbSMarc Zyngier #ifdef CONFIG_SMP
86abcee5fbSMarc Zyngier 	/*
87abcee5fbSMarc Zyngier 	 * Setup the set of possible CPUs (via set_cpu_possible)
88abcee5fbSMarc Zyngier 	 */
89abcee5fbSMarc Zyngier 	void (*smp_init_cpus)(void);
90abcee5fbSMarc Zyngier 	/*
91abcee5fbSMarc Zyngier 	 * Initialize cpu_possible map, and enable coherency
92abcee5fbSMarc Zyngier 	 */
93abcee5fbSMarc Zyngier 	void (*smp_prepare_cpus)(unsigned int max_cpus);
94abcee5fbSMarc Zyngier 
95abcee5fbSMarc Zyngier 	/*
96abcee5fbSMarc Zyngier 	 * Perform platform specific initialisation of the specified CPU.
97abcee5fbSMarc Zyngier 	 */
98abcee5fbSMarc Zyngier 	void (*smp_secondary_init)(unsigned int cpu);
99abcee5fbSMarc Zyngier 	/*
100abcee5fbSMarc Zyngier 	 * Boot a secondary CPU, and assign it the specified idle task.
101abcee5fbSMarc Zyngier 	 * This also gives us the initial stack to use for this CPU.
102abcee5fbSMarc Zyngier 	 */
103abcee5fbSMarc Zyngier 	int  (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
104abcee5fbSMarc Zyngier #ifdef CONFIG_HOTPLUG_CPU
105abcee5fbSMarc Zyngier 	int  (*cpu_kill)(unsigned int cpu);
106abcee5fbSMarc Zyngier 	void (*cpu_die)(unsigned int cpu);
107abcee5fbSMarc Zyngier 	int  (*cpu_disable)(unsigned int cpu);
108abcee5fbSMarc Zyngier #endif
109abcee5fbSMarc Zyngier #endif
110abcee5fbSMarc Zyngier };
111abcee5fbSMarc Zyngier 
112abcee5fbSMarc Zyngier /*
113abcee5fbSMarc Zyngier  * set platform specific SMP operations
114abcee5fbSMarc Zyngier  */
115abcee5fbSMarc Zyngier extern void smp_set_ops(struct smp_operations *);
116abcee5fbSMarc Zyngier 
1174baa9922SRussell King #endif /* ifndef __ASM_ARM_SMP_H */
118