[PATCH v2 0/4] KVM: x86/pmu: Refactoring code by reusing pmc->eventsel for fixed_counters

From: Like Xu
Date: Fri Nov 19 2021 - 01:49:15 EST


This patch set is essentially triggered by Jim's patch set[1]
(especially patch 01 and 04).

The new idea to set up and maintain pmc->eventsel for fixed counters.
This would unify all fixed/gp code logic based on the same semantics
"pmc->eventsel". (I demonstrated this in patch 01-03, more can be done)

v1 -> v2 Changelog:
- Rename find_perf_hw_id() to pmc_perf_hw_id(); [Paolo]
- Add WARN_ON for amd_pmc_perf_hw_id(); [Paolo]
- Add pmc->intr to drop dummy need_overflow_intr(pmc); [Paolo]


[1] https://lore.kernel.org/kvm/96170437-1e00-7841-260e-39d181e7886d@xxxxxxxxx/T/#t

Please check each commit message for more details
and let me know if there is any room for improvement,


Like Xu (4):
KVM: x86/pmu: Setup pmc->eventsel for fixed PMCs
KVM: x86/pmu: Refactoring find_arch_event() to pmc_perf_hw_id()
KVM: x86/pmu: Reuse pmc_perf_hw_id() and drop find_fixed_event()
KVM: x86/pmu: Add pmc->intr to refactor kvm_perf_overflow{_intr}()

arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/pmu.c | 58 +++++++++++++--------------------
arch/x86/kvm/pmu.h | 4 +--
arch/x86/kvm/svm/pmu.c | 19 +++++------
arch/x86/kvm/vmx/pmu_intel.c | 54 ++++++++++++++++++++----------
5 files changed, 69 insertions(+), 67 deletions(-)