Commit 14a0db3c authored by Marc Zyngier's avatar Marc Zyngier Committed by Thomas Gleixner

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: default avatarMarc Zyngier <marc.zyngier@arm.com>
Acked-by: default avatarRob 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.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 530cbe10
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment