Skip to contentSkip to conversation

device-assignment: fix failure to exit on shared IRQ

PATCH Applied Alex Williamson 3 participants 3 messages May 12, 2010 – May 14, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device-assignment: fix failure to exit on shared IRQ

Since c1699988, piix config space isn't programmed until the first system reset. This means that when we call assign_irq() from assigned_initfn(), we're going to get back an irq of 0x0, which unfortunately matches our initialization value, so we don't bother to call kvm_assign_irq(). Switch to a -1 initializer so we can test whether kvm_assign_irq() is going to succeed and allow the process to exit if it doesn't. The guest irq will get reset to a more appropriate value on system reset anyway.

---

 hw/device-assignment.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/device-assignment.c +1 -1
index b9cc06f..eb31c78 100644
@@ -1346,7 +1346,7 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
     e_intx = dev->dev.config[0x3d] - 1;
     dev->intpin = e_intx;
     dev->run = 0;
-    dev->girq = 0;
+    dev->girq = -1;
     dev->h_segnr = dev->host.seg;
     dev->h_busnr = dev->host.bus;
     dev->h_devfn = PCI_DEVFN(dev->host.dev, dev->host.func);
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · * Alex Williamson ([email protected]) wrote:

Since c1699988, piix config space isn't programmed until the first system reset. This means that when we call assign_irq() from assigned_initfn(), we're going to get back an irq of 0x0, which unfortunately matches our initialization value, so we don't bother to call kvm_assign_irq(). Switch to a -1 initializer so we can test whether kvm_assign_irq() is going to succeed and allow the process to exit if it doesn't. The guest irq will get reset to a more appropriate value on system reset anyway.

#2 lore raw
In reply to Alex Williamson
Quoted 10 lines · Alex Williamson

Since c1699988, piix config space isn't programmed until the first system reset. This means that when we call assign_irq() from assigned_initfn(), we're going to get back an irq of 0x0, which unfortunately matches our initialization value, so we don't bother to call kvm_assign_irq(). Switch to a -1 initializer so we can test whether kvm_assign_irq() is going to succeed and allow the process to exit if it doesn't. The guest irq will get reset to a more appropriate value on system reset anyway.

Applied, thanks.