Message ID | 1574233128-28114-2-git-send-email-yash.shah@sifive.com |
---|---|
State | New |
Headers | show |
Series | GPIO & Hierarchy IRQ support for HiFive Unleashed | expand |
On Wed, 20 Nov 2019, Yash Shah wrote: > Add a new function irq_domain_translate_onecell() that is to be used as > the translate function in struct irq_domain_ops for the v2 IRQ API. What is the V2 IRQ API? Thanks, tglx
On 2019-11-20 09:34, Thomas Gleixner wrote: > On Wed, 20 Nov 2019, Yash Shah wrote: > >> Add a new function irq_domain_translate_onecell() that is to be used >> as >> the translate function in struct irq_domain_ops for the v2 IRQ API. > > What is the V2 IRQ API? I believe that's a reference to a rather misleading comment in irqdomain.h: #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY /* extended V2 interfaces to support hierarchy irq_domains */ which we could drop, as everything refers to hierarchical domain support. Thanks, M.
On 2019-11-20 06:59, Yash Shah wrote: > Add a new function irq_domain_translate_onecell() that is to be used > as > the translate function in struct irq_domain_ops for the v2 IRQ API. > > Signed-off-by: Yash Shah <yash.shah@sifive.com> > --- > include/linux/irqdomain.h | 5 +++++ > kernel/irq/irqdomain.c | 20 ++++++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h > index 583e7ab..cad9eb8 100644 > --- a/include/linux/irqdomain.h > +++ b/include/linux/irqdomain.h > @@ -426,6 +426,11 @@ int irq_domain_translate_twocell(struct > irq_domain *d, > unsigned long *out_hwirq, > unsigned int *out_type); > > +int irq_domain_translate_onecell(struct irq_domain *d, > + struct irq_fwspec *fwspec, > + unsigned long *out_hwirq, > + unsigned int *out_type); > + > /* IPI functions */ > int irq_reserve_ipi(struct irq_domain *domain, const struct cpumask > *dest); > int irq_destroy_ipi(unsigned int irq, const struct cpumask *dest); > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c > index 132672b..6972a48 100644 > --- a/kernel/irq/irqdomain.c > +++ b/kernel/irq/irqdomain.c > @@ -987,6 +987,26 @@ const struct irq_domain_ops > irq_domain_simple_ops = { > EXPORT_SYMBOL_GPL(irq_domain_simple_ops); > > /** > + * irq_domain_translate_onecell() - Generic translate for direct one > cell > + * bindings > + * > + * Device Tree IRQ specifier translation function which works with > one cell nit: the whole point of the 'new' translate function is that they are firmware-agnostic. Just drop the DT reference here. > + * bindings where the cell values map directly to the hwirq number. > + */ > +int irq_domain_translate_onecell(struct irq_domain *d, > + struct irq_fwspec *fwspec, > + unsigned long *out_hwirq, > + unsigned int *out_type) > +{ > + if (WARN_ON(fwspec->param_count < 1)) > + return -EINVAL; > + *out_hwirq = fwspec->param[0]; > + *out_type = IRQ_TYPE_NONE; > + return 0; > +} > +EXPORT_SYMBOL_GPL(irq_domain_translate_onecell); > + > +/** > * irq_domain_translate_twocell() - Generic translate for direct two > cell > * bindings > * Can you please also update (potentially in a separate patch) the potential users of this? I mentioned the nvic driver last time... Thanks, M.
On Wed, 20 Nov 2019, Marc Zyngier wrote: > On 2019-11-20 09:34, Thomas Gleixner wrote: > > On Wed, 20 Nov 2019, Yash Shah wrote: > > > > > Add a new function irq_domain_translate_onecell() that is to be used as > > > the translate function in struct irq_domain_ops for the v2 IRQ API. > > > > What is the V2 IRQ API? > > I believe that's a reference to a rather misleading comment in irqdomain.h: > > #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > /* extended V2 interfaces to support hierarchy irq_domains */ > > which we could drop, as everything refers to hierarchical domain > support. Yes, which reminds me that we also need to update the horribly stale documentation of all this mess. Thanks, tglx
> -----Original Message----- > From: Marc Zyngier <maz@kernel.org> > Sent: 20 November 2019 16:09 > To: Yash Shah <yash.shah@sifive.com> > Cc: linus.walleij@linaro.org; bgolaszewski@baylibre.com; > robh+dt@kernel.org; mark.rutland@arm.com; palmer@dabbelt.com; Paul > Walmsley ( Sifive) <paul.walmsley@sifive.com>; aou@eecs.berkeley.edu; > tglx@linutronix.de; jason@lakedaemon.net; bmeng.cn@gmail.com; > atish.patra@wdc.com; Sagar Kadam <sagar.kadam@sifive.com>; linux- > gpio@vger.kernel.org; devicetree@vger.kernel.org; linux- > riscv@lists.infradead.org; linux-kernel@vger.kernel.org; Sachin Ghadi > <sachin.ghadi@sifive.com> > Subject: Re: [PATCH v2 1/5] genirq: introduce irq_domain_translate_onecell > > On 2019-11-20 06:59, Yash Shah wrote: > > Add a new function irq_domain_translate_onecell() that is to be used > > as the translate function in struct irq_domain_ops for the v2 IRQ API. > > > > Signed-off-by: Yash Shah <yash.shah@sifive.com> [...] > > > > /** > > + * irq_domain_translate_onecell() - Generic translate for direct one > > cell > > + * bindings > > + * > > + * Device Tree IRQ specifier translation function which works with > > one cell > > nit: the whole point of the 'new' translate function is that they are > firmware-agnostic. Just drop the DT reference here. Ok sure. > > > + * bindings where the cell values map directly to the hwirq number. > > + */ > > +int irq_domain_translate_onecell(struct irq_domain *d, > > + struct irq_fwspec *fwspec, > > + unsigned long *out_hwirq, > > + unsigned int *out_type) > > +{ > > + if (WARN_ON(fwspec->param_count < 1)) > > + return -EINVAL; > > + *out_hwirq = fwspec->param[0]; > > + *out_type = IRQ_TYPE_NONE; > > + return 0; > > +} > > +EXPORT_SYMBOL_GPL(irq_domain_translate_onecell); > > + > > +/** > > * irq_domain_translate_twocell() - Generic translate for direct two > > cell > > * bindings > > * > > Can you please also update (potentially in a separate patch) the > potential > users of this? I mentioned the nvic driver last time... > Ok, I will separate out this patch from the patchset and send it individually along with potential users of it. Thanks for your comments - Yash
> -----Original Message----- > From: linux-riscv <linux-riscv-bounces@lists.infradead.org> On Behalf Of > Yash Shah > Sent: 21 November 2019 14:06 > To: Marc Zyngier <maz@kernel.org> > Cc: mark.rutland@arm.com; devicetree@vger.kernel.org; > aou@eecs.berkeley.edu; jason@lakedaemon.net; atish.patra@wdc.com; > Sachin Ghadi <sachin.ghadi@sifive.com>; linus.walleij@linaro.org; linux- > kernel@vger.kernel.org; bgolaszewski@baylibre.com; robh+dt@kernel.org; > palmer@dabbelt.com; Sagar Kadam <sagar.kadam@sifive.com>; linux- > gpio@vger.kernel.org; Paul Walmsley ( Sifive) <paul.walmsley@sifive.com>; > tglx@linutronix.de; bmeng.cn@gmail.com; linux-riscv@lists.infradead.org > Subject: RE: [PATCH v2 1/5] genirq: introduce irq_domain_translate_onecell > > > -----Original Message----- > > From: Marc Zyngier <maz@kernel.org> > > Sent: 20 November 2019 16:09 > > To: Yash Shah <yash.shah@sifive.com> > > Cc: linus.walleij@linaro.org; bgolaszewski@baylibre.com; > > robh+dt@kernel.org; mark.rutland@arm.com; palmer@dabbelt.com; Paul > > Walmsley ( Sifive) <paul.walmsley@sifive.com>; aou@eecs.berkeley.edu; > > tglx@linutronix.de; jason@lakedaemon.net; bmeng.cn@gmail.com; > > atish.patra@wdc.com; Sagar Kadam <sagar.kadam@sifive.com>; linux- > > gpio@vger.kernel.org; devicetree@vger.kernel.org; linux- > > riscv@lists.infradead.org; linux-kernel@vger.kernel.org; Sachin Ghadi > > <sachin.ghadi@sifive.com> > > Subject: Re: [PATCH v2 1/5] genirq: introduce > > irq_domain_translate_onecell > > > > On 2019-11-20 06:59, Yash Shah wrote: > > > Add a new function irq_domain_translate_onecell() that is to be used > > > as the translate function in struct irq_domain_ops for the v2 IRQ API. > > > > > > Signed-off-by: Yash Shah <yash.shah@sifive.com> > [...] > > > > > > /** > > > + * irq_domain_translate_onecell() - Generic translate for direct > > > + one > > > cell > > > + * bindings > > > + * > > > + * Device Tree IRQ specifier translation function which works with > > > one cell > > > > nit: the whole point of the 'new' translate function is that they are > > firmware-agnostic. Just drop the DT reference here. > > Ok sure. > > > > > > + * bindings where the cell values map directly to the hwirq number. > > > + */ > > > +int irq_domain_translate_onecell(struct irq_domain *d, > > > + struct irq_fwspec *fwspec, > > > + unsigned long *out_hwirq, > > > + unsigned int *out_type) > > > +{ > > > + if (WARN_ON(fwspec->param_count < 1)) > > > + return -EINVAL; > > > + *out_hwirq = fwspec->param[0]; > > > + *out_type = IRQ_TYPE_NONE; > > > + return 0; > > > +} > > > +EXPORT_SYMBOL_GPL(irq_domain_translate_onecell); > > > + > > > +/** > > > * irq_domain_translate_twocell() - Generic translate for direct > > > two cell > > > * bindings > > > * > > > > Can you please also update (potentially in a separate patch) the > > potential users of this? I mentioned the nvic driver last time... > > > > Ok, I will separate out this patch from the patchset and send it individually > along with potential users of it. > Thanks for your comments I am sorry, I think I misunderstood you. You want me to send a new separate patch in which the potential users will be updated to this new function. Hope I got it right? - Yash
On 2019-11-21 08:55, Yash Shah wrote: [...] >> > > + * bindings where the cell values map directly to the hwirq >> number. >> > > + */ >> > > +int irq_domain_translate_onecell(struct irq_domain *d, >> > > + struct irq_fwspec *fwspec, >> > > + unsigned long *out_hwirq, >> > > + unsigned int *out_type) >> > > +{ >> > > + if (WARN_ON(fwspec->param_count < 1)) >> > > + return -EINVAL; >> > > + *out_hwirq = fwspec->param[0]; >> > > + *out_type = IRQ_TYPE_NONE; >> > > + return 0; >> > > +} >> > > +EXPORT_SYMBOL_GPL(irq_domain_translate_onecell); >> > > + >> > > +/** >> > > * irq_domain_translate_twocell() - Generic translate for >> direct >> > > two cell >> > > * bindings >> > > * >> > >> > Can you please also update (potentially in a separate patch) the >> > potential users of this? I mentioned the nvic driver last time... >> > >> >> Ok, I will separate out this patch from the patchset and send it >> individually >> along with potential users of it. >> Thanks for your comments > > I am sorry, I think I misunderstood you. > You want me to send a new separate patch in which the potential users > will be updated to this new function. > Hope I got it right? Just add, as part of this series, a patch that updates the one or two drivers that could make use of this. It doesn't need to be in a separate patch set (which would cause dependency issues). Thanks, M.
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 583e7ab..cad9eb8 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -426,6 +426,11 @@ int irq_domain_translate_twocell(struct irq_domain *d, unsigned long *out_hwirq, unsigned int *out_type); +int irq_domain_translate_onecell(struct irq_domain *d, + struct irq_fwspec *fwspec, + unsigned long *out_hwirq, + unsigned int *out_type); + /* IPI functions */ int irq_reserve_ipi(struct irq_domain *domain, const struct cpumask *dest); int irq_destroy_ipi(unsigned int irq, const struct cpumask *dest); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 132672b..6972a48 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -987,6 +987,26 @@ const struct irq_domain_ops irq_domain_simple_ops = { EXPORT_SYMBOL_GPL(irq_domain_simple_ops); /** + * irq_domain_translate_onecell() - Generic translate for direct one cell + * bindings + * + * Device Tree IRQ specifier translation function which works with one cell + * bindings where the cell values map directly to the hwirq number. + */ +int irq_domain_translate_onecell(struct irq_domain *d, + struct irq_fwspec *fwspec, + unsigned long *out_hwirq, + unsigned int *out_type) +{ + if (WARN_ON(fwspec->param_count < 1)) + return -EINVAL; + *out_hwirq = fwspec->param[0]; + *out_type = IRQ_TYPE_NONE; + return 0; +} +EXPORT_SYMBOL_GPL(irq_domain_translate_onecell); + +/** * irq_domain_translate_twocell() - Generic translate for direct two cell * bindings *
Add a new function irq_domain_translate_onecell() that is to be used as the translate function in struct irq_domain_ops for the v2 IRQ API. Signed-off-by: Yash Shah <yash.shah@sifive.com> --- include/linux/irqdomain.h | 5 +++++ kernel/irq/irqdomain.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+)