Merge tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-microblaze.git] / arch / arm64 / kvm / pmu.c
index faf32a4..03a6c1f 100644 (file)
@@ -33,7 +33,7 @@ void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr)
 {
        struct kvm_host_data *ctx = this_cpu_ptr_hyp_sym(kvm_host_data);
 
-       if (!ctx || !kvm_pmu_switch_needed(attr))
+       if (!kvm_arm_support_pmu_v3() || !ctx || !kvm_pmu_switch_needed(attr))
                return;
 
        if (!attr->exclude_host)
@@ -49,7 +49,7 @@ void kvm_clr_pmu_events(u32 clr)
 {
        struct kvm_host_data *ctx = this_cpu_ptr_hyp_sym(kvm_host_data);
 
-       if (!ctx)
+       if (!kvm_arm_support_pmu_v3() || !ctx)
                return;
 
        ctx->pmu_events.events_host &= ~clr;
@@ -172,7 +172,7 @@ void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu)
        struct kvm_host_data *host;
        u32 events_guest, events_host;
 
-       if (!has_vhe())
+       if (!kvm_arm_support_pmu_v3() || !has_vhe())
                return;
 
        preempt_disable();
@@ -193,7 +193,7 @@ void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu)
        struct kvm_host_data *host;
        u32 events_guest, events_host;
 
-       if (!has_vhe())
+       if (!kvm_arm_support_pmu_v3() || !has_vhe())
                return;
 
        host = this_cpu_ptr_hyp_sym(kvm_host_data);