]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86: Advertise support for WRMSRNS
authorSean Christopherson <seanjc@google.com>
Thu, 27 Feb 2025 01:01:11 +0000 (17:01 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 24 Apr 2025 18:18:33 +0000 (11:18 -0700)
commitead4dac16de22081956f7af1c795bfbebd2d5866
treef6e13ba18e8242b053803974d24c4c842e34dae5
parent3fa0fc95db6df904dc812fa806a55ea6bafa65c1
KVM: x86: Advertise support for WRMSRNS

Advertise support for WRMSRNS (WRMSR non-serializing) to userspace if the
instruction is supported by the underlying CPU.  From a virtualization
perspective, the only difference between WRMSRNS and WRMSR is that VM-Exits
due to WRMSRNS set EXIT_QUALIFICATION to '1'.  WRMSRNS doesn't require a
new enabling control, shares the same basic exit reason, and behaves the
same as WRMSR with respect to MSR interception.

  WRMSR and WRMSRNS use the same basic exit reason (see Appendix C). For
  WRMSR, the exit qualification is 0, while for WRMSRNS it is 1.

Don't do anything different when emulating WRMSRNS vs. WRMSR, as KVM can't
do anything less, i.e. can't make emulation non-serializing.  The
motivation for the guest to use WRMSRNS instead of WRMSR is to avoid
immediately serializing the CPU when the necessary serialization is
guaranteed by some other mechanism, i.e. WRMSRNS being fully serializing
isn't guest-visible, just less performant.

Suggested-by: Xin Li (Intel) <xin@zytor.com>
Link: https://lore.kernel.org/r/20250227010111.3222742-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/cpuid.c