Skip to contentSkip to conversation

linux-2.6.18/pciback: disable MSI/MSI-X when resetting device

PATCH New Jan Beulich 1 participant 1 message Feb 10, 2011 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/pciback: disable MSI/MSI-X when resetting device

From: Konrad Rzeszutek Wilk <[email protected]>

In cases where the guest is abruptly killed and has not disabled MSI/MSI-X interrupts we want to do that.

Otherwise when the guest is started up and enables MSI, we would get a WARN() that the device already had been enabled.

drivers/xen/pciback/pciback_ops.c +8 -0
@@ -22,6 +22,14 @@ void pciback_reset_device(struct pci_dev
 
 	/* Disable devices (but not bridges) */
 	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
+#ifdef CONFIG_PCI_MSI
+		/* The guest could have been abruptly killed without
+		 * disabling MSI/MSI-X interrupts.*/
+		if (dev->msix_enabled)
+			pci_disable_msix(dev);
+		if (dev->msi_enabled)
+			pci_disable_msi(dev);
+#endif
 		pci_disable_device(dev);
 
 		pci_write_config_word(dev, PCI_COMMAND, 0);

From: Konrad Rzeszutek Wilk <[email protected]>
Subject: xen/pciback: disable MSI/MSI-X when resetting device

In cases where the guest is abruptly killed and has not disabled MSI/MSI-X interrupts we want to do that.

Otherwise when the guest is started up and enables MSI, we would get a WARN() that the device already had been enabled.

drivers/xen/pciback/pciback_ops.c +8 -0
@@ -22,6 +22,14 @@ void pciback_reset_device(struct pci_dev
 
 	/* Disable devices (but not bridges) */
 	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
+#ifdef CONFIG_PCI_MSI
+		/* The guest could have been abruptly killed without
+		 * disabling MSI/MSI-X interrupts.*/
+		if (dev->msix_enabled)
+			pci_disable_msix(dev);
+		if (dev->msi_enabled)
+			pci_disable_msi(dev);
+#endif
 		pci_disable_device(dev);
 
 		pci_write_config_word(dev, PCI_COMMAND, 0);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel