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 814d3ae..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);
 
@@ -1779,7 +1790,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
                ret = kvm_hvcall_signal_event(vcpu, fast, ingpa);
                if (ret != HV_STATUS_INVALID_PORT_ID)
                        break;
-               /* fall through - maybe userspace knows this conn_id. */
+               fallthrough;    /* maybe userspace knows this conn_id */
        case HVCALL_POST_MESSAGE:
                /* don't bother userspace if it has no way to handle it */
                if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) {