]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: x86/pmu: Introduce eventsel_hw to prepare for pmu event filtering
authorMingwei Zhang <mizhang@google.com>
Sat, 6 Dec 2025 00:17:00 +0000 (16:17 -0800)
committerSean Christopherson <seanjc@google.com>
Thu, 8 Jan 2026 19:52:09 +0000 (11:52 -0800)
commit02918f0077925994b04be147875b6de8b63ca249
tree906220360c52efb3833fbd1524d1b2c114eefa03
parent0ea0d6314870493ac723afefb6257be71f4c636f
KVM: x86/pmu: Introduce eventsel_hw to prepare for pmu event filtering

Introduce eventsel_hw and fixed_ctr_ctrl_hw to store the actual HW value in
PMU event selector MSRs. In mediated PMU checks events before allowing the
event values written to the PMU MSRs. However, to match the HW behavior,
when PMU event checks fails, KVM should allow guest to read the value back.

This essentially requires an extra variable to separate the guest requested
value from actual PMU MSR value. Note this only applies to event selectors.

Signed-off-by: Mingwei Zhang <mizhang@google.com>
Co-developed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Tested-by: Xudong Hao <xudong.hao@intel.com>
Tested-by: Manali Shukla <manali.shukla@amd.com>
Link: https://patch.msgid.link/20251206001720.468579-25-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/pmu.c
arch/x86/kvm/svm/pmu.c
arch/x86/kvm/vmx/pmu_intel.c