Commit 5116d8f6 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Avi Kivity

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.
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent d3bc2f91
...@@ -110,6 +110,7 @@ struct kvm_memory_slot { ...@@ -110,6 +110,7 @@ struct kvm_memory_slot {
struct kvm_kernel_irq_routing_entry { struct kvm_kernel_irq_routing_entry {
u32 gsi; u32 gsi;
u32 type;
int (*set)(struct kvm_kernel_irq_routing_entry *e, int (*set)(struct kvm_kernel_irq_routing_entry *e,
struct kvm *kvm, int level); struct kvm *kvm, int level);
union { union {
......
...@@ -160,7 +160,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin) ...@@ -160,7 +160,8 @@ void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
unsigned gsi = pin; unsigned gsi = pin;
list_for_each_entry(e, &kvm->irq_routing, link) 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) { e->irqchip.pin == pin) {
gsi = e->gsi; gsi = e->gsi;
break; break;
...@@ -259,6 +260,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e, ...@@ -259,6 +260,7 @@ static int setup_routing_entry(struct kvm_kernel_irq_routing_entry *e,
int delta; int delta;
e->gsi = ue->gsi; e->gsi = ue->gsi;
e->type = ue->type;
switch (ue->type) { switch (ue->type) {
case KVM_IRQ_ROUTING_IRQCHIP: case KVM_IRQ_ROUTING_IRQCHIP:
delta = 0; delta = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment