All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <rrichter@cavium.com>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Stuart Yoder <stuyoder@gmail.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Will Deacon <will.deacon@arm.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	"Richter, Robert" <Robert.Richter@cavium.com>
Subject: [PATCH 05/10] fsl-mc/dprc-driver: Remove domain init order dependencies
Date: Wed, 7 Nov 2018 22:03:24 +0000	[thread overview]
Message-ID: <20181107220254.6116-6-rrichter@cavium.com> (raw)
In-Reply-To: <20181107220254.6116-1-rrichter@cavium.com>

Use new irq_domain_request_host_*() interface which allows independent
parent and child initialization using an irq domain request handler.
This makes it possible to move its initialization to a later point
during boot. All domains can be initialized in the same initcall level
then.

Signed-off-by: Robert Richter <rrichter@cavium.com>
---
 drivers/bus/fsl-mc/dprc-driver.c | 41 ++++++++++++++++++++++++++++++++++++++++
 drivers/bus/fsl-mc/fsl-mc-msi.c  |  6 +-----
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 52c7e15143d6..2f41886c8e00 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -10,7 +10,9 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/irqdomain.h>
 #include <linux/msi.h>
+#include <linux/of.h>
 #include <linux/fsl/mc.h>
 
 #include "fsl-mc-private.h"
@@ -575,6 +577,40 @@ static int dprc_setup_irq(struct fsl_mc_device *mc_dev)
 	return error;
 }
 
+static int dprc_probe(struct fsl_mc_device *mc_dev);
+
+static int dprc_probe_late(struct irq_domain *parent, void *priv)
+{
+	struct fsl_mc_device *mc_dev = priv;
+
+	of_node_put(mc_dev->dev.parent->of_node);
+	of_node_put(irq_domain_get_of_node(parent));
+
+	return dprc_probe(mc_dev);
+}
+
+static int dprc_register_msi_domain(struct fsl_mc_device *mc_dev)
+{
+	struct device_node *mc_of_node, *msi_np;
+	int err = -EINVAL;
+
+	mc_of_node = of_node_get(mc_dev->dev.parent->of_node);
+
+	msi_np = of_parse_phandle(mc_of_node, "msi-parent", 0);
+	if (msi_np && !of_property_read_bool(msi_np, "#msi-cells"))
+		err = irq_domain_request_host(msi_np, DOMAIN_BUS_FSL_MC_MSI,
+			dprc_probe_late, mc_dev);
+
+	if (err) {
+		pr_err("Unable to find fsl-mc MSI domain for %pOF\n",
+			mc_of_node);
+		of_node_put(msi_np);
+		of_node_put(mc_of_node);
+	}
+
+	return err;
+}
+
 /**
  * dprc_probe - callback invoked when a DPRC is being bound to this driver
  *
@@ -641,6 +677,11 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 
 		error = fsl_mc_find_msi_domain(parent_dev,
 					       &mc_msi_domain);
+
+		if (error == -ENOENT)
+			/* initialize later */
+			return dprc_register_msi_domain(mc_dev);
+
 		if (error < 0) {
 			dev_warn(&mc_dev->dev,
 				 "WARNING: MC bus without interrupt support\n");
diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c
index 8b9c66d7c4ff..550d2ed07f69 100644
--- a/drivers/bus/fsl-mc/fsl-mc-msi.c
+++ b/drivers/bus/fsl-mc/fsl-mc-msi.c
@@ -185,12 +185,8 @@ int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
 
 	msi_domain = of_msi_get_domain(mc_platform_dev, mc_of_node,
 				       DOMAIN_BUS_FSL_MC_MSI);
-	if (!msi_domain) {
-		pr_err("Unable to find fsl-mc MSI domain for %pOF\n",
-		       mc_of_node);
-
+	if (!msi_domain)
 		return -ENOENT;
-	}
 
 	*mc_msi_domain = msi_domain;
 	return 0;
-- 
2.11.0


WARNING: multiple messages have this Message-ID (diff)
From: rrichter@cavium.com (Robert Richter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/10] fsl-mc/dprc-driver: Remove domain init order dependencies
Date: Wed, 7 Nov 2018 22:03:24 +0000	[thread overview]
Message-ID: <20181107220254.6116-6-rrichter@cavium.com> (raw)
In-Reply-To: <20181107220254.6116-1-rrichter@cavium.com>

Use new irq_domain_request_host_*() interface which allows independent
parent and child initialization using an irq domain request handler.
This makes it possible to move its initialization to a later point
during boot. All domains can be initialized in the same initcall level
then.

Signed-off-by: Robert Richter <rrichter@cavium.com>
---
 drivers/bus/fsl-mc/dprc-driver.c | 41 ++++++++++++++++++++++++++++++++++++++++
 drivers/bus/fsl-mc/fsl-mc-msi.c  |  6 +-----
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 52c7e15143d6..2f41886c8e00 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -10,7 +10,9 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/irqdomain.h>
 #include <linux/msi.h>
+#include <linux/of.h>
 #include <linux/fsl/mc.h>
 
 #include "fsl-mc-private.h"
@@ -575,6 +577,40 @@ static int dprc_setup_irq(struct fsl_mc_device *mc_dev)
 	return error;
 }
 
+static int dprc_probe(struct fsl_mc_device *mc_dev);
+
+static int dprc_probe_late(struct irq_domain *parent, void *priv)
+{
+	struct fsl_mc_device *mc_dev = priv;
+
+	of_node_put(mc_dev->dev.parent->of_node);
+	of_node_put(irq_domain_get_of_node(parent));
+
+	return dprc_probe(mc_dev);
+}
+
+static int dprc_register_msi_domain(struct fsl_mc_device *mc_dev)
+{
+	struct device_node *mc_of_node, *msi_np;
+	int err = -EINVAL;
+
+	mc_of_node = of_node_get(mc_dev->dev.parent->of_node);
+
+	msi_np = of_parse_phandle(mc_of_node, "msi-parent", 0);
+	if (msi_np && !of_property_read_bool(msi_np, "#msi-cells"))
+		err = irq_domain_request_host(msi_np, DOMAIN_BUS_FSL_MC_MSI,
+			dprc_probe_late, mc_dev);
+
+	if (err) {
+		pr_err("Unable to find fsl-mc MSI domain for %pOF\n",
+			mc_of_node);
+		of_node_put(msi_np);
+		of_node_put(mc_of_node);
+	}
+
+	return err;
+}
+
 /**
  * dprc_probe - callback invoked when a DPRC is being bound to this driver
  *
@@ -641,6 +677,11 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 
 		error = fsl_mc_find_msi_domain(parent_dev,
 					       &mc_msi_domain);
+
+		if (error == -ENOENT)
+			/* initialize later */
+			return dprc_register_msi_domain(mc_dev);
+
 		if (error < 0) {
 			dev_warn(&mc_dev->dev,
 				 "WARNING: MC bus without interrupt support\n");
diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c
index 8b9c66d7c4ff..550d2ed07f69 100644
--- a/drivers/bus/fsl-mc/fsl-mc-msi.c
+++ b/drivers/bus/fsl-mc/fsl-mc-msi.c
@@ -185,12 +185,8 @@ int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
 
 	msi_domain = of_msi_get_domain(mc_platform_dev, mc_of_node,
 				       DOMAIN_BUS_FSL_MC_MSI);
-	if (!msi_domain) {
-		pr_err("Unable to find fsl-mc MSI domain for %pOF\n",
-		       mc_of_node);
-
+	if (!msi_domain)
 		return -ENOENT;
-	}
 
 	*mc_msi_domain = msi_domain;
 	return 0;
-- 
2.11.0

  parent reply	other threads:[~2018-11-07 22:03 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 22:03 [PATCH 00/10] irqdomain, gic-v3-its: Implement late irq domain initialization Robert Richter
2018-11-07 22:03 ` Robert Richter
2018-11-07 22:03 ` [PATCH 01/10] irqdomain: Add interface to request an irq domain Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-08 10:19   ` Julien Thierry
2018-11-08 10:19     ` Julien Thierry
2018-11-08 15:05     ` Richter, Robert
2018-11-08 15:05       ` Richter, Robert
2018-11-09  9:05       ` Julien Thierry
2018-11-09  9:05         ` Julien Thierry
2018-11-12  8:54         ` Richter, Robert
2018-11-12  8:54           ` Richter, Robert
2018-11-07 22:03 ` [PATCH 02/10] irqchip/gic-v3-its-platform-msi: Remove domain init order dependencies Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-07 22:03 ` [PATCH 03/10] irqchip/irq-gic-v3-its-pci-msi: " Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-07 22:03 ` [PATCH 04/10] irqchip/irq-gic-v3-its-fsl-mc-msi: " Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-07 22:03 ` Robert Richter [this message]
2018-11-07 22:03   ` [PATCH 05/10] fsl-mc/dprc-driver: " Robert Richter
2018-11-07 22:03 ` [PATCH 06/10] irqchip/gic-v3-its: Initialize its nodes in probe order Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-07 22:03 ` [PATCH 07/10] irqchip/gic-v3-its: Split probing from its node initialization Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-08 11:25   ` Julien Thierry
2018-11-08 11:25     ` Julien Thierry
2018-11-09  7:58     ` Richter, Robert
2018-11-09  7:58       ` Richter, Robert
2018-11-07 22:03 ` [PATCH 08/10] irqchip/gic-v3-its: Decouple its initialization from gic Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-08 11:26   ` Julien Thierry
2018-11-08 11:26     ` Julien Thierry
2018-11-09  8:09     ` Richter, Robert
2018-11-09  8:09       ` Richter, Robert
2018-11-07 22:03 ` [PATCH 09/10] irqchip/gic-v3-its: Initialize its nodes later Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-07 22:03 ` [PATCH 10/10] irqchip/gic-v3-its: Initialize MSIs with subsys_initcalls Robert Richter
2018-11-07 22:03   ` Robert Richter
2018-11-09 17:19 ` [PATCH 00/10] irqdomain, gic-v3-its: Implement late irq domain initialization John Garry
2018-11-09 17:19   ` John Garry
2018-11-11  9:42   ` Richter, Robert
2018-11-11  9:42     ` Richter, Robert

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=20181107220254.6116-6-rrichter@cavium.com \
    --to=rrichter@cavium.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=Robert.Richter@cavium.com \
    --cc=jason@lakedaemon.net \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=stuyoder@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.