xref: /linux/arch/riscv/include/asm/vdso/processor.h (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_VDSO_PROCESSOR_H
3 #define __ASM_VDSO_PROCESSOR_H
4 
5 #ifndef __ASSEMBLER__
6 
7 #include <asm/barrier.h>
8 #include <asm/errata_list.h>
9 #include <asm/insn-def.h>
10 
11 static inline void cpu_relax(void)
12 {
13 #ifdef __riscv_muldiv
14 	int dummy;
15 	/* In lieu of a halt instruction, induce a long-latency stall. */
16 	__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
17 #endif
18 
19 	/*
20 	 * Reduce instruction retirement.
21 	 * This assumes the PC changes.
22 	 */
23 	ALT_RISCV_PAUSE();
24 	barrier();
25 }
26 
27 #endif /* __ASSEMBLER__ */
28 
29 #endif /* __ASM_VDSO_PROCESSOR_H */
30