summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/gsseg.h
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2023-01-12 10:20:31 +0300
committerIngo Molnar <mingo@kernel.org>2023-01-12 15:06:36 +0300
commitae53fa18703000f507107df43efd1168a0365361 (patch)
tree465debef68863f87d422789e2e5b53c5a6c99734 /arch/x86/include/asm/gsseg.h
parentdf729fb05ae2db52f7de150439392a88ee9d9b4f (diff)
downloadlinux-ae53fa18703000f507107df43efd1168a0365361.tar.xz
x86/gsseg: Move load_gs_index() to its own new header file
GS is a special segment on x86_64, move load_gs_index() to its own new header file to simplify header inclusion. No change in functionality. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Signed-off-by: Xin Li <xin3.li@intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20230112072032.35626-5-xin3.li@intel.com
Diffstat (limited to 'arch/x86/include/asm/gsseg.h')
-rw-r--r--arch/x86/include/asm/gsseg.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/x86/include/asm/gsseg.h b/arch/x86/include/asm/gsseg.h
new file mode 100644
index 000000000000..d15577c39e8d
--- /dev/null
+++ b/arch/x86/include/asm/gsseg.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _ASM_X86_GSSEG_H
+#define _ASM_X86_GSSEG_H
+
+#include <linux/types.h>
+
+#include <asm/asm.h>
+#include <asm/cpufeature.h>
+#include <asm/alternative.h>
+#include <asm/processor.h>
+#include <asm/nops.h>
+
+#ifdef CONFIG_X86_64
+
+extern asmlinkage void asm_load_gs_index(u16 selector);
+
+static inline void native_load_gs_index(unsigned int selector)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ asm_load_gs_index(selector);
+ local_irq_restore(flags);
+}
+
+#endif /* CONFIG_X86_64 */
+
+#ifndef CONFIG_PARAVIRT_XXL
+
+static inline void load_gs_index(unsigned int selector)
+{
+#ifdef CONFIG_X86_64
+ native_load_gs_index(selector);
+#else
+ loadsegment(gs, selector);
+#endif
+}
+
+#endif /* CONFIG_PARAVIRT_XXL */
+
+#endif /* _ASM_X86_GSSEG_H */