Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1317931

[PATCH 1/3] irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token
Date 2016-01-26 15:00 +0100
Message-ID <qVck2-4Sm-17@gated-at.bofh.it> (permalink)
References <qVck1-4Sm-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Let's take the (outlandish) example of an interrupt controller
capable of handling both wired interrupts and PCI MSIs.

With the current code, the PCI MSI domain is going to be tagged
with DOMAIN_BUS_PCI_MSI, and the wired domain with DOMAIN_BUS_ANY.

Things get hairy when we start looking up the domain for a wired
interrupt (typically when creating it based on some firmware
information - DT or ACPI).

In irq_create_fwspec_mapping(), we perform the lookup using
DOMAIN_BUS_ANY, which is actually used as a wildcard. This gives
us one chance out of two to end up with the wrong domain, and
we try to configure a wired interrupt with the MSI domain.
Everything grinds to a halt pretty quickly.

What we really need to do is to start looking for a domain that
would uniquely identify a wired interrupt domain, and only use
DOMAIN_BUS_ANY as a fallback.

In order to solve this, let's introduce a new DOMAIN_BUS_WIRED
token, which is going to be used exactly as described above.
Of course, this depends on the irqchip to setup the domain
bus_token, and nobody had to implement this so far.

Only so far.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 include/linux/irqdomain.h |  1 +
 kernel/irq/irqdomain.c    | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d5e5c5b..b236d82 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -70,6 +70,7 @@ struct irq_fwspec {
  */
 enum irq_domain_bus_token {
 	DOMAIN_BUS_ANY		= 0,
+	DOMAIN_BUS_WIRED,
 	DOMAIN_BUS_PCI_MSI,
 	DOMAIN_BUS_PLATFORM_MSI,
 	DOMAIN_BUS_NEXUS,
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 22aa961..def2664 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -573,10 +573,15 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
 	unsigned int type = IRQ_TYPE_NONE;
 	int virq;
 
-	if (fwspec->fwnode)
-		domain = irq_find_matching_fwnode(fwspec->fwnode, DOMAIN_BUS_ANY);
-	else
+	if (fwspec->fwnode) {
+		domain = irq_find_matching_fwnode(fwspec->fwnode,
+						  DOMAIN_BUS_WIRED);
+		if (!domain)
+			domain = irq_find_matching_fwnode(fwspec->fwnode,
+							  DOMAIN_BUS_ANY);
+	} else {
 		domain = irq_default_domain;
+	}
 
 	if (!domain) {
 		pr_warn("no irq domain found for %s !\n",
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] irqdomain fixes for 4.5-rc1 Marc Zyngier <marc.zyngier@arm.com> - 2016-01-26 15:00 +0100
  [PATCH 2/3] of: MSI: Simplify irqdomain lookup Marc Zyngier <marc.zyngier@arm.com> - 2016-01-26 15:00 +0100
    Re: [PATCH 2/3] of: MSI: Simplify irqdomain lookup Rob Herring <robh+dt@kernel.org> - 2016-01-26 15:50 +0100
    [tip:irq/urgent] of: MSI: Simplify irqdomain lookup tip-bot for Marc Zyngier <tipbot@zytor.com> - 2016-01-26 16:10 +0100
    Re: [PATCH 2/3] of: MSI: Simplify irqdomain lookup Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-01-26 16:40 +0100
  [PATCH 1/3] irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token Marc Zyngier <marc.zyngier@arm.com> - 2016-01-26 15:00 +0100
    [tip:irq/urgent] irqdomain:   Allow domain lookup with DOMAIN_BUS_WIRED token tip-bot for Marc Zyngier <tipbot@zytor.com> - 2016-01-26 16:10 +0100
    Re: [PATCH 1/3] irqdomain: Allow domain lookup with  DOMAIN_BUS_WIRED token Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-01-26 16:40 +0100
  [PATCH 3/3] base: Export platform_msi_domain_{alloc,free}_irqs Marc Zyngier <marc.zyngier@arm.com> - 2016-01-26 15:00 +0100
    [tip:irq/urgent] base: Export platform_msi_domain_%7Balloc,  free%7D_irqs tip-bot for Thomas Petazzoni <tipbot@zytor.com> - 2016-01-26 16:10 +0100
    [tip:irq/urgent] base: Export platform_msi_domain_[alloc,free]  _irqs tip-bot for Thomas Petazzoni <tipbot@zytor.com> - 2016-01-26 16:40 +0100

csiph-web