Add a helper to check if passthrough PMU is enabled for convenience as it is vendor neutral. Signed-off-by: Mingwei Zhang <mizhang@xxxxxxxxxx> Signed-off-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx> Tested-by: Yongwei Ma <yongwei.ma@xxxxxxxxx> --- 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 cf93be5e7359..56ba0772568c 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -48,6 +48,11 @@ struct kvm_pmu_ops { void kvm_pmu_ops_update(const struct kvm_pmu_ops *pmu_ops); +static inline bool is_passthrough_pmu_enabled(struct kvm_vcpu *vcpu) +{ + return vcpu_to_pmu(vcpu)->passthrough; +} + static inline bool kvm_pmu_has_perf_global_ctrl(struct kvm_pmu *pmu) { /* -- 2.46.0.rc1.232.g9752f9e123-goog