xref: /kvm-unit-tests/lib/riscv/asm/smp.h (revision 48d5952451de62a4db23cf73024f702cf1a64fc3)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _ASMRISCV_SMP_H_
3 #define _ASMRISCV_SMP_H_
4 #include <asm/barrier.h>
5 #include <asm/processor.h>
6 
7 #define smp_wait_for_event()	cpu_relax()
8 #define smp_send_event()	cpu_relax()
9 
smp_processor_id(void)10 static inline int smp_processor_id(void)
11 {
12 	return current_thread_info()->cpu;
13 }
14 
15 typedef void (*secondary_func_t)(void);
16 
17 struct secondary_data {
18 	unsigned long satp;
19 	unsigned long stvec;
20 	secondary_func_t func;
21 } __attribute__((aligned(16)));
22 
23 void secondary_entry(unsigned long hartid, unsigned long sp_phys);
24 secondary_func_t secondary_cinit(struct secondary_data *data);
25 
26 void smp_boot_secondary(int cpu, void (*func)(void));
27 void smp_boot_secondary_nofail(int cpu, void (*func)(void));
28 
29 #endif /* _ASMRISCV_SMP_H_ */
30