From: "Jan Beulich" Subject: [PATCH] linux-2.6.18/pciback: disable MSI/MSI-X when resetting device Date: Thu, 10 Feb 2011 12:15:54 +0000 Message-ID: <4D53E50A02000078000313AF@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4A6659EA.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part4A6659EA.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline From: Konrad Rzeszutek Wilk 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. Signed-off-by: Jan Beulich --- a/drivers/xen/pciback/pciback_ops.c +++ b/drivers/xen/pciback/pciback_ops.c @@ -22,6 +22,14 @@ void pciback_reset_device(struct pci_dev =20 /* Disable devices (but not bridges) */ if (dev->hdr_type =3D=3D 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); =20 pci_write_config_word(dev, PCI_COMMAND, 0); --=__Part4A6659EA.0__= Content-Type: text/plain; name="xen-pciback-reset-msi.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-pciback-reset-msi.patch" From: Konrad Rzeszutek Wilk =0ASubject: xen/pciback= : disable MSI/MSI-X when resetting device=0A=0AIn cases where the guest is = abruptly killed and has not disabled=0AMSI/MSI-X interrupts we want to do = that.=0A=0AOtherwise when the guest is started up and enables MSI, we = would=0Aget a WARN() that the device already had been enabled.=0A=0ASigned-= off-by: Jan Beulich =0A=0A--- a/drivers/xen/pciback/pc= iback_ops.c=0A+++ b/drivers/xen/pciback/pciback_ops.c=0A@@ -22,6 +22,14 @@ = void pciback_reset_device(struct pci_dev=0A =0A /* Disable devices = (but not bridges) */=0A if (dev->hdr_type =3D=3D PCI_HEADER_TYPE_NO= RMAL) {=0A+#ifdef CONFIG_PCI_MSI=0A+ /* The guest could have = been abruptly killed without=0A+ * disabling MSI/MSI-X = interrupts.*/=0A+ if (dev->msix_enabled)=0A+ = pci_disable_msix(dev);=0A+ if (dev->msi_enabled)=0A+ = pci_disable_msi(dev);=0A+#endif=0A pci_disable_device(= dev);=0A =0A pci_write_config_word(dev, PCI_COMMAND, 0);=0A --=__Part4A6659EA.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part4A6659EA.0__=--