KVM: x86/pmu: Disallow legacy LBRs if architectural LBRs are available
authorSean Christopherson <seanjc@google.com>
Sat, 28 Jan 2023 00:14:27 +0000 (00:14 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 6 Apr 2023 00:00:17 +0000 (17:00 -0700)
commit098f4c061ea10b777033b71c10bd9fd706820ee9
treed26bcef602bd8206720e28504d2ec7521f864a4b
parent7e768ce8278bafe43e2a4771a82b61856190a3fc
KVM: x86/pmu: Disallow legacy LBRs if architectural LBRs are available

Disallow enabling LBR support if the CPU supports architectural LBRs.
Traditional LBR support is absent on CPU models that have architectural
LBRs, and KVM doesn't yet support arch LBRs, i.e. KVM will pass through
non-existent MSRs if userspace enables LBRs for the guest.

Cc: stable@vger.kernel.org
Cc: Yang Weijiang <weijiang.yang@intel.com>
Cc: Like Xu <like.xu.linux@gmail.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Fixes: be635e34c284 ("KVM: vmx/pmu: Expose LBR_FMT in the MSR_IA32_PERF_CAPABILITIES")
Tested-by: Like Xu <likexu@tencent.com>
Link: https://lore.kernel.org/r/20230128001427.2548858-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/vmx.c