Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

H. Peter Anvin (Intel) and committed by
Ingo Molnar
ae53fa18 df729fb0

+45 -21
+41
arch/x86/include/asm/gsseg.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #ifndef _ASM_X86_GSSEG_H 3 + #define _ASM_X86_GSSEG_H 4 + 5 + #include <linux/types.h> 6 + 7 + #include <asm/asm.h> 8 + #include <asm/cpufeature.h> 9 + #include <asm/alternative.h> 10 + #include <asm/processor.h> 11 + #include <asm/nops.h> 12 + 13 + #ifdef CONFIG_X86_64 14 + 15 + extern asmlinkage void asm_load_gs_index(u16 selector); 16 + 17 + static inline void native_load_gs_index(unsigned int selector) 18 + { 19 + unsigned long flags; 20 + 21 + local_irq_save(flags); 22 + asm_load_gs_index(selector); 23 + local_irq_restore(flags); 24 + } 25 + 26 + #endif /* CONFIG_X86_64 */ 27 + 28 + #ifndef CONFIG_PARAVIRT_XXL 29 + 30 + static inline void load_gs_index(unsigned int selector) 31 + { 32 + #ifdef CONFIG_X86_64 33 + native_load_gs_index(selector); 34 + #else 35 + loadsegment(gs, selector); 36 + #endif 37 + } 38 + 39 + #endif /* CONFIG_PARAVIRT_XXL */ 40 + 41 + #endif /* _ASM_X86_GSSEG_H */
+1
arch/x86/include/asm/mmu_context.h
··· 12 12 #include <asm/tlbflush.h> 13 13 #include <asm/paravirt.h> 14 14 #include <asm/debugreg.h> 15 + #include <asm/gsseg.h> 15 16 16 17 extern atomic64_t last_mm_ctx_id; 17 18
-21
arch/x86/include/asm/special_insns.h
··· 120 120 asm volatile("wbinvd": : :"memory"); 121 121 } 122 122 123 - extern asmlinkage void asm_load_gs_index(u16 selector); 124 - 125 - static inline void native_load_gs_index(unsigned int selector) 126 - { 127 - unsigned long flags; 128 - 129 - local_irq_save(flags); 130 - asm_load_gs_index(selector); 131 - local_irq_restore(flags); 132 - } 133 - 134 123 static inline unsigned long __read_cr4(void) 135 124 { 136 125 return native_read_cr4(); ··· 171 182 static inline void wbinvd(void) 172 183 { 173 184 native_wbinvd(); 174 - } 175 - 176 - 177 - static inline void load_gs_index(unsigned int selector) 178 - { 179 - #ifdef CONFIG_X86_64 180 - native_load_gs_index(selector); 181 - #else 182 - loadsegment(gs, selector); 183 - #endif 184 185 } 185 186 186 187 #endif /* CONFIG_PARAVIRT_XXL */
+1
arch/x86/kernel/paravirt.c
··· 32 32 #include <asm/special_insns.h> 33 33 #include <asm/tlb.h> 34 34 #include <asm/io_bitmap.h> 35 + #include <asm/gsseg.h> 35 36 36 37 /* 37 38 * nop stub, which must not clobber anything *including the stack* to
+1
arch/x86/kernel/signal_32.c
··· 31 31 #include <asm/sigframe.h> 32 32 #include <asm/sighandling.h> 33 33 #include <asm/smap.h> 34 + #include <asm/gsseg.h> 34 35 35 36 #ifdef CONFIG_IA32_EMULATION 36 37 #include <asm/ia32_unistd.h>
+1
arch/x86/kernel/tls.c
··· 12 12 #include <asm/ldt.h> 13 13 #include <asm/processor.h> 14 14 #include <asm/proto.h> 15 + #include <asm/gsseg.h> 15 16 16 17 #include "tls.h" 17 18