From: Randy Dunlap <rdunlap@xenotime.net>

Add a system-wide "disable MSI interrupts" option.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
---
 Documentation/kernel-parameters.txt |    4 ++++
 drivers/pci/Kconfig                 |    4 ++++
 drivers/pci/msi.c                   |   11 +++++++++++
 drivers/pci/pci.c                   |    7 +++++--
 drivers/pci/pci.h                   |    2 ++
 5 files changed, 26 insertions(+), 2 deletions(-)

--- linux-2616-rc4.orig/Documentation/kernel-parameters.txt
+++ linux-2616-rc4/Documentation/kernel-parameters.txt
@@ -49,6 +49,7 @@ restrictions referred to are that the re
 	MCA	MCA bus support is enabled.
 	MDA	MDA console support is enabled.
 	MOUSE	Appropriate mouse support is enabled.
+	MSI	Message Signaled Interrupts (PCI).
 	MTD	MTD support is enabled.
 	NET	Appropriate network support is enabled.
 	NUMA	NUMA support is enabled.
@@ -1135,6 +1136,9 @@ running once the system is up.
 				Mechanism 2.
 		nommconf	[IA-32,X86_64] Disable use of MMCONFIG for PCI
 				Configuration
+		nomsi		[MSI] If the PCI_MSI kernel config parameter is
+				enabled, this kernel boot option can be used to
+				disable the use of MSI interrupts system-wide.
 		nosort		[IA-32] Don't sort PCI devices according to
 				order given by the PCI BIOS. This sorting is
 				done to get a device order compatible with
--- linux-2616-rc4.orig/drivers/pci/Kconfig
+++ linux-2616-rc4/drivers/pci/Kconfig
@@ -11,6 +11,10 @@ config PCI_MSI
 	   generate an interrupt using an inbound Memory Write on its
 	   PCI bus instead of asserting a device IRQ pin.
 
+	   Use of PCI MSI interrupts can be disabled at kernel boot time
+	   by using the 'pci=nomsi' option.  This disables MSI for the
+	   entire system.
+
 	   If you don't know what to do here, say N.
 
 config PCI_LEGACY_PROC
--- linux-2616-rc4.orig/drivers/pci/msi.c
+++ linux-2616-rc4/drivers/pci/msi.c
@@ -755,6 +755,9 @@ void pci_disable_msi(struct pci_dev* dev
 	u16 control;
 	unsigned long flags;
 
+	if (!pci_msi_enable)
+ 		return;
+
    	if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSI)))
 		return;
 
@@ -1006,6 +1009,9 @@ void pci_disable_msix(struct pci_dev* de
 	int pos, temp;
 	u16 control;
 
+	if (!pci_msi_enable)
+ 		return;
+
    	if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)))
 		return;
 
@@ -1123,6 +1129,11 @@ void msi_remove_pci_irq_vectors(struct p
 	}
 }
 
+void pci_no_msi(void)
+{
+	pci_msi_enable = 0;
+}
+
 EXPORT_SYMBOL(pci_enable_msi);
 EXPORT_SYMBOL(pci_disable_msi);
 EXPORT_SYMBOL(pci_enable_msix);
--- linux-2616-rc4.orig/drivers/pci/pci.c
+++ linux-2616-rc4/drivers/pci/pci.c
@@ -900,8 +900,11 @@ static int __devinit pci_setup(char *str
 		if (k)
 			*k++ = 0;
 		if (*str && (str = pcibios_setup(str)) && *str) {
-			/* PCI layer options should be handled here */
-			printk(KERN_ERR "PCI: Unknown option `%s'\n", str);
+			if (!strcmp(str, "nomsi"))
+				pci_no_msi();
+			else
+				printk(KERN_ERR "PCI: Unknown option `%s'\n",
+						str);
 		}
 		str = k;
 	}
--- linux-2616-rc4.orig/drivers/pci/pci.h
+++ linux-2616-rc4/drivers/pci/pci.h
@@ -50,8 +50,10 @@ extern int pci_msi_quirk;
 
 #ifdef CONFIG_PCI_MSI
 void disable_msi_mode(struct pci_dev *dev, int pos, int type);
+void pci_no_msi(void);
 #else
 static inline void disable_msi_mode(struct pci_dev *dev, int pos, int type) { }
+static inline void pci_no_msi(void) { }
 #endif
 
 extern int pcie_mch_quirk;
