linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code
  2015-08-18 21:13 [PATCH 0/2] Disable MSI/MSI-X interrupts manually at PCI probe time in PowerPC architecture Guilherme G. Piccoli
@ 2015-08-18 21:13 ` Guilherme G. Piccoli
  2015-08-19  0:44   ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Guilherme G. Piccoli @ 2015-08-18 21:13 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: gpiccoli, gwshan, benh, paulus, mpe

Commit 1851617cd2 ("PCI/MSI: Disable MSI at enumeration even if kernel
doesn't support MSI") changed the location of the code that disables
MSI/MSI-X interrupts at PCI probe time in devices that have this flag set.
It moved the code from pci_msi_init_pci_dev() to a new function named
pci_msi_setup_pci_dev(), called by pci_setup_device().

Since then, the pSeries platform of the powerpc architecture needs to
disable MSI at PCI probe time manually, as the code flow doesn't
reach pci_setup_device(). For doing so, it wants to call
pci_msi_setup_pci_dev(). This patch makes the required function
non-static, so that it will be called on PCI probe path on powerpc pSeries
platform in next patch.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
---
 drivers/pci/probe.c | 2 +-
 include/linux/pci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index cefd636..520c5b6 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1103,7 +1103,7 @@ int pci_cfg_space_size(struct pci_dev *dev)
 
 #define LEGACY_IO_RESOURCE	(IORESOURCE_IO | IORESOURCE_PCI_FIXED)
 
-static void pci_msi_setup_pci_dev(struct pci_dev *dev)
+void pci_msi_setup_pci_dev(struct pci_dev *dev)
 {
 	/*
 	 * Disable the MSI hardware to avoid screaming interrupts
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8a0321a..860c751 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1202,6 +1202,7 @@ struct msix_entry {
 	u16	entry;	/* driver uses to specify entry, OS writes */
 };
 
+void pci_msi_setup_pci_dev(struct pci_dev *dev);
 
 #ifdef CONFIG_PCI_MSI
 int pci_msi_vec_count(struct pci_dev *dev);
-- 
2.1.0

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

* Re: [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code
  2015-08-18 21:13 ` [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Guilherme G. Piccoli
@ 2015-08-19  0:44   ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-08-19  0:44 UTC (permalink / raw)
  To: Guilherme G. Piccoli; +Cc: linuxppc-dev, gwshan, benh, paulus

Hi Guilherme,

Thanks for the patches.

On Tue, 2015-08-18 at 18:13 -0300, Guilherme G. Piccoli wrote:
> Commit 1851617cd2 ("PCI/MSI: Disable MSI at enumeration even if kernel
> doesn't support MSI") changed the location of the code that disables
> MSI/MSI-X interrupts at PCI probe time in devices that have this flag set.
> It moved the code from pci_msi_init_pci_dev() to a new function named
> pci_msi_setup_pci_dev(), called by pci_setup_device().

OK.

> Since then, the pSeries platform of the powerpc architecture needs to
> disable MSI at PCI probe time manually, as the code flow doesn't
> reach pci_setup_device(). 
>
> For doing so, it wants to call
> pci_msi_setup_pci_dev(). This patch makes the required function
> non-static, so that it will be called on PCI probe path on powerpc pSeries
> platform in next patch.

I didn't follow that entirely, I think you mean something like:

  The pseries PCI probing code does not call pci_setup_device(), so since
  commit 1851617cd2 pci_msi_setup_pci_dev() is not called and MSIs are left
  enabled, which is a bug.

  To fix this the pseries PCI probe should manually call
  pci_msi_setup_pci_dev(), so make it non-static.


Does that look OK?

Also you haven't CC'ed the original author of the commit, or the PCI
maintainer, or the relevant lists.

That would be:

    Michael S. Tsirkin <mst@redhat.com>
    Bjorn Helgaas <bhelgaas@google.com>
    linux-pci@vger.kernel.org
    linux-kernel@vger.kernel.org


And finally both patches should have a fixes line, such as:

Fixes: 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI")

cheers

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

* [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code
@ 2015-08-24 12:42 Michael Ellerman
  2015-08-24 12:42 ` [PATCH 2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case Michael Ellerman
  2015-08-26 12:23 ` [1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-08-24 12:42 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linux-pci, gpiccoli, bhelgaas, mst

From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>

Commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel
doesn't support MSI") changed the location of the code that initialises
dev->msi_cap/msix_cap and then disables MSI/MSI-X interrupts at PCI
probe time in devices that have this flag set. It moved the code from
pci_msi_init_pci_dev() to a new function named pci_msi_setup_pci_dev(),
called by pci_setup_device().

The pseries PCI probing code does not call pci_setup_device(), so since
the aforementioned commit the function pci_msi_setup_pci_dev() is not
called and MSI/MSI-X interrupts are left enabled. Additionally because
dev->msi_cap/msix_cap are not initialised no driver can ever enable
MSI/MSI-X.

To fix this, the pseries PCI probe should manually call
pci_msi_setup_pci_dev(), so this patch makes it non-static.

Fixes: 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI")
[mpe: Update change log to mention dev->msi_cap/msix_cap]
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 drivers/pci/probe.c | 2 +-
 include/linux/pci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)


Bjorn, I plan to put this series in my fixes branch and ask Linus to pull it
before the 4.2 release. Unless you want to take it.

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b978bbfe044c..f6ae0d0052eb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1108,7 +1108,7 @@ int pci_cfg_space_size(struct pci_dev *dev)
 
 #define LEGACY_IO_RESOURCE	(IORESOURCE_IO | IORESOURCE_PCI_FIXED)
 
-static void pci_msi_setup_pci_dev(struct pci_dev *dev)
+void pci_msi_setup_pci_dev(struct pci_dev *dev)
 {
 	/*
 	 * Disable the MSI hardware to avoid screaming interrupts
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8a0321a8fb59..860c751810fc 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1202,6 +1202,7 @@ struct msix_entry {
 	u16	entry;	/* driver uses to specify entry, OS writes */
 };
 
+void pci_msi_setup_pci_dev(struct pci_dev *dev);
 
 #ifdef CONFIG_PCI_MSI
 int pci_msi_vec_count(struct pci_dev *dev);
-- 
2.1.4

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

* [PATCH 2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case
  2015-08-24 12:42 [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
@ 2015-08-24 12:42 ` Michael Ellerman
  2015-08-26 12:23   ` [2/2] " Michael Ellerman
  2015-08-26 12:23 ` [1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2015-08-24 12:42 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linux-pci, gpiccoli, bhelgaas, mst

From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>

Since commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if
kernel doesn't support MSI"), the setup of dev->msi_cap/msix_cap and the
disable of MSI/MSI-X interrupts isn't being done at PCI probe time, as
the logic responsible for this was moved in the aforementioned commit
from pci_device_add() to pci_setup_device(). The latter function is not
reachable on PowerPC pseries platform during Open Firmware PCI probing
time.

This exhibits as drivers not being able to enable MSI, eg:

  bnx2x 0000:01:00.0: no msix capability found

This patch calls pci_msi_setup_pci_dev() explicitly to disable MSI/MSI-X
during PCI probe time on pSeries platform.

Fixes: 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI")
[mpe: Flesh out change log and clarify comment]
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/pci_of_scan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 42e02a2d570b..efc3fa54c90b 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -191,6 +191,9 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 
 	pci_device_add(dev, bus);
 
+	/* Setup MSI caps & disable MSI/MSI-X interrupts */
+	pci_msi_setup_pci_dev(dev);
+
 	return dev;
 }
 EXPORT_SYMBOL(of_create_pci_dev);
-- 
2.1.4

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

* Re: [1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code
  2015-08-24 12:42 [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
  2015-08-24 12:42 ` [PATCH 2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case Michael Ellerman
@ 2015-08-26 12:23 ` Michael Ellerman
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-08-26 12:23 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: bhelgaas, linux-pci, mst, gpiccoli

On Mon, 2015-24-08 at 12:42:46 UTC, Michael Ellerman wrote:
> From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
> 
> Commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel
> doesn't support MSI") changed the location of the code that initialises
> dev->msi_cap/msix_cap and then disables MSI/MSI-X interrupts at PCI
> probe time in devices that have this flag set. It moved the code from
> pci_msi_init_pci_dev() to a new function named pci_msi_setup_pci_dev(),
> called by pci_setup_device().
> 
> The pseries PCI probing code does not call pci_setup_device(), so since
> the aforementioned commit the function pci_msi_setup_pci_dev() is not
> called and MSI/MSI-X interrupts are left enabled. Additionally because
> dev->msi_cap/msix_cap are not initialised no driver can ever enable
> MSI/MSI-X.
> 
> To fix this, the pseries PCI probe should manually call
> pci_msi_setup_pci_dev(), so this patch makes it non-static.
> 
> Fixes: 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI")
> [mpe: Update change log to mention dev->msi_cap/msix_cap]
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/22b6839b914bbe5d94de11bb

cheers

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

* Re: [2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case
  2015-08-24 12:42 ` [PATCH 2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case Michael Ellerman
@ 2015-08-26 12:23   ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-08-26 12:23 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: bhelgaas, linux-pci, mst, gpiccoli

On Mon, 2015-24-08 at 12:42:47 UTC, Michael Ellerman wrote:
> From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
> 
> Since commit 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if
> kernel doesn't support MSI"), the setup of dev->msi_cap/msix_cap and the
> disable of MSI/MSI-X interrupts isn't being done at PCI probe time, as
> the logic responsible for this was moved in the aforementioned commit
> from pci_device_add() to pci_setup_device(). The latter function is not
> reachable on PowerPC pseries platform during Open Firmware PCI probing
> time.
> 
> This exhibits as drivers not being able to enable MSI, eg:
> 
>   bnx2x 0000:01:00.0: no msix capability found
> 
> This patch calls pci_msi_setup_pci_dev() explicitly to disable MSI/MSI-X
> during PCI probe time on pSeries platform.
> 
> Fixes: 1851617cd2da ("PCI/MSI: Disable MSI at enumeration even if kernel doesn't support MSI")
> [mpe: Flesh out change log and clarify comment]
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/4d9aac397a5d8f4ee26a4178

cheers

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

end of thread, other threads:[~2015-08-26 12:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 12:42 [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
2015-08-24 12:42 ` [PATCH 2/2] powerpc/PCI: Disable MSI/MSI-X interrupts at PCI probe time in OF case Michael Ellerman
2015-08-26 12:23   ` [2/2] " Michael Ellerman
2015-08-26 12:23 ` [1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2015-08-18 21:13 [PATCH 0/2] Disable MSI/MSI-X interrupts manually at PCI probe time in PowerPC architecture Guilherme G. Piccoli
2015-08-18 21:13 ` [PATCH 1/2] PCI: Make pci_msi_setup_pci_dev() non-static for use by arch code Guilherme G. Piccoli
2015-08-19  0:44   ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).