[tip: x86/cpu] x86/gsseg: Make asm_load_gs_index() take an u16

From: tip-bot2 for H. Peter Anvin (Intel)
Date: Thu Jan 12 2023 - 07:17:18 EST


The following commit has been merged into the x86/cpu branch of tip:

Commit-ID: df729fb05ae2db52f7de150439392a88ee9d9b4f
Gitweb: https://git.kernel.org/tip/df729fb05ae2db52f7de150439392a88ee9d9b4f
Author: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
AuthorDate: Wed, 11 Jan 2023 23:20:30 -08:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Thu, 12 Jan 2023 13:06:36 +01:00

x86/gsseg: Make asm_load_gs_index() take an u16

Let GCC know that only the low 16 bits of load_gs_index() argument
actually matter. It might allow it to create slightly better
code. However, do not propagate this into the prototypes of functions
that end up being paravirtualized, to avoid unnecessary changes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
Signed-off-by: Xin Li <xin3.li@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20230112072032.35626-4-xin3.li@xxxxxxxxx
---
arch/x86/entry/entry_64.S | 2 +-
arch/x86/include/asm/special_insns.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 15739a2..7ecd2ae 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -782,7 +782,7 @@ _ASM_NOKPROBE(common_interrupt_return)

/*
* Reload gs selector with exception handling
- * edi: new selector
+ * di: new selector
*
* Is in entry.text as it shouldn't be instrumented.
*/
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 35f709f..a71d0e8 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -120,7 +120,7 @@ static inline void native_wbinvd(void)
asm volatile("wbinvd": : :"memory");
}

-extern asmlinkage void asm_load_gs_index(unsigned int selector);
+extern asmlinkage void asm_load_gs_index(u16 selector);

static inline void native_load_gs_index(unsigned int selector)
{