]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/arm/kvm/arm.c
arm/arm64: KVM: Rework the arch timer to use level-triggered semantics
[karo-tx-linux.git] / arch / arm / kvm / arm.c
index 7ed4d475d83aa6e3474258d59e995334ae40af9d..59125f48c7070247f9d9b20249e51e75272a5756 100644 (file)
@@ -561,9 +561,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 
                if (ret <= 0 || need_new_vmid_gen(vcpu->kvm)) {
                        local_irq_enable();
+                       kvm_timer_sync_hwstate(vcpu);
                        kvm_vgic_sync_hwstate(vcpu);
                        preempt_enable();
-                       kvm_timer_sync_hwstate(vcpu);
                        continue;
                }
 
@@ -608,12 +608,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
                kvm_guest_exit();
                trace_kvm_exit(kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
 
+               /*
+                * We must sync the timer state before the vgic state so that
+                * the vgic can properly sample the updated state of the
+                * interrupt line.
+                */
+               kvm_timer_sync_hwstate(vcpu);
+
                kvm_vgic_sync_hwstate(vcpu);
 
                preempt_enable();
 
-               kvm_timer_sync_hwstate(vcpu);
-
                ret = handle_exit(vcpu, run, ret);
        }