diff options
author | Sean Christopherson <seanjc@google.com> | 2025-08-06 12:56:37 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2025-09-18 12:56:28 -0700 |
commit | e3d1f2826da68c763cba1f29dba5cc81d3fdaaee (patch) | |
tree | 0825f5a9ef496718ba61b1bd54550e63e58a3ae3 /tools/docs/lib/parse_data_structs.py | |
parent | 4687a2c4e6a61b247ad14ffb2ef5ca56e44fa4f2 (diff) |
KVM: SVM: Check pmu->version, not enable_pmu, when getting PMC MSRs
Gate access to PMC MSRs based on pmu->version, not on kvm->arch.enable_pmu,
to more accurately reflect KVM's behavior. This is a glorified nop, as
pmu->version and pmu->nr_arch_gp_counters can only be non-zero if
amd_pmu_refresh() is reached, kvm_pmu_refresh() invokes amd_pmu_refresh()
if and only if kvm->arch.enable_pmu is true, and amd_pmu_refresh() forces
pmu->version to be 1 or 2.
I.e. the following holds true:
!pmu->nr_arch_gp_counters || kvm->arch.enable_pmu == (pmu->version > 0)
and so the only way for amd_pmu_get_pmc() to return a non-NULL value is if
both kvm->arch.enable_pmu and pmu->version evaluate to true.
No real functional change intended.
Reviewed-by: Sandipan Das <sandipan.das@amd.com>
Tested-by: Xudong Hao <xudong.hao@intel.com>
Link: https://lore.kernel.org/r/20250806195706.1650976-16-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/docs/lib/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions