public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens•net>
To: linuxppc-dev@ozlabs•org, benh@kernel•crashing.org, mpe@ellerman•id.au
Cc: Daniel Axtens <dja@axtens•net>
Subject: [PATCH 01/10] powerpc: Add MSI operations to pci_controller_ops struct
Date: Tue, 14 Apr 2015 14:27:54 +1000	[thread overview]
Message-ID: <1428985683-24767-2-git-send-email-dja@axtens.net> (raw)
In-Reply-To: <1428985683-24767-1-git-send-email-dja@axtens.net>

Add MSI setup and teardown functions to pci_controller_ops.

Patch the callsites (arch_{setup,teardown}_msi_irqs) to prefer the
controller ops version if it's available.

Signed-off-by: Daniel Axtens <dja@axtens•net>
---
 arch/powerpc/include/asm/pci-bridge.h |  6 ++++++
 arch/powerpc/kernel/msi.c             | 18 +++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 1811c44..a3b6252 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -30,6 +30,12 @@ struct pci_controller_ops {
 	/* Called during PCI resource reassignment */
 	resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
 	void		(*reset_secondary_bus)(struct pci_dev *dev);
+
+#ifdef CONFIG_PCI_MSI
+	int		(*setup_msi_irqs)(struct pci_dev *dev,
+					  int nvec, int type);
+	void		(*teardown_msi_irqs)(struct pci_dev *dev);
+#endif
 };
 
 /*
diff --git a/arch/powerpc/kernel/msi.c b/arch/powerpc/kernel/msi.c
index 71bd161..3d452f7 100644
--- a/arch/powerpc/kernel/msi.c
+++ b/arch/powerpc/kernel/msi.c
@@ -15,7 +15,11 @@
 
 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
-	if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) {
+	struct pci_controller *phb = pci_bus_to_host(dev->bus);
+
+	if ((!phb->controller_ops.setup_msi_irqs ||
+	     !phb->controller_ops.teardown_msi_irqs) &&
+	    (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs)) {
 		pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
 		return -ENOSYS;
 	}
@@ -24,10 +28,18 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 	if (type == PCI_CAP_ID_MSI && nvec > 1)
 		return 1;
 
-	return ppc_md.setup_msi_irqs(dev, nvec, type);
+	if (phb->controller_ops.setup_msi_irqs)
+		return phb->controller_ops.setup_msi_irqs(dev, nvec, type);
+	else
+		return ppc_md.setup_msi_irqs(dev, nvec, type);
 }
 
 void arch_teardown_msi_irqs(struct pci_dev *dev)
 {
-	ppc_md.teardown_msi_irqs(dev);
+	struct pci_controller *phb = pci_bus_to_host(dev->bus);
+
+	if (phb->controller_ops.teardown_msi_irqs)
+		phb->controller_ops.teardown_msi_irqs(dev);
+	else
+		ppc_md.teardown_msi_irqs(dev);
 }
-- 
2.1.4

  reply	other threads:[~2015-04-14  4:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14  4:27 [PATCH 00/10] Move MSI related PCI controller ops to pci_controller_ops Daniel Axtens
2015-04-14  4:27 ` Daniel Axtens [this message]
2015-04-14  4:27 ` [PATCH 02/10] powerpc/powernv: Move MSI-related " Daniel Axtens
2015-04-14  4:27 ` [PATCH 03/10] powerpc/cell: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 04/10] powerpc/pseries: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 05/10] powerpc/fsl_msi: " Daniel Axtens
2015-04-14  4:27 ` [PATCH 06/10] powerpc/ppc4xx_msi: " Daniel Axtens
2015-04-14  4:28 ` [PATCH 07/10] powerpc/ppc4xx_hsta_msi: " Daniel Axtens
2015-04-14  4:28 ` [PATCH 08/10] powerpc/mpic_pasemi_msi: " Daniel Axtens
2015-07-07 10:50   ` PASEMI: PA6T board doesn't boot with the RC1 of kernel 4.2 anymore Christian Zigotzky
2015-07-07 11:25     ` Christian Zigotzky
2015-07-07 12:44       ` Christian Zigotzky
2015-07-08 18:00         ` Christian Zigotzky
2015-07-08 22:36           ` Benjamin Herrenschmidt
2015-07-09  1:42             ` Michael Ellerman
2015-07-09  5:19               ` Christian Zigotzky
2015-07-09  7:07                 ` Michael Ellerman
2015-07-09  7:53               ` Benjamin Herrenschmidt
2015-07-09  8:50                 ` Christian Zigotzky
2015-07-09  9:12                 ` Christian Zigotzky
2015-07-09  9:52                   ` Denis Kirjanov
2015-07-09 10:37                     ` Christian Zigotzky
2015-07-13  6:47                     ` Benjamin Herrenschmidt
2015-07-13  9:33                       ` Denis Kirjanov
2015-07-09 22:27           ` Christian Zigotzky
2015-07-10  6:51             ` Christian Zigotzky
2015-07-13  6:44             ` Benjamin Herrenschmidt
2015-04-14  4:28 ` [PATCH 09/10] powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops Daniel Axtens
2015-04-14  4:28 ` [PATCH 10/10] powerpc: Remove MSI-related PCI controller ops from ppc_md Daniel Axtens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428985683-24767-2-git-send-email-dja@axtens.net \
    --to=dja@axtens$(echo .)net \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=mpe@ellerman$(echo .)id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox