linux-kernel.vger.kernel.org archive mirror
 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>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Stuart Yoder <stuyoder@gmail.com>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	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 02/10] irqchip/gic-v3-its-platform-msi: Remove domain init order dependencies
Date: Wed, 7 Nov 2018 22:03:15 +0000	[thread overview]
Message-ID: <20181107220254.6116-3-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/irqchip/irq-gic-v3-its-platform-msi.c | 54 +++++++++++++++++++++------
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c
index 7b8e87b493fe..1f2849bc58c4 100644
--- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c
@@ -94,25 +94,56 @@ static const struct of_device_id its_device_id[] = {
 	{},
 };
 
-static int __init its_pmsi_init_one(struct fwnode_handle *fwnode,
-				const char *name)
+static int __init its_pmsi_create_irq_domain(struct irq_domain *parent,
+					void *priv)
 {
-	struct irq_domain *parent;
+	const char *name = priv;
+	int err = 0;
 
-	parent = irq_find_matching_fwnode(fwnode, DOMAIN_BUS_NEXUS);
-	if (!parent || !msi_get_domain_info(parent)) {
-		pr_err("%s: unable to locate ITS domain\n", name);
-		return -ENXIO;
+	if (!msi_get_domain_info(parent)) {
+		err = -ENODEV;
+		goto out;
 	}
 
-	if (!platform_msi_create_irq_domain(fwnode, &its_pmsi_domain_info,
+	if (!platform_msi_create_irq_domain(parent->fwnode, &its_pmsi_domain_info,
 					    parent)) {
-		pr_err("%s: unable to create platform domain\n", name);
-		return -ENXIO;
+		err = -ENXIO;
+		goto out;
 	}
 
 	pr_info("Platform MSI: %s domain created\n", name);
-	return 0;
+out:
+	if (err)
+		pr_err("Platform MSI: Failed to create %s domain\n", name);
+
+	kfree(name);
+	return err;
+}
+
+static int __init its_pmsi_init_one(struct fwnode_handle *fwnode,
+				const char *name)
+{
+	void *priv = kstrdup(name, GFP_KERNEL);
+	int err;
+
+	if (!name) {
+		err = -EINVAL;
+		goto fail;
+	}
+
+	if (!priv) {
+		err = -ENOMEM;
+		goto fail;
+	}
+
+	err = irq_domain_request_fwnode(fwnode, DOMAIN_BUS_NEXUS,
+					its_pmsi_create_irq_domain, name, priv);
+	if (!err)
+		return 0;
+fail:
+	pr_err("Platform MSI: Failed to register %s domain\n", name);
+	kfree(priv);
+	return err;
 }
 
 #ifdef CONFIG_ACPI
@@ -135,7 +166,6 @@ its_pmsi_parse_madt(struct acpi_subtable_header *header,
 	}
 
 	err = its_pmsi_init_one(domain_handle, node_name);
-
 out:
 	kfree(node_name);
 	return err;
-- 
2.11.0


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

Thread overview: 21+ 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 ` [PATCH 01/10] irqdomain: Add interface to request an irq domain Robert Richter
2018-11-08 10:19   ` Julien Thierry
2018-11-08 15:05     ` Richter, Robert
2018-11-09  9:05       ` Julien Thierry
2018-11-12  8:54         ` Richter, Robert
2018-11-07 22:03 ` Robert Richter [this message]
2018-11-07 22:03 ` [PATCH 03/10] irqchip/irq-gic-v3-its-pci-msi: Remove domain init order dependencies 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 ` [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 ` [PATCH 07/10] irqchip/gic-v3-its: Split probing from its node initialization Robert Richter
2018-11-08 11:25   ` Julien Thierry
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-08 11:26   ` Julien Thierry
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 ` [PATCH 10/10] irqchip/gic-v3-its: Initialize MSIs with subsys_initcalls Robert Richter
2018-11-09 17:19 ` [PATCH 00/10] irqdomain, gic-v3-its: Implement late irq domain initialization John Garry
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-3-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 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).