Skip to contentSkip to conversation

vfio-pci: Disable INTx after MSI/X teardown

PATCH New Alex Williamson 1 participant 1 message Sep 22, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio-pci: Disable INTx after MSI/X teardown

The MSI/X shutdown path can gratuitously enable INTx, which is not something we want to happen if we're dealing with broken INTx device.

---
 drivers/vfio/pci/vfio_pci_intrs.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/vfio/pci/vfio_pci_intrs.c +7 -0
index 152b438..aa23e9a 100644
@@ -414,6 +414,13 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
 	} else
 		pci_disable_msi(pdev);
 
+	/*
+	 * Both disable paths above use pci_intx_for_msi() to clear DisINTx
+	 * via their shutdown paths.  Restore for NoINTx devices.
+	 */
+	if (vdev->nointx)
+		pci_intx(pdev, 0);
+
 	vdev->irq_type = VFIO_PCI_NUM_IRQS;
 	vdev->num_ctx = 0;
 	kfree(vdev->ctx);