KVM: x86/pmu: Don't tell userspace to save MSRs for non-existent fixed PMCs
authorLike Xu <likexu@tencent.com>
Tue, 24 Jan 2023 23:49:04 +0000 (23:49 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 27 Jan 2023 02:03:42 +0000 (18:03 -0800)
commite33b6d79acac169bfe1a9682fc5b4f8202fa4c41
tree9c0b0c2cbbb3c1853423e46c5fd258e7fcb57213
parentc3531edc79a7adbe4451d34084e8bf227c022872
KVM: x86/pmu: Don't tell userspace to save MSRs for non-existent fixed PMCs

Limit the set of MSRs for fixed PMU counters based on the number of fixed
counters actually supported by the host so that userspace doesn't waste
time saving and restoring dummy values.

Signed-off-by: Like Xu <likexu@tencent.com>
[sean: split for !enable_pmu logic, drop min(), write changelog]
Link: https://lore.kernel.org/r/20230124234905.3774678-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c