From: tip-bot for Marc Zyngier <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@free-electrons.com, jiang.liu@linux.intel.com,
mingo@kernel.org, grant.likely@linaro.org, robh+dt@kernel.org,
marc.zyngier@arm.com, hpa@zytor.com, tglx@linutronix.de,
frowand.list@gmail.com
Subject: [tip:irq/urgent] of: MSI: Simplify irqdomain lookup
Date: Tue, 26 Jan 2016 07:04:50 -0800 [thread overview]
Message-ID: <tip-14a0db3cdd114da757197193f66786e63649c91e@git.kernel.org> (raw)
In-Reply-To: <1453816347-32720-3-git-send-email-marc.zyngier@arm.com>
Commit-ID: 14a0db3cdd114da757197193f66786e63649c91e
Gitweb: http://git.kernel.org/tip/14a0db3cdd114da757197193f66786e63649c91e
Author: Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Tue, 26 Jan 2016 13:52:26 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 26 Jan 2016 16:00:15 +0100
of: MSI: Simplify irqdomain lookup
So far, when trying to associate a device with its MSI domain,
we first lookup the domain using a MSI token, and if this
doesn't return anything useful, we pick up any domain matching
the same node.
This logic is broken for two reasons:
1) Only the generic MSI code (PCI or platform) sets this token
to PCI/MSI or platform MSI. So we're guaranteed that if there
is something to be found, we will find it with the first call.
2) If we have a convoluted situation where:
- a single node implements both wired and MSI interrupts
- MSI support for that HW hasn't been compiled in
we'll end up using the wired domain for MSIs anyway, and things
break badly.
So let's just remove __of_get_msi_domain, and replace it by a direct
call to irq_find_matching_host, because that's what we really want.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Rob Herring <robh+dt@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Link: http://lkml.kernel.org/r/1453816347-32720-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/of/irq.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 4fa916d..a9ea552 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -680,18 +680,6 @@ u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in)
return __of_msi_map_rid(dev, &msi_np, rid_in);
}
-static struct irq_domain *__of_get_msi_domain(struct device_node *np,
- enum irq_domain_bus_token token)
-{
- struct irq_domain *d;
-
- d = irq_find_matching_host(np, token);
- if (!d)
- d = irq_find_host(np);
-
- return d;
-}
-
/**
* of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
* @dev: device for which the mapping is to be done.
@@ -707,7 +695,7 @@ struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 rid)
struct device_node *np = NULL;
__of_msi_map_rid(dev, &np, rid);
- return __of_get_msi_domain(np, DOMAIN_BUS_PCI_MSI);
+ return irq_find_matching_host(np, DOMAIN_BUS_PCI_MSI);
}
/**
@@ -731,7 +719,7 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
/* Check for a single msi-parent property */
msi_np = of_parse_phandle(np, "msi-parent", 0);
if (msi_np && !of_property_read_bool(msi_np, "#msi-cells")) {
- d = __of_get_msi_domain(msi_np, token);
+ d = irq_find_matching_host(msi_np, token);
if (!d)
of_node_put(msi_np);
return d;
@@ -745,7 +733,7 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
while (!of_parse_phandle_with_args(np, "msi-parent",
"#msi-cells",
index, &args)) {
- d = __of_get_msi_domain(args.np, token);
+ d = irq_find_matching_host(args.np, token);
if (d)
return d;
next prev parent reply other threads:[~2016-01-26 15:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 13:52 [PATCH 0/3] irqdomain fixes for 4.5-rc1 Marc Zyngier
2016-01-26 13:52 ` [PATCH 1/3] irqdomain: Allow domain lookup with DOMAIN_BUS_WIRED token Marc Zyngier
2016-01-26 15:04 ` [tip:irq/urgent] " tip-bot for Marc Zyngier
2016-01-26 15:33 ` [PATCH 1/3] " Thomas Petazzoni
2016-01-26 13:52 ` [PATCH 2/3] of: MSI: Simplify irqdomain lookup Marc Zyngier
2016-01-26 14:49 ` Rob Herring
2016-01-26 15:04 ` tip-bot for Marc Zyngier [this message]
2016-01-26 15:33 ` Thomas Petazzoni
2016-01-26 13:52 ` [PATCH 3/3] base: Export platform_msi_domain_{alloc,free}_irqs Marc Zyngier
2016-01-26 15:05 ` [tip:irq/urgent] base: Export platform_msi_domain_%7Balloc, free%7D_irqs tip-bot for Thomas Petazzoni
2016-01-26 15:36 ` [tip:irq/urgent] base: Export platform_msi_domain_[alloc,free] _irqs tip-bot for Thomas Petazzoni
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=tip-14a0db3cdd114da757197193f66786e63649c91e@git.kernel.org \
--to=tipbot@zytor.com \
--cc=frowand.list@gmail.com \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jiang.liu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mingo@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.petazzoni@free-electrons.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).