Skip to content

Commit 0323897

Browse files
Lorenzo Pieralisirafaeljw
authored andcommitted
irqdomain: Add parent field to struct irqchip_fwid
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> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Acked-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260115-gicv5-host-acpi-v3-1-c13a9a150388@kernel.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8d9ad85 commit 0323897

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

include/linux/irqdomain.h

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ static inline void irq_domain_set_pm_device(struct irq_domain *d, struct device
257257

258258
#ifdef CONFIG_IRQ_DOMAIN
259259
struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
260-
const char *name, phys_addr_t *pa);
260+
const char *name, phys_addr_t *pa,
261+
struct fwnode_handle *parent);
261262

262263
enum {
263264
IRQCHIP_FWNODE_REAL,
@@ -267,18 +268,39 @@ enum {
267268

268269
static inline struct fwnode_handle *irq_domain_alloc_named_fwnode(const char *name)
269270
{
270-
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL);
271+
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, NULL);
272+
}
273+
274+
static inline
275+
struct fwnode_handle *irq_domain_alloc_named_parented_fwnode(const char *name,
276+
struct fwnode_handle *parent)
277+
{
278+
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED, 0, name, NULL, parent);
271279
}
272280

273281
static inline struct fwnode_handle *irq_domain_alloc_named_id_fwnode(const char *name, int id)
274282
{
275283
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED_ID, id, name,
276-
NULL);
284+
NULL, NULL);
285+
}
286+
287+
static inline
288+
struct fwnode_handle *irq_domain_alloc_named_id_parented_fwnode(const char *name, int id,
289+
struct fwnode_handle *parent)
290+
{
291+
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED_ID, id, name,
292+
NULL, parent);
277293
}
278294

279295
static inline struct fwnode_handle *irq_domain_alloc_fwnode(phys_addr_t *pa)
280296
{
281-
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa);
297+
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa, NULL);
298+
}
299+
300+
static inline struct fwnode_handle *irq_domain_alloc_parented_fwnode(phys_addr_t *pa,
301+
struct fwnode_handle *parent)
302+
{
303+
return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL, 0, NULL, pa, parent);
282304
}
283305

284306
void irq_domain_free_fwnode(struct fwnode_handle *fwnode);

kernel/irq/irqdomain.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq
3333

3434
struct irqchip_fwid {
3535
struct fwnode_handle fwnode;
36+
struct fwnode_handle *parent;
3637
unsigned int type;
3738
char *name;
3839
phys_addr_t *pa;
@@ -53,8 +54,16 @@ static const char *irqchip_fwnode_get_name(const struct fwnode_handle *fwnode)
5354
return fwid->name;
5455
}
5556

57+
static struct fwnode_handle *irqchip_fwnode_get_parent(const struct fwnode_handle *fwnode)
58+
{
59+
struct irqchip_fwid *fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
60+
61+
return fwid->parent;
62+
}
63+
5664
const struct fwnode_operations irqchip_fwnode_ops = {
5765
.get_name = irqchip_fwnode_get_name,
66+
.get_parent = irqchip_fwnode_get_parent,
5867
};
5968
EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
6069

@@ -65,6 +74,7 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
6574
* @id: Optional user provided id if name != NULL
6675
* @name: Optional user provided domain name
6776
* @pa: Optional user-provided physical address
77+
* @parent: Optional parent fwnode_handle
6878
*
6979
* Allocate a struct irqchip_fwid, and return a pointer to the embedded
7080
* fwnode_handle (or NULL on failure).
@@ -76,7 +86,8 @@ EXPORT_SYMBOL_GPL(irqchip_fwnode_ops);
7686
*/
7787
struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
7888
const char *name,
79-
phys_addr_t *pa)
89+
phys_addr_t *pa,
90+
struct fwnode_handle *parent)
8091
{
8192
struct irqchip_fwid *fwid;
8293
char *n;
@@ -104,6 +115,7 @@ struct fwnode_handle *__irq_domain_alloc_fwnode(unsigned int type, int id,
104115
fwid->type = type;
105116
fwid->name = n;
106117
fwid->pa = pa;
118+
fwid->parent = parent;
107119
fwnode_init(&fwid->fwnode, &irqchip_fwnode_ops);
108120
return &fwid->fwnode;
109121
}

0 commit comments

Comments
 (0)