[RFC PATCH 13/41] KVM: x86/pmu: Add a helper to check if passthrough PMU is enabled
From: Xiong Zhang
Date: Fri Jan 26 2024 - 04:34:34 EST
From: Mingwei Zhang <mizhang@xxxxxxxxxx>
Add a helper to check if passthrough PMU is enabled for convenience as it
is vendor neutral.
Signed-off-by: Mingwei Zhang <mizhang@xxxxxxxxxx>
---
arch/x86/kvm/pmu.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h
index 51011603c799..28beae0f9209 100644
--- a/arch/x86/kvm/pmu.h
+++ b/arch/x86/kvm/pmu.h
@@ -267,6 +267,11 @@ static inline bool pmc_is_globally_enabled(struct kvm_pmc *pmc)
return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl);
}
+static inline bool is_passthrough_pmu_enabled(struct kvm_vcpu *vcpu)
+{
+ return vcpu_to_pmu(vcpu)->passthrough;
+}
+
void kvm_pmu_deliver_pmi(struct kvm_vcpu *vcpu);
void kvm_pmu_handle_event(struct kvm_vcpu *vcpu);
int kvm_pmu_rdpmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);
--
2.34.1