Skip to contentSkip to conversation

ioemu: Fix double unbinding of INTx interrupt when PCI device is hot-removed

PATCH New Yuji Shimada 1 participant 1 message Mar 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioemu: Fix double unbinding of INTx interrupt when PCI device is hot-removed

This patch fixes double unbinding of INTx interrupt when PCI device is hot-removed.

Thanks,
--
Yuji Shimada

hw/pass-through.c +14 -0
index a498f62..faa701c 100644
@@ -1858,6 +1858,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)
hw/pt-msi.c +0 -7
index 887f0a2..d28038a 100644
@@ -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 */