Merge tag 'kvmarm-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmar...
[linux-2.6-microblaze.git] / arch / x86 / kvm / hyperv.c
index 1d33056..67a4f60 100644 (file)
@@ -633,6 +633,11 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config,
 {
        union hv_stimer_config new_config = {.as_uint64 = config},
                old_config = {.as_uint64 = stimer->config.as_uint64};
+       struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer);
+       struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu);
+
+       if (!synic->active && !host)
+               return 1;
 
        trace_kvm_hv_stimer_set_config(stimer_to_vcpu(stimer)->vcpu_id,
                                       stimer->index, config, host);
@@ -652,6 +657,12 @@ static int stimer_set_config(struct kvm_vcpu_hv_stimer *stimer, u64 config,
 static int stimer_set_count(struct kvm_vcpu_hv_stimer *stimer, u64 count,
                            bool host)
 {
+       struct kvm_vcpu *vcpu = stimer_to_vcpu(stimer);
+       struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu);
+
+       if (!synic->active && !host)
+               return 1;
+
        trace_kvm_hv_stimer_set_count(stimer_to_vcpu(stimer)->vcpu_id,
                                      stimer->index, count, host);