diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-03-18 06:39:23 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-03-21 10:10:43 -0400 |
commit | 673f7b4257a1fe7b181e1a1182ecc2b6b2b795f1 (patch) | |
tree | aa47a8e993bcef11b663f3ad1180ee39ac36511f /virt/kvm/ioapic.c | |
parent | 44847dea79751e95665a439f8c63a65e51da8e1f (diff) |
KVM: ioapic: reinject pending interrupts on KVM_SET_IRQCHIP
After the previous patches, an interrupt whose bit is set in the IRR
register will never be in the LAPIC's IRR and has never been injected
on the migration source. So inject it on the destination.
This fixes migration of Windows guests without HPET (they use the RTC
to trigger the scheduler tick, and lose it after migration).
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r-- | virt/kvm/ioapic.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 270f7fe73f39..d4b601547f1f 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -212,6 +212,18 @@ out: | |||
212 | return ret; | 212 | return ret; |
213 | } | 213 | } |
214 | 214 | ||
215 | static void kvm_ioapic_inject_all(struct kvm_ioapic *ioapic, unsigned long irr) | ||
216 | { | ||
217 | u32 idx; | ||
218 | |||
219 | rtc_irq_eoi_tracking_reset(ioapic); | ||
220 | for_each_set_bit(idx, &irr, IOAPIC_NUM_PINS) | ||
221 | ioapic_set_irq(ioapic, idx, 1, true); | ||
222 | |||
223 | kvm_rtc_eoi_tracking_restore_all(ioapic); | ||
224 | } | ||
225 | |||
226 | |||
215 | static void update_handled_vectors(struct kvm_ioapic *ioapic) | 227 | static void update_handled_vectors(struct kvm_ioapic *ioapic) |
216 | { | 228 | { |
217 | DECLARE_BITMAP(handled_vectors, 256); | 229 | DECLARE_BITMAP(handled_vectors, 256); |
@@ -612,9 +624,10 @@ int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state) | |||
612 | 624 | ||
613 | spin_lock(&ioapic->lock); | 625 | spin_lock(&ioapic->lock); |
614 | memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); | 626 | memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); |
627 | ioapic->irr = 0; | ||
615 | update_handled_vectors(ioapic); | 628 | update_handled_vectors(ioapic); |
616 | kvm_vcpu_request_scan_ioapic(kvm); | 629 | kvm_vcpu_request_scan_ioapic(kvm); |
617 | kvm_rtc_eoi_tracking_restore_all(ioapic); | 630 | kvm_ioapic_inject_all(ioapic, state->irr); |
618 | spin_unlock(&ioapic->lock); | 631 | spin_unlock(&ioapic->lock); |
619 | return 0; | 632 | return 0; |
620 | } | 633 | } |