KVM: x86/pmu: Require nr fixed_pmc_events to match nr max fixed counters
authorSean Christopherson <seanjc@google.com>
Wed, 7 Jun 2023 01:02:05 +0000 (18:02 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 2 Aug 2023 23:44:36 +0000 (16:44 -0700)
commit6d88d0ee5de142921598e5c0041792bbd860913d
tree3007935e0c04149761293bab3900647955fb3ce0
parentbc9658999b3e44cbad964fe9fbab5a25bd4f5ed3
KVM: x86/pmu: Require nr fixed_pmc_events to match nr max fixed counters

Assert that the number of known fixed_pmc_events matches the max number of
fixed counters supported by KVM, and clean up related code.

Opportunistically extend setup_fixed_pmc_eventsel()'s use of
array_index_nospec() to cover fixed_counters, as nr_arch_fixed_counters is
set based on userspace input (but capped using KVM-controlled values).

Link: https://lore.kernel.org/r/20230607010206.1425277-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/pmu_intel.c