[PATCH v4 16/18] x86/msr: Reduce number of low level MSR access helpers
From: Juergen Gross
Date: Mon Jun 29 2026 - 03:17:08 EST
Some MSR access helpers are redundant now, so remove the no longer
needed ones.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
arch/x86/include/asm/msr.h | 15 ++-------------
arch/x86/xen/enlighten_pv.c | 4 ++--
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index b13b4a93673e..74defb414931 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -269,22 +269,11 @@ static __always_inline void native_wrmsrq(u32 msr, u64 val)
__wrmsrq(msr, val);
}
-static inline u64 native_read_msr(u32 msr)
-{
- return native_rdmsrq(msr);
-}
-
static inline int native_read_msr_safe(u32 msr, u64 *val)
{
return __rdmsr(msr, val, EX_TYPE_RDMSR_SAFE) ? -EIO : 0;
}
-/* Can be uninlined because referenced by paravirt */
-static inline void notrace native_write_msr(u32 msr, u64 val)
-{
- native_wrmsrq(msr, val);
-}
-
/* Can be uninlined because referenced by paravirt */
static inline int notrace native_write_msr_safe(u32 msr, u64 val)
{
@@ -327,7 +316,7 @@ static inline u64 native_read_pmc(int counter)
#else
static __always_inline u64 read_msr(u32 msr)
{
- return native_read_msr(msr);
+ return native_rdmsrq(msr);
}
static __always_inline int read_msr_safe(u32 msr, u64 *p)
@@ -337,7 +326,7 @@ static __always_inline int read_msr_safe(u32 msr, u64 *p)
static __always_inline void write_msr(u32 msr, u64 val)
{
- native_write_msr(msr, val);
+ native_wrmsrq(msr, val);
}
static __always_inline int write_msr_safe(u32 msr, u64 val)
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 505a85c3869e..bc572ca49a2c 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1085,7 +1085,7 @@ static u64 xen_do_read_msr(u32 msr, int *err)
if (err)
*err = native_read_msr_safe(msr, &val);
else
- val = native_read_msr(msr);
+ val = native_rdmsrq(msr);
switch (msr) {
case MSR_IA32_APICBASE:
@@ -1144,7 +1144,7 @@ static void xen_do_write_msr(u32 msr, u64 val, int *err)
if (err)
*err = native_write_msr_safe(msr, val);
else
- native_write_msr(msr, val);
+ native_wrmsrq(msr, val);
}
}
--
2.54.0