Message ID | 543B93B4.3040404@arm.com |
---|---|
State | New |
Headers | show |
On Monday 13 October 2014 09:56:20 Marc Zyngier wrote: > if (irq_domain_is_hierarchy(domain)) { > + if (domain->ops->xlate) { > + /* > + * If we've already configured this interrupt, > + * don't do it again, or hell will break loose. > + */ > + if (domain->ops->xlate(domain, irq_data->np, > + irq_data->args, > + irq_data->args_count, > + &hwirq, &type)) > + return 0; > + > + virq = irq_find_mapping(domain, hwirq); > + if (virq) > + return virq; > + } > virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); > return virq <= 0 ? 0 : virq; > } > > Thoughts? Using irq_find_mapping() first is probably the right approach, that is what irq_create_mapping() does too, and I suppose we want those to be symmetric. mt_sysirq_domain_alloc() in patch 4 has the irq_find_domain check in it, which I guess we can remove when it has moved to the common code. I don't see irq_domain_alloc_irqs() in linux-next or older kernels, where does that get introduced? Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 13/10/14 10:27, Arnd Bergmann wrote: > On Monday 13 October 2014 09:56:20 Marc Zyngier wrote: >> if (irq_domain_is_hierarchy(domain)) { >> + if (domain->ops->xlate) { >> + /* >> + * If we've already configured this interrupt, >> + * don't do it again, or hell will break loose. >> + */ >> + if (domain->ops->xlate(domain, irq_data->np, >> + irq_data->args, >> + irq_data->args_count, >> + &hwirq, &type)) >> + return 0; >> + >> + virq = irq_find_mapping(domain, hwirq); >> + if (virq) >> + return virq; >> + } >> virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); >> return virq <= 0 ? 0 : virq; >> } >> >> Thoughts? > > Using irq_find_mapping() first is probably the right approach, that > is what irq_create_mapping() does too, and I suppose we want those > to be symmetric. Ah, good point. I somehow missed that. > mt_sysirq_domain_alloc() in patch 4 has the irq_find_domain check > in it, which I guess we can remove when it has moved to the common > code. > > I don't see irq_domain_alloc_irqs() in linux-next or older kernels, where > does that get introduced? This is part of Jiang's domain hierarchy series: https://patchwork.ozlabs.org/patch/388279/ which I plan to use to get rid of the ugly gic_extn hack that only Tegra uses (but that everyone tries to abuse), and also for the GICv2m support. Thanks, M.
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index dd8d3ab..6a45821 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -479,6 +479,21 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) } if (irq_domain_is_hierarchy(domain)) { + if (domain->ops->xlate) { + /* + * If we've already configured this interrupt, + * don't do it again, or hell will break loose. + */ + if (domain->ops->xlate(domain, irq_data->np, + irq_data->args, + irq_data->args_count, + &hwirq, &type)) + return 0; + + virq = irq_find_mapping(domain, hwirq); + if (virq) + return virq; + } virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); return virq <= 0 ? 0 : virq;