diff mbox series

Disable MSI also when pcie-octeon.pcie_disable on

Message ID 20190107025542.2273-1-syq@debian.org (mailing list archive)
State Superseded
Delegated to: Paul Burton
Headers show
Series Disable MSI also when pcie-octeon.pcie_disable on | expand

Commit Message

YunQiang Su Jan. 7, 2019, 2:55 a.m. UTC
From: YunQiang Su <ysu@wavecomp.com>

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.

Signed-off-by: YunQiang Su <ysu@wavecomp.com>
---
 arch/mips/pci/msi-octeon.c  | 9 +++++++--
 arch/mips/pci/pcie-octeon.c | 5 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Aaro Koskinen Jan. 7, 2019, 6:15 p.m. UTC | #1
Hi,

On Mon, Jan 07, 2019 at 10:55:42AM +0800, YunQiang Su wrote:
> From: YunQiang Su <ysu@wavecomp.com>
> 
> 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.
> 
> Signed-off-by: YunQiang Su <ysu@wavecomp.com>
> ---
>  arch/mips/pci/msi-octeon.c  | 9 +++++++--
>  arch/mips/pci/pcie-octeon.c | 5 +++++
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
> index 2a5bb849b..ed6b2f93d 100644
> --- a/arch/mips/pci/msi-octeon.c
> +++ b/arch/mips/pci/msi-octeon.c
> @@ -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.

>  /**
>   * 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");
> diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
> index d919a0d81..16d90290a 100644
> --- a/arch/mips/pci/pcie-octeon.c
> +++ b/arch/mips/pci/pcie-octeon.c
> @@ -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];
>  
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index 2a5bb849b..ed6b2f93d 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -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");
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index d919a0d81..16d90290a 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -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];