The GICv5 driver IRQ domain hierarchy requires adding a parent field to
struct irqchip_fwid so that core code can reference a fwnode_handle parent
for a given fwnode.
Add a parent field to struct irqchip_fwid and update the related kernel API
functions to initialize and handle it.
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <maz@kernel.org>
---
include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++----
kernel/irq/irqdomain.c | 14 +++++++++++++-
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 62f81bbeb490..b9df84b447a1 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
#ifdef CONFIG_IRQ_DOMAIN
struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
- const char *name, phys_addr_t *pa);
+ const char *name, phys_addr_t *pa,
+ struct fwnode_handle *parent);
enum {
IRQCHIP_FWNODE_REAL,
@@ -267,18 +268,39 @@ enum {
static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
{
- return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
+ return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
+}
+
+static inline
+struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
+ struct fwnode_handle *parent)
+{
+ return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
}
static inline struct fwnode_handle *irq_domain_alloc_named_id_fwnode(const char *name, int id)
{
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED_ID, id, name,
- NULL);
+ NULL, NULL);
+}
+
+static inline
+struct fwnode_handle *irq_domain_alloc_named_id_fwnode_parent(const char *name, int id,
+ struct fwnode_handle *parent)
+{
+ return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED_ID, id, name,
+ NULL, parent);
}
static inline struct fwnode_handle *irq_domain_alloc_fwnode(phys_addr_t *pa)
{
- return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa);
+ return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa, NULL);
+}
+
+static inline struct fwnode_handle *irq_domain_alloc_fwnode_parent(phys_addr_t *pa,
+ struct fwnode_handle *parent)
+{
+ return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa, parent);
}
void irq_domain_free_fwnode(struct fwnode_handle *fwnode);
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 2652c4cfd877..baf77cd167c4 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -33,6 +33,7 @@ static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq
struct irqchip_fwid {
struct fwnode_handle fwnode;
+ struct fwnode_handle *parent;
unsigned int type;
char *name;
phys_addr_t *pa;
@@ -53,8 +54,16 @@ static const char *irqchip_fwnode_get_name(const struct fwnode_handle *fwnode)
return fwid->name;
}
+static struct fwnode_handle *irqchip_fwnode_get_parent(const struct fwnode_handle *fwnode)
+{
+ struct irqchip_fwid *fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
+
+ return fwid->parent;
+}
+
const struct fwnode_operations irqchip_fwnode_ops = {
.get_name = irqchip_fwnode_get_name,
+ .get_parent = irqchip_fwnode_get_parent,
};
EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
@@ -65,6 +74,7 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
* @id: Optional user provided id if name != NULL
* @name: Optional user provided domain name
* @pa: Optional user-provided physical address
+ * @parent: Optional parent fwnode_handle
*
* Allocate a struct irqchip_fwid, and return a pointer to the embedded
* fwnode_handle (or NULL on failure).
@@ -76,7 +86,8 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
*/
struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
const char *name,
- phys_addr_t *pa)
+ phys_addr_t *pa,
+ struct fwnode_handle *parent)
{
struct irqchip_fwid *fwid;
char *n;
@@ -104,6 +115,7 @@ struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
fwid->type = type;
fwid->name = n;
fwid->pa = pa;
+ fwid->parent = parent;
fwnode_init(&fwid->fwnode, &irqchip_fwnode_ops);
return &fwid->fwnode;
}
--
2.50.1
On Thu, 18 Dec 2025 11:14:29 +0100
Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
> The GICv5 driver IRQ domain hierarchy requires adding a parent field to
> struct irqchip_fwid so that core code can reference a fwnode_handle parent
> for a given fwnode.
>
> Add a parent field to struct irqchip_fwid and update the related kernel API
> functions to initialize and handle it.
>
> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Marc Zyngier <maz@kernel.org>
Hi Lorenzo,
Happy new year.
> ---
> include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++----
> kernel/irq/irqdomain.c | 14 +++++++++++++-
> 2 files changed, 39 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> index 62f81bbeb490..b9df84b447a1 100644
> --- a/include/linux/irqdomain.h
> +++ b/include/linux/irqdomain.h
> @@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
>
> #ifdef CONFIG_IRQ_DOMAIN
> struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
> - const char *name, phys_addr_t *pa);
> + const char *name, phys_addr_t *pa,
> + struct fwnode_handle *parent);
>
> enum {
> IRQCHIP_FWNODE_REAL,
> @@ -267,18 +268,39 @@ enum {
>
> static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
> {
> - return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
> + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
> +}
> +
> +static inline
> +struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
> + struct fwnode_handle *parent)
The name of this makes me think it's allocating the named fwnode parent, rather that
the named fwnode + setting it's parent.
There aren't all that many calls to irq_domain_named_fwnode(), maybe to avoid challenge
of a new name, just add the parameter to all of them? (25ish) Mind you the current
pattern for similar cases is a helper, so maybe not.
Or go with something similar to named and have
irq_domain_alloc_named_parented_fwnode()?
I'm not that bothered though if you think the current naming is the best we can do.
Jonathan
> +{
> + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
> }
On Mon, Jan 05, 2026 at 12:01:08PM +0000, Jonathan Cameron wrote:
> On Thu, 18 Dec 2025 11:14:29 +0100
> Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
>
> > The GICv5 driver IRQ domain hierarchy requires adding a parent field to
> > struct irqchip_fwid so that core code can reference a fwnode_handle parent
> > for a given fwnode.
> >
> > Add a parent field to struct irqchip_fwid and update the related kernel API
> > functions to initialize and handle it.
> >
> > Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Marc Zyngier <maz@kernel.org>
> Hi Lorenzo,
>
> Happy new year.
Happy New Year !
> > ---
> > include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++----
> > kernel/irq/irqdomain.c | 14 +++++++++++++-
> > 2 files changed, 39 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> > index 62f81bbeb490..b9df84b447a1 100644
> > --- a/include/linux/irqdomain.h
> > +++ b/include/linux/irqdomain.h
> > @@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
> >
> > #ifdef CONFIG_IRQ_DOMAIN
> > struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
> > - const char *name, phys_addr_t *pa);
> > + const char *name, phys_addr_t *pa,
> > + struct fwnode_handle *parent);
> >
> > enum {
> > IRQCHIP_FWNODE_REAL,
> > @@ -267,18 +268,39 @@ enum {
> >
> > static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
> > {
> > - return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
> > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
> > +}
> > +
> > +static inline
> > +struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
> > + struct fwnode_handle *parent)
>
> The name of this makes me think it's allocating the named fwnode parent, rather that
> the named fwnode + setting it's parent.
>
> There aren't all that many calls to irq_domain_named_fwnode(), maybe to avoid challenge
> of a new name, just add the parameter to all of them? (25ish) Mind you the current
> pattern for similar cases is a helper, so maybe not.
Similar cases ? Have you got anything specific I can look into ?
> Or go with something similar to named and have
>
> irq_domain_alloc_named_parented_fwnode()?
Or I can add a set_parent() helper (though that's a bit of churn IMO) ?
If Thomas has a preference I will follow that, all of the above is doable
for me.
> I'm not that bothered though if you think the current naming is the best we can do.
I think you have a point - as per my comment above.
Thanks,
Lorenzo
> Jonathan
>
> > +{
> > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
> > }
>
>
On Wed, 7 Jan 2026 09:58:07 +0100
Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
> On Mon, Jan 05, 2026 at 12:01:08PM +0000, Jonathan Cameron wrote:
> > On Thu, 18 Dec 2025 11:14:29 +0100
> > Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
> >
> > > The GICv5 driver IRQ domain hierarchy requires adding a parent field to
> > > struct irqchip_fwid so that core code can reference a fwnode_handle parent
> > > for a given fwnode.
> > >
> > > Add a parent field to struct irqchip_fwid and update the related kernel API
> > > functions to initialize and handle it.
> > >
> > > Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: Marc Zyngier <maz@kernel.org>
> > Hi Lorenzo,
> >
> > Happy new year.
>
> Happy New Year !
>
> > > ---
> > > include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++----
> > > kernel/irq/irqdomain.c | 14 +++++++++++++-
> > > 2 files changed, 39 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> > > index 62f81bbeb490..b9df84b447a1 100644
> > > --- a/include/linux/irqdomain.h
> > > +++ b/include/linux/irqdomain.h
> > > @@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
> > >
> > > #ifdef CONFIG_IRQ_DOMAIN
> > > struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
> > > - const char *name, phys_addr_t *pa);
> > > + const char *name, phys_addr_t *pa,
> > > + struct fwnode_handle *parent);
> > >
> > > enum {
> > > IRQCHIP_FWNODE_REAL,
> > > @@ -267,18 +268,39 @@ enum {
> > >
> > > static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
> > > {
> > > - return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
> > > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
> > > +}
> > > +
> > > +static inline
> > > +struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
> > > + struct fwnode_handle *parent)
> >
> > The name of this makes me think it's allocating the named fwnode parent, rather that
> > the named fwnode + setting it's parent.
> >
> > There aren't all that many calls to irq_domain_named_fwnode(), maybe to avoid challenge
> > of a new name, just add the parameter to all of them? (25ish) Mind you the current
> > pattern for similar cases is a helper, so maybe not.
>
> Similar cases ? Have you got anything specific I can look into ?
I meant all the different irq_domain_alloc_xxxxx variants that call
__irq_domain_alloc_fwnode() with a subset of parameters set to NULL.
That seems to say there is a precedence for making the presence of the parameter
part of the name rather than requiring callers to set the ones they don't want to
NULL. So it argues for a helper like this one just for consistency.
>
> > Or go with something similar to named and have
> >
> > irq_domain_alloc_named_parented_fwnode()?
>
> Or I can add a set_parent() helper (though that's a bit of churn IMO) ?
>
> If Thomas has a preference I will follow that, all of the above is doable
> for me.
Agreed. Let's see what Thomas prefers (i.e. make the decision his problem ;)
Jonathan
>
> > I'm not that bothered though if you think the current naming is the best we can do.
>
> I think you have a point - as per my comment above.
>
> Thanks,
> Lorenzo
>
> > Jonathan
> >
> > > +{
> > > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
> > > }
> >
> >
>
On Wed, Jan 07, 2026 at 10:04:52AM +0000, Jonathan Cameron wrote:
[...]
> > > > +static inline
> > > > +struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
> > > > + struct fwnode_handle *parent)
> > >
> > > The name of this makes me think it's allocating the named fwnode parent, rather that
> > > the named fwnode + setting it's parent.
> > >
> > > There aren't all that many calls to irq_domain_named_fwnode(), maybe to avoid challenge
> > > of a new name, just add the parameter to all of them? (25ish) Mind you the current
> > > pattern for similar cases is a helper, so maybe not.
> >
> > Similar cases ? Have you got anything specific I can look into ?
>
> I meant all the different irq_domain_alloc_xxxxx variants that call
> __irq_domain_alloc_fwnode() with a subset of parameters set to NULL.
>
> That seems to say there is a precedence for making the presence of the parameter
> part of the name rather than requiring callers to set the ones they don't want to
> NULL. So it argues for a helper like this one just for consistency.
>
> >
> > > Or go with something similar to named and have
> > >
> > > irq_domain_alloc_named_parented_fwnode()?
Right, given that Thomas is fine with it, I will go with this suggestion then
albeit it is getting a bit cumbersome (_named_id_parented_fwnode..), it should
be fine and I can rework the code to add a parent field to the existing interface
later if we feel it is nicer.
Thanks,
Lorenzo
> >
> > Or I can add a set_parent() helper (though that's a bit of churn IMO) ?
> >
> > If Thomas has a preference I will follow that, all of the above is doable
> > for me.
>
> Agreed. Let's see what Thomas prefers (i.e. make the decision his problem ;)
>
> Jonathan
>
> >
> > > I'm not that bothered though if you think the current naming is the best we can do.
> >
> > I think you have a point - as per my comment above.
> >
> > Thanks,
> > Lorenzo
> >
> > > Jonathan
> > >
> > > > +{
> > > > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
> > > > }
> > >
> > >
> >
>
On Wed, Jan 07, 2026 at 10:04:52AM +0000, Jonathan Cameron wrote:
> On Wed, 7 Jan 2026 09:58:07 +0100
> Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
>
> > On Mon, Jan 05, 2026 at 12:01:08PM +0000, Jonathan Cameron wrote:
> > > On Thu, 18 Dec 2025 11:14:29 +0100
> > > Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:
> > >
> > > > The GICv5 driver IRQ domain hierarchy requires adding a parent field to
> > > > struct irqchip_fwid so that core code can reference a fwnode_handle parent
> > > > for a given fwnode.
> > > >
> > > > Add a parent field to struct irqchip_fwid and update the related kernel API
> > > > functions to initialize and handle it.
> > > >
> > > > Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> > > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > Cc: Marc Zyngier <maz@kernel.org>
> > > Hi Lorenzo,
> > >
> > > Happy new year.
> >
> > Happy New Year !
> >
> > > > ---
> > > > include/linux/irqdomain.h | 30 ++++++++++++++++++++++++++----
> > > > kernel/irq/irqdomain.c | 14 +++++++++++++-
> > > > 2 files changed, 39 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
> > > > index 62f81bbeb490..b9df84b447a1 100644
> > > > --- a/include/linux/irqdomain.h
> > > > +++ b/include/linux/irqdomain.h
> > > > @@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
> > > >
> > > > #ifdef CONFIG_IRQ_DOMAIN
> > > > struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
> > > > - const char *name, phys_addr_t *pa);
> > > > + const char *name, phys_addr_t *pa,
> > > > + struct fwnode_handle *parent);
> > > >
> > > > enum {
> > > > IRQCHIP_FWNODE_REAL,
> > > > @@ -267,18 +268,39 @@ enum {
> > > >
> > > > static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
> > > > {
> > > > - return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
> > > > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
> > > > +}
> > > > +
> > > > +static inline
> > > > +struct fwnode_handle *irq_domain_alloc_named_fwnode_parent(const char *name,
> > > > + struct fwnode_handle *parent)
> > >
> > > The name of this makes me think it's allocating the named fwnode parent, rather that
> > > the named fwnode + setting it's parent.
> > >
> > > There aren't all that many calls to irq_domain_named_fwnode(), maybe to avoid challenge
> > > of a new name, just add the parameter to all of them? (25ish) Mind you the current
> > > pattern for similar cases is a helper, so maybe not.
> >
> > Similar cases ? Have you got anything specific I can look into ?
>
> I meant all the different irq_domain_alloc_xxxxx variants that call
> __irq_domain_alloc_fwnode() with a subset of parameters set to NULL.
>
> That seems to say there is a precedence for making the presence of the parameter
> part of the name rather than requiring callers to set the ones they don't want to
> NULL. So it argues for a helper like this one just for consistency.
Yep that's why I wrote it this way but that does not mean it can't be
changed.
> >
> > > Or go with something similar to named and have
> > >
> > > irq_domain_alloc_named_parented_fwnode()?
> >
> > Or I can add a set_parent() helper (though that's a bit of churn IMO) ?
> >
> > If Thomas has a preference I will follow that, all of the above is doable
> > for me.
>
> Agreed. Let's see what Thomas prefers (i.e. make the decision his problem ;)
Thomas do you have any preference on the matter please ? It is not a big deal
either way I'd just like to respin promptly (provided the rest of the series
does not require further changes other than the ones Jon suggested and I
addressed) if possible please.
Thanks,
Lorenzo
> Jonathan
>
> >
> > > I'm not that bothered though if you think the current naming is the best we can do.
> >
> > I think you have a point - as per my comment above.
> >
> > Thanks,
> > Lorenzo
> >
> > > Jonathan
> > >
> > > > +{
> > > > + return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
> > > > }
> > >
> > >
> >
>
On Wed, Jan 07 2026 at 18:31, Lorenzo Pieralisi wrote:
> On Wed, Jan 07, 2026 at 10:04:52AM +0000, Jonathan Cameron wrote:
>> Agreed. Let's see what Thomas prefers (i.e. make the decision his problem ;)
>
> Thomas do you have any preference on the matter please ? It is not a big deal
> either way I'd just like to respin promptly (provided the rest of the series
> does not require further changes other than the ones Jon suggested and I
> addressed) if possible please.
Hiding the NULL parameters in helpers is perfectly fine. I agree with
Jonathan to make the name of the new helper more intuitive, but other
than that this looks sane.
Thanks,
tglx
© 2016 - 2026 Red Hat, Inc.