]> xenbits.xen.org Git - xenclient/ioemu.git/commitdiff
passthrugh: Fix double unbinding of INTx interrupt when PCI device hot-removed
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 31 Mar 2009 10:46:09 +0000 (11:46 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 31 Mar 2009 10:46:09 +0000 (11:46 +0100)
This patch fixes double unbinding of INTx interrupt when PCI device is
hot-removed.

Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
hw/pass-through.c
hw/pt-msi.c

index 720c9e69dc8a3da8e34503d28846c872161693e3..95b4a472bb23dc743ac13bdb9672d828ab25b0e7 100644 (file)
@@ -1867,6 +1867,20 @@ static void pt_reset_interrupt_and_io_mapping(struct pt_dev *ptdev)
     PCIDevice *d = &ptdev->dev;
     PCIIORegion *r;
     int i = 0;
+    uint8_t e_device = 0;
+    uint8_t e_intx = 0;
+
+    /* unbind INTx */
+    e_device = (ptdev->dev.devfn >> 3) & 0x1f;
+    /* fix virtual interrupt pin to INTA# */
+    e_intx = 0;
+
+    if (ptdev->msi_trans_en == 0 && ptdev->machine_irq)
+    {
+        if (xc_domain_unbind_pt_irq(xc_handle, domid, ptdev->machine_irq,
+                        PT_IRQ_TYPE_PCI, 0, e_device, e_intx, 0))
+            PT_LOG("Error: Unbinding of interrupt failed!\n");
+    }
 
     /* disable MSI/MSI-X and MSI-INTx translation */
     if (ptdev->msi)
index 887f0a2499f621f16c17e0ffc3f03ae9c88d6465..d28038a126d09182a1b049e79fc606dfe056fc44 100644 (file)
@@ -187,13 +187,6 @@ void pt_msi_disable(struct pt_dev *dev)
             goto out;
         }
     }
-    /* unbind INTx */
-    if (dev->msi_trans_cap && !dev->msi_trans_en)
-    {
-        if (xc_domain_unbind_pt_irq(xc_handle, domid, dev->machine_irq,
-                        PT_IRQ_TYPE_PCI, 0, e_device, e_intx, 0))
-            PT_LOG("Error: Unbinding of interrupt failed!\n");
-    }
 
 out:
     /* clear msi info */