KVM: Avoid redelivery of edge interrupt before next edge
authorGleb Natapov <gleb@redhat.com>
Sun, 5 Jul 2009 15:48:11 +0000 (18:48 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 9 Aug 2009 08:45:49 +0000 (11:45 +0300)
commitb4a2f5e723e4f7df46731106faf9e2405673c073
tree98766bcb94182957b27b9bdd371c742d927da951
parent53a27b39ff4d2492f84b1fdc2f0047175f0b0b93
KVM: Avoid redelivery of edge interrupt before next edge

The check for an edge is broken in current ioapic code. ioapic->irr is
cleared on each edge interrupt by ioapic_service() and this makes
old_irr != ioapic->irr condition in kvm_ioapic_set_irq() to be always
true. The patch fixes the code to properly recognise edge.

Some HW emulation calls set_irq() without level change. If each such
call is propagated to an OS it may confuse a device driver. This is the
case with keyboard device emulation and Windows XP x64  installer on SMP VM.
Each keystroke produce two interrupts (down/up) one interrupt is
submitted to CPU0 and another to CPU1. This confuses Windows somehow
and it ignores keystrokes.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
virt/kvm/ioapic.c