[PATCH v6 15/17] x86/msr: Reduce number of low level MSR access helpers
From: Juergen Gross
Date: Mon Nov 16 2026 - 13:40:45 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 72f079df643d..9cd0ff3315de 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)
{
@@ -326,7 +315,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)
@@ -336,7 +325,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 11814bc2633a..4752230a03b8 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.56.0