x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses
authorXin Li (Intel) <xin@zytor.com>
Sun, 27 Apr 2025 09:20:19 +0000 (02:20 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 2 May 2025 08:27:49 +0000 (10:27 +0200)
commit519be7da37b955164c59aacaee6d6ac89f4bbe15
treeab2cd20500c6d908d96dd99fbc79cdb66d440b0e
parent5afa4cf54518b26e18d7b7ce2e9d9724f9cb9324
x86/msr: Convert __wrmsr() uses to native_wrmsr{,q}() uses

__wrmsr() is the lowest level MSR write API, with native_wrmsr()
and native_wrmsrq() serving as higher-level wrappers around it:

  #define native_wrmsr(msr, low, high)                    \
          __wrmsr(msr, low, high)

  #define native_wrmsrl(msr, val)                         \
          __wrmsr((msr), (u32)((u64)(val)),               \
                         (u32)((u64)(val) >> 32))

However, __wrmsr() continues to be utilized in various locations.

MSR APIs are designed for different scenarios, such as native or
pvops, with or without trace, and safe or non-safe.  Unfortunately,
the current MSR API names do not adequately reflect these factors,
making it challenging to select the most appropriate API for
various situations.

To pave the way for improving MSR API names, convert __wrmsr()
uses to native_wrmsr{,q}() to ensure consistent usage.  Later,
these APIs can be renamed to better reflect their implications,
such as native or pvops, with or without trace, and safe or
non-safe.

No functional change intended.

Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Link: https://lore.kernel.org/r/20250427092027.1598740-8-xin@zytor.com
arch/x86/events/amd/brs.c
arch/x86/include/asm/apic.h
arch/x86/include/asm/msr.h
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/resctrl/pseudo_lock.c