KVM: x86/pmu: Advertise PERFCTR_CORE iff the min nr of counters is met
authorLike Xu <likexu@tencent.com>
Sat, 3 Jun 2023 01:10:54 +0000 (18:10 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 7 Jun 2023 00:31:44 +0000 (17:31 -0700)
commitd338d8789e64b2d8ed2f82f9364c415d6efa118d
tree000419ab62a2020cea3a1290dda2c7fa810afd15
parent6a08083f294cb623fbc882417b28c5646b01f4bf
KVM: x86/pmu: Advertise PERFCTR_CORE iff the min nr of counters is met

Enable and advertise PERFCTR_CORE if and only if the minimum number of
required counters are available, i.e. if perf says there are less than six
general purpose counters.

Opportunistically, use kvm_cpu_cap_check_and_set() instead of open coding
the check for host support.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Like Xu <likexu@tencent.com>
[sean: massage shortlog and changelog]
Link: https://lore.kernel.org/r/20230603011058.1038821-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/svm.c