From a2be65fd363831502afdf0babdf48149b3959cde Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 3 Mar 2010 13:38:43 -0500 Subject: [PATCH] xen/pciback: Disable MSI/MSI-X when reseting a device In cases where the guest is abruptly killed and has not disabled MSI/MSI-X interrupts we want to do it for it. Otherwise when the guest is started up and enables MSI, we would get a WARN() that the device already had been enabled. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/xen-pciback/pciback_ops.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 2b9a93e..011db67 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c @@ -23,6 +23,14 @@ void pciback_reset_device(struct pci_dev *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); -- 2.7.4