xref: /kvm-unit-tests/lib/powerpc/asm/smp.h (revision 386ed5c2f9e98a2605817748c44c0cefa60dc88e)
1 #ifndef _ASMPOWERPC_SMP_H_
2 #define _ASMPOWERPC_SMP_H_
3 
4 #include <libcflat.h>
5 #include <asm/processor.h>
6 
7 typedef void (*secondary_entry_fn)(int cpu_id);
8 
9 struct cpu {
10 	unsigned long server_no;
11 	unsigned long stack;
12 	unsigned long exception_stack;
13 	secondary_entry_fn entry;
14 };
15 
16 extern int nr_cpus_present;
17 extern int nr_cpus_online;
18 extern struct cpu cpus[];
19 
20 register struct cpu *__current_cpu asm("r13");
21 static inline struct cpu *current_cpu(void)
22 {
23 	return __current_cpu;
24 }
25 
26 static inline int smp_processor_id(void)
27 {
28 	return current_cpu()->server_no;
29 }
30 
31 void cpu_init(struct cpu *cpu, int cpu_id);
32 
33 extern void halt(int cpu_id);
34 
35 extern bool start_all_cpus(secondary_entry_fn entry);
36 extern void stop_all_cpus(void);
37 
38 struct pt_regs;
39 void register_ipi(void (*fn)(struct pt_regs *, void *), void *data);
40 void unregister_ipi(void);
41 void cpu_init_ipis(void);
42 void local_ipi_enable(void);
43 void local_ipi_disable(void);
44 void send_ipi(int cpu_id);
45 
46 #endif /* _ASMPOWERPC_SMP_H_ */
47