Skip to content

Commit 9ba0bb4

Browse files
committed
KVM: x86/pmu: Implement AMD mediated PMU requirements
Require host PMU version 2+ for AMD mediated PMU support, as PERF_GLOBAL_CTRL and friends are hard requirements for the mediated PMU. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Co-developed-by: Mingwei Zhang <mizhang@google.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> [sean: extract to separate patch, write changelog] Reviewed-by: Sandipan Das <sandipan.das@amd.com> Tested-by: Xudong Hao <xudong.hao@intel.com> Tested-by: Manali Shukla <manali.shukla@amd.com> Link: https://patch.msgid.link/20251206001720.468579-19-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent bfee4f0 commit 9ba0bb4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

arch/x86/kvm/svm/pmu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ static void amd_pmu_init(struct kvm_vcpu *vcpu)
227227
}
228228
}
229229

230+
static bool amd_pmu_is_mediated_pmu_supported(struct x86_pmu_capability *host_pmu)
231+
{
232+
return host_pmu->version >= 2;
233+
}
234+
230235
struct kvm_pmu_ops amd_pmu_ops __initdata = {
231236
.rdpmc_ecx_to_pmc = amd_rdpmc_ecx_to_pmc,
232237
.msr_idx_to_pmc = amd_msr_idx_to_pmc,
@@ -236,6 +241,9 @@ struct kvm_pmu_ops amd_pmu_ops __initdata = {
236241
.set_msr = amd_pmu_set_msr,
237242
.refresh = amd_pmu_refresh,
238243
.init = amd_pmu_init,
244+
245+
.is_mediated_pmu_supported = amd_pmu_is_mediated_pmu_supported,
246+
239247
.EVENTSEL_EVENT = AMD64_EVENTSEL_EVENT,
240248
.MAX_NR_GP_COUNTERS = KVM_MAX_NR_AMD_GP_COUNTERS,
241249
.MIN_NR_GP_COUNTERS = AMD64_NUM_COUNTERS,

0 commit comments

Comments
 (0)