From: Dave Hansen <[email protected]>
Use the new "raw_" indirection and consolidate the two rdmsr_safe() implementations down to one. Signed-off-by: Dave Hansen <[email protected]> --- b/arch/x86/include/asm/msr.h | 21 +++++++++++---------- b/arch/x86/include/asm/paravirt.h | 10 ---------- 2 files changed, 11 insertions(+), 20 deletions(-) diff -puN arch/x86/include/asm/msr.h~rdmsr-dups-4 arch/x86/include/asm/msr.h --- a/arch/x86/include/asm/msr.h~rdmsr-dups-4 2026-03-20 11:24:19.323805632 -0700 +++ b/arch/x86/include/asm/msr.h 2026-03-20 11:24:19.330805942 -0700 @@ -173,6 +173,7 @@ static inline u64 native_read_pmc(int co #include <asm/paravirt.h> #define raw_read_msr paravirt_read_msr +#define raw_read_msr_safe paravirt_read_msr_safe #else #include <linux/errno.h> @@ -207,16 +208,6 @@ static inline int wrmsrq_safe(u32 msr, u return raw_write_msr_safe(msr, val); } -/* rdmsr with exception handling */ -#define rdmsr_safe(msr, low, high) \ -({ \ - u64 __val; \ - int __err = raw_read_msr_safe((msr), &__val); \ - (*low) = (u32)__val; \ - (*high) = (u32)(__val >> 32); \ - __err; \ -}) - static inline int rdmsrq_safe(u32 msr, u64 *p) { return raw_read_msr_safe(msr, p); @@ -239,6 +230,16 @@ do { \ (void)((high) = (u32)(__val >> 32)); \ } while (0) +/* rdmsr with exception handling */ +#define rdmsr_safe(msr, low, high) \ +({ \ + u64 __val; \ + int __err = raw_read_msr_safe((msr), &__val); \ + (*low) = (u32)__val; \ + (*high) = (u32)(__val >> 32); \ + __err; \ +}) + /* Instruction opcode for WRMSRNS supported in binutils >= 2.40 */ #define ASM_WRMSRNS _ASM_BYTES(0x0f,0x01,0xc6) diff -puN arch/x86/include/asm/paravirt.h~rdmsr-dups-4 arch/x86/include/asm/paravirt.h --- a/arch/x86/include/asm/paravirt.h~rdmsr-dups-4 2026-03-20 11:24:19.327805809 -0700 +++ b/arch/x86/include/asm/paravirt.h 2026-03-20 11:24:19.330805942 -0700 @@ -181,16 +181,6 @@ static inline int wrmsrq_safe(u32 msr, u return paravirt_write_msr_safe(msr, val); } -/* rdmsr with exception handling */ -#define rdmsr_safe(msr, a, b) \ -({ \ - u64 _l; \ - int _err = paravirt_read_msr_safe((msr), &_l); \ - (*a) = (u32)_l; \ - (*b) = (u32)(_l >> 32); \ - _err; \ -}) - static __always_inline int rdmsrq_safe(u32 msr, u64 *p) { return paravirt_read_msr_safe(msr, p); _

