xref: /kvm-unit-tests/lib/riscv/asm/smp.h (revision 2479ae507a7e89903c067d89b476bb27e48875fe)
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 
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 stvec;
19 	secondary_func_t func;
20 } __attribute__((aligned(16)));
21 
22 void secondary_entry(unsigned long hartid, unsigned long sp_phys);
23 secondary_func_t secondary_cinit(struct secondary_data *data);
24 
25 void smp_boot_secondary(int cpu, void (*func)(void));
26 void smp_boot_secondary_nofail(int cpu, void (*func)(void));
27 
28 #endif /* _ASMRISCV_SMP_H_ */
29