summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/vdso
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2020-11-26 14:09:59 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2020-12-03 15:01:09 +0100
commit8f8cffd9df81612b5b06d2c57ebf74f8961b41be (patch)
tree17e3f68de53724982679d0cfb0094eaaf7768518 /arch/powerpc/include/asm/vdso
parentpowerpc/feature: Use CONFIG_PPC64 instead of __powerpc64__ to define possible... (diff)
downloadlinux-8f8cffd9df81612b5b06d2c57ebf74f8961b41be.tar.xz
linux-8f8cffd9df81612b5b06d2c57ebf74f8961b41be.zip
powerpc/processor: Move cpu_relax() into asm/vdso/processor.h
cpu_relax() need to be in asm/vdso/processor.h to be used by the C VDSO generic library. Move it there. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201126131006.2431205-2-mpe@ellerman.id.au
Diffstat (limited to 'arch/powerpc/include/asm/vdso')
-rw-r--r--arch/powerpc/include/asm/vdso/processor.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/vdso/processor.h b/arch/powerpc/include/asm/vdso/processor.h
new file mode 100644
index 000000000000..e072577bc7c0
--- /dev/null
+++ b/arch/powerpc/include/asm/vdso/processor.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _ASM_POWERPC_VDSO_PROCESSOR_H
+#define _ASM_POWERPC_VDSO_PROCESSOR_H
+
+#ifndef __ASSEMBLY__
+
+/* Macros for adjusting thread priority (hardware multi-threading) */
+#define HMT_very_low() asm volatile("or 31, 31, 31 # very low priority")
+#define HMT_low() asm volatile("or 1, 1, 1 # low priority")
+#define HMT_medium_low() asm volatile("or 6, 6, 6 # medium low priority")
+#define HMT_medium() asm volatile("or 2, 2, 2 # medium priority")
+#define HMT_medium_high() asm volatile("or 5, 5, 5 # medium high priority")
+#define HMT_high() asm volatile("or 3, 3, 3 # high priority")
+
+#ifdef CONFIG_PPC64
+#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
+#else
+#define cpu_relax() barrier()
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_POWERPC_VDSO_PROCESSOR_H */