Skip to contentSkip to conversation

kvm: fix ack not being delivered when msi present

PATCH New Michael S. Tsirkin 1 participant 1 message Jul 28, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: fix ack not being delivered when msi present

kvm_notify_acked_irq does not check irq type, so that it sometimes interprets msi vector as irq. As a result, ack notifiers are not called, which typially hangs the guest. The fix is to track and check irq type.

---

Here's the patch for 2.6.30.x (simply applied with git am -3)

 include/linux/kvm_host.h |    1 +
 virt/kvm/irq_comm.c      |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
include/linux/kvm_host.h +1 -0
index 894a56e..ab10115 100644
@@ -110,6 +110,7 @@ struct kvm_memory_slot {
 
 struct kvm_kernel_irq_routing_entry {
 	u32 gsi;
+	u32 type;
 	int (*set)(struct kvm_kernel_irq_routing_entry *e,
 		    struct kvm *kvm, int level);
 	union {
virt/kvm/irq_comm.c +3 -1
index 864ac54..8f2018a 100644
@@ -141,7 +141,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
 	unsigned gsi = pin;
 
 	list_for_each_entry(e, &kvm->irq_routing, link)
-		if (e->irqchip.irqchip == irqchip &&
+		if (e->type == KVM_IRQ_ROUTING_IRQCHIP &&
+		    e->irqchip.irqchip == irqchip &&
 		    e->irqchip.pin == pin) {
 			gsi = e->gsi;
 			break;
@@ -240,6 +241,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
 	int delta;
 
 	e->gsi = ue->gsi;
+	e->type = ue->type;
 	switch (ue->type) {
 	case KVM_IRQ_ROUTING_IRQCHIP:
 		delta = 0;
Signature · 1 line
1.6.3.2.g54cf