xref: /kvm-unit-tests/lib/riscv/asm/smp.h (revision 48d5952451de62a4db23cf73024f702cf1a64fc3)
19c92b28eSAndrew Jones /* SPDX-License-Identifier: GPL-2.0-only */
29c92b28eSAndrew Jones #ifndef _ASMRISCV_SMP_H_
39c92b28eSAndrew Jones #define _ASMRISCV_SMP_H_
49c92b28eSAndrew Jones #include <asm/barrier.h>
59c92b28eSAndrew Jones #include <asm/processor.h>
69c92b28eSAndrew Jones 
79c92b28eSAndrew Jones #define smp_wait_for_event()	cpu_relax()
89c92b28eSAndrew Jones #define smp_send_event()	cpu_relax()
99c92b28eSAndrew Jones 
smp_processor_id(void)109c92b28eSAndrew Jones static inline int smp_processor_id(void)
119c92b28eSAndrew Jones {
129c92b28eSAndrew Jones 	return current_thread_info()->cpu;
139c92b28eSAndrew Jones }
149c92b28eSAndrew Jones 
159c92b28eSAndrew Jones typedef void (*secondary_func_t)(void);
169c92b28eSAndrew Jones 
179c92b28eSAndrew Jones struct secondary_data {
18*0c39d9eaSAndrew Jones 	unsigned long satp;
199c92b28eSAndrew Jones 	unsigned long stvec;
209c92b28eSAndrew Jones 	secondary_func_t func;
219c92b28eSAndrew Jones } __attribute__((aligned(16)));
229c92b28eSAndrew Jones 
239c92b28eSAndrew Jones void secondary_entry(unsigned long hartid, unsigned long sp_phys);
249c92b28eSAndrew Jones secondary_func_t secondary_cinit(struct secondary_data *data);
259c92b28eSAndrew Jones 
269c92b28eSAndrew Jones void smp_boot_secondary(int cpu, void (*func)(void));
279c92b28eSAndrew Jones void smp_boot_secondary_nofail(int cpu, void (*func)(void));
289c92b28eSAndrew Jones 
299c92b28eSAndrew Jones #endif /* _ASMRISCV_SMP_H_ */
30