KVM: x86: fire timer when it is migrated and expired, and in oneshot mode
[linux-2.6-microblaze.git] / arch / x86 / kvm / lapic.c
index d2ad5e8..c28ba02 100644 (file)
@@ -1968,8 +1968,12 @@ static bool set_target_expiration(struct kvm_lapic *apic, u32 count_reg)
                if (unlikely(count_reg != APIC_TMICT)) {
                        deadline = tmict_to_ns(apic,
                                     kvm_lapic_get_reg(apic, count_reg));
-                       if (unlikely(deadline <= 0))
-                               deadline = apic->lapic_timer.period;
+                       if (unlikely(deadline <= 0)) {
+                               if (apic_lvtt_period(apic))
+                                       deadline = apic->lapic_timer.period;
+                               else
+                                       deadline = 0;
+                       }
                        else if (unlikely(deadline > apic->lapic_timer.period)) {
                                pr_info_ratelimited(
                                    "vcpu %i: requested lapic timer restore with "