[PATCH kvm/queue v2 0/3] KVM: x86/pmu: Fix out-of-date AMD amd_event_mapping[]
From: Like Xu
Date: Mon Jan 17 2022 - 03:53:21 EST
The current amd_event_mapping[] named "amd_perfmon_event_map" is only
valid for "K7 and later, up to and including Family 16h" but for AMD
"Family 17h and later", it needs amd_f17h_perfmon_event_mapp[] .
It's proposed to fix it in a more generic approach:
- decouple the available_event_types from the CPUID 0x0A.EBX bit vector;
- alway get the right perfmon_event_map[] form the hoser perf interface;
- dynamically populate {inte|amd}_event_mapping[] during hardware setup;
v1 -> v2 Changelog:
- Drop some merged patches and one misunderstood patch;
- Rename bitmap name from "avail_cpuid_events" to "avail_perf_hw_ids";
- Fix kernel test robot() compiler warning;
Previous:
https://lore.kernel.org/kvm/20211112095139.21775-1-likexu@xxxxxxxxxxx/
Like Xu (3):
KVM: x86/pmu: Replace pmu->available_event_types with a new BITMAP
perf: x86/core: Add interface to query perfmon_event_map[] directly
KVM: x86/pmu: Setup the {inte|amd}_event_mapping[] when hardware_setup
arch/x86/events/core.c | 9 ++++
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/include/asm/perf_event.h | 2 +
arch/x86/kvm/pmu.c | 25 ++++++++++-
arch/x86/kvm/pmu.h | 2 +
arch/x86/kvm/svm/pmu.c | 23 ++--------
arch/x86/kvm/vmx/pmu_intel.c | 72 ++++++++++++++++++++-----------
arch/x86/kvm/x86.c | 1 +
8 files changed, 89 insertions(+), 47 deletions(-)
--
2.33.1