From: Dave Hansen <[email protected]>
Move the existing "native" rdmsr_safe() implementation out to common code. Consolidate the two rdmsr_safe() implementations down to one by removing the paravirt.h version. Signed-off-by: Dave Hansen <[email protected]> --- b/arch/x86/include/asm/msr.h | 20 ++++++++++---------- b/arch/x86/include/asm/paravirt.h | 10 ---------- 2 files changed, 10 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-04-01 14:32:56.670457110 -0700 +++ b/arch/x86/include/asm/msr.h 2026-04-01 14:32:56.676457335 -0700 @@ -205,16 +205,6 @@ static inline int wrmsrq_safe(u32 msr, u return paravirt_write_msr_safe(msr, val); } -/* rdmsr with exception handling */ -#define rdmsr_safe(msr, low, high) \ -({ \ - u64 __val; \ - int __err = paravirt_read_msr_safe((msr), &__val); \ - (*low) = (u32)__val; \ - (*high) = (u32)(__val >> 32); \ - __err; \ -}) - static inline int rdmsrq_safe(u32 msr, u64 *p) { return paravirt_read_msr_safe(msr, p); @@ -237,6 +227,16 @@ do { \ (void)((high) = (u32)(__val >> 32)); \ } while (0) +/* rdmsr with exception handling */ +#define rdmsr_safe(msr, low, high) \ +({ \ + u64 __val; \ + int __err = paravirt_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-04-01 14:32:56.673457222 -0700 +++ b/arch/x86/include/asm/paravirt.h 2026-04-01 14:32:56.676457335 -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); _

