Linux-MIPS Archive on lore.kernel.org
 help / Atom feed
* [PATCH] Disable MSI also when pcie-octeon.pcie_disable on
@ 2019-01-07  2:55 YunQiang Su
  2019-01-07 18:15 ` Aaro Koskinen
  0 siblings, 1 reply; 2+ messages in thread
From: YunQiang Su @ 2019-01-07  2:55 UTC (permalink / raw)
  To: pburton, linux-mips; +Cc: YunQiang Su

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);
+
 /**
  * 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Disable MSI also when pcie-octeon.pcie_disable on
  2019-01-07  2:55 [PATCH] Disable MSI also when pcie-octeon.pcie_disable on YunQiang Su
@ 2019-01-07 18:15 ` Aaro Koskinen
  0 siblings, 0 replies; 2+ messages in thread
From: Aaro Koskinen @ 2019-01-07 18:15 UTC (permalink / raw)
  To: YunQiang Su; +Cc: pburton, linux-mips, YunQiang Su

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07  2:55 [PATCH] Disable MSI also when pcie-octeon.pcie_disable on YunQiang Su
2019-01-07 18:15 ` Aaro Koskinen

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox