xref: /linux/arch/powerpc/include/asm/vdso/processor.h (revision e2683c8868d03382da7e1ce8453b543a043066d1)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _ASM_POWERPC_VDSO_PROCESSOR_H
3 #define _ASM_POWERPC_VDSO_PROCESSOR_H
4 
5 #ifndef __ASSEMBLER__
6 
7 #include <asm/cputable.h>
8 #include <asm/feature-fixups.h>
9 
10 /* Macros for adjusting thread priority (hardware multi-threading) */
11 #ifdef CONFIG_PPC64
12 #define HMT_very_low()		asm volatile("or 31, 31, 31	# very low priority")
13 #define HMT_low()		asm volatile("or 1, 1, 1	# low priority")
14 #define HMT_medium_low()	asm volatile("or 6, 6, 6	# medium low priority")
15 #define HMT_medium()		asm volatile("or 2, 2, 2	# medium priority")
16 #define HMT_medium_high()	asm volatile("or 5, 5, 5	# medium high priority")
17 #define HMT_high()		asm volatile("or 3, 3, 3	# high priority")
18 #else
19 #define HMT_very_low()
20 #define HMT_low()
21 #define HMT_medium_low()
22 #define HMT_medium()
23 #define HMT_medium_high()
24 #define HMT_high()
25 #endif
26 
27 #ifdef CONFIG_PPC64
28 #define cpu_relax()							\
29 	asm volatile(ASM_FTR_IFCLR(					\
30 		/* Pre-POWER10 uses low ; medium priority nops */	\
31 		"or 1,1,1 ; or 2,2,2",					\
32 		/* POWER10 onward uses pause_short (wait 2,0) */	\
33 		PPC_WAIT(2, 0),						\
34 		%0) :: "i" (CPU_FTR_ARCH_31) : "memory")
35 #else
36 #define cpu_relax()	barrier()
37 #endif
38 
39 #endif /* __ASSEMBLER__ */
40 
41 #endif /* _ASM_POWERPC_VDSO_PROCESSOR_H */
42