Skip to contentSkip to conversation

Disable MSI also when pcie-octeon.pcie_disable on

PATCH Superseded YunQiang Su 2 participants 2 messages Jan 7, 2019 MIPS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disable MSI also when pcie-octeon.pcie_disable on

From: YunQiang Su <[email protected]>

Octeon has an boot-time option to disable pcie.

Since MSI depends on PCI-E, we should also disable MSI also with this options is on.

---
 arch/mips/pci/msi-octeon.c  | 9 +++++++--
 arch/mips/pci/pcie-octeon.c | 5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)
arch/mips/pci/msi-octeon.c +7 -2
index 2a5bb849b..ed6b2f93d 100644
@@ -45,6 +45,11 @@ static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock);
  */
 static int msi_irq_size;
 
+/*
+ * whether pcie is disabled?
+ */
+extern int octeon_pcie_disabled(void);
+
 /**
  * Called when a driver request MSI interrupts instead of the
  * legacy INT A-D. This routine will allocate multiple interrupts
@@ -395,7 +400,7 @@ int __init octeon_msi_initialize(void)
 	for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++)
 		irq_set_chip_and_handler(irq, msi, handle_simple_irq);
 
-	if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
+	if (octeon_has_feature(OCTEON_FEATURE_PCIE) && !octeon_pcie_disabled()) {
 		if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
 				0, "MSI[0:63]", octeon_msi_interrupt0))
 			panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
@@ -413,7 +418,7 @@ int __init octeon_msi_initialize(void)
 			panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed");
 
 		msi_irq_size = 256;
-	} else if (octeon_is_pci_host()) {
+	} else if (octeon_is_pci_host() && !octeon_pcie_disabled()) {
 		if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
 				0, "MSI[0:15]", octeon_msi_interrupt0))
 			panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
arch/mips/pci/pcie-octeon.c +5 -0
index d919a0d81..16d90290a 100644
@@ -34,6 +34,11 @@
 static int pcie_disable;
 module_param(pcie_disable, int, S_IRUGO);
 
+int octeon_pcie_disabled(void){
+	return pcie_disable;
+}
+EXPORT_SYMBOL(octeon_pcie_disabled);
+
 static int enable_pcie_14459_war;
 static int enable_pcie_bus_num_war[2];
 
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Quoted 18 lines · YunQiang Su

From: YunQiang Su <[email protected]>

Octeon has an boot-time option to disable pcie.

Since MSI depends on PCI-E, we should also disable MSI also with this options is on.

---
 arch/mips/pci/msi-octeon.c  | 9 +++++++--
 arch/mips/pci/pcie-octeon.c | 5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)
arch/mips/pci/msi-octeon.c +0 -0
index 2a5bb849b..ed6b2f93d 100644

arch/mips/pci/msi-octeon.c static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock); · line 51

Quoted 7 lines
arch/mips/pci/msi-octeon.c +4 -0
@@ -45,6 +45,11 @@ static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock);
  */
 static int msi_irq_size;
 
+/*
+ * whether pcie is disabled?
+ */
+extern int octeon_pcie_disabled(void);

No need for this.

Just check if octeon_dma_bar_type is OCTEON_DMA_BAR_TYPE_INVALID at the beginning of octeon_msi_initialize().

A.

Quoted 40 lines
arch/mips/pci/msi-octeon.c +2 -2
 /**
  * Called when a driver request MSI interrupts instead of the
  * legacy INT A-D. This routine will allocate multiple interrupts
@@ -395,7 +400,7 @@ int __init octeon_msi_initialize(void)
 	for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++)
 		irq_set_chip_and_handler(irq, msi, handle_simple_irq);
 
-	if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
+	if (octeon_has_feature(OCTEON_FEATURE_PCIE) && !octeon_pcie_disabled()) {
 		if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
 				0, "MSI[0:63]", octeon_msi_interrupt0))
 			panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
@@ -413,7 +418,7 @@ int __init octeon_msi_initialize(void)
 			panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed");
 
 		msi_irq_size = 256;
-	} else if (octeon_is_pci_host()) {
+	} else if (octeon_is_pci_host() && !octeon_pcie_disabled()) {
 		if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
 				0, "MSI[0:15]", octeon_msi_interrupt0))
 			panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
arch/mips/pci/pcie-octeon.c +5 -0
index d919a0d81..16d90290a 100644
@@ -34,6 +34,11 @@
 static int pcie_disable;
 module_param(pcie_disable, int, S_IRUGO);
 
+int octeon_pcie_disabled(void){
+	return pcie_disable;
+}
+EXPORT_SYMBOL(octeon_pcie_disabled);
+
 static int enable_pcie_14459_war;
 static int enable_pcie_bus_num_war[2];
 
Signature · 1 line
2.20.1