Blob Blame Raw
From 14bdd0d36f5284108468bb73afd50726b07c7a84 Mon Sep 17 00:00:00 2001
From: Kyle McMartin <kyle@phobos.i.jkkm.org>
Date: Mon, 29 Mar 2010 23:43:49 -0400
Subject: linux-2.6-defaults-pci_no_msi

---
 Documentation/kernel-parameters.txt |    3 +++
 drivers/pci/Kconfig                 |   12 ++++++++++++
 drivers/pci/msi.c                   |    9 +++++++++
 drivers/pci/pci.c                   |    2 ++
 drivers/pci/pci.h                   |    2 ++
 5 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e4cbca5..8154a0f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1911,6 +1911,9 @@ and is between 256 and 4096 characters. It is defined in the file
 		check_enable_amd_mmconf [X86] check for and enable
 				properly configured MMIO access to PCI
 				config space on AMD family 10h CPU
+		msi		[MSI] If the PCI_MSI kernel config parameter is
+				enabled, this kernel boot option can be used to
+				enable the use of MSI interrupts system-wide.
 		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.
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 7858a11..b12fcad 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -21,6 +21,18 @@ config PCI_MSI
 
 	   If you don't know what to do here, say Y.
 
+config PCI_MSI_DEFAULT_ON
+	def_bool y
+	prompt "Use Message Signaled Interrupts by default"
+	depends on PCI_MSI
+	help
+	  Selecting this option will enable use of PCI MSI where applicable
+	  by default. Support for MSI can be disabled through the use of the
+	  pci=nomsi boot flag. Conversely, if this option is not selected,
+	  support for PCI MSI can be enabled by passing the pci=msi flag.
+
+	  If you don't know what to do here, say N.
+
 config PCI_DEBUG
 	bool "PCI Debugging"
 	depends on PCI && DEBUG_KERNEL
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index f9cf317..6b0539a 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -22,7 +22,11 @@
 #include "pci.h"
 #include "msi.h"
 
+#ifdef CONFIG_PCI_MSI_DEFAULT_ON
 static int pci_msi_enable = 1;
+#else
+static int pci_msi_enable = 0;
+#endif /*CONFIG_PCI_MSI_DEFAULT_ON*/
 
 /* Arch hooks */
 
@@ -836,6 +840,11 @@ int pci_msi_enabled(void)
 }
 EXPORT_SYMBOL(pci_msi_enabled);
 
+void pci_yes_msi(void)
+{
+	pci_msi_enable = 1;
+}
+
 void pci_msi_init_pci_dev(struct pci_dev *dev)
 {
 	INIT_LIST_HEAD(&dev->msi_list);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1531f3a..3cb332b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2983,6 +2983,8 @@ static int __init pci_setup(char *str)
 		if (*str && (str = pcibios_setup(str)) && *str) {
 			if (!strcmp(str, "nomsi")) {
 				pci_no_msi();
+			} else if (!strcmp(str, "msi")) {
+				pci_yes_msi();
 			} else if (!strcmp(str, "noaer")) {
 				pci_no_aer();
 			} else if (!strcmp(str, "nodomains")) {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4eb10f4..caa051e 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -122,9 +122,11 @@ extern unsigned int pci_pm_d3_delay;
 
 #ifdef CONFIG_PCI_MSI
 void pci_no_msi(void);
+void pci_yes_msi(void);
 extern void pci_msi_init_pci_dev(struct pci_dev *dev);
 #else
 static inline void pci_no_msi(void) { }
+static inline void pci_yes_msi(void) { }
 static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
 #endif
 
-- 
1.7.0.1