]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
irqdomain: Add parent field to struct irqchip_fwid
authorLorenzo Pieralisi <lpieralisi@kernel.org>
Thu, 15 Jan 2026 09:50:47 +0000 (10:50 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Jan 2026 14:31:41 +0000 (15:31 +0100)
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>
include/linux/irqdomain.h
kernel/irq/irqdomain.c

index 62f81bbeb4906badee8f0c3f8d06352f4f505426..73c25d40846c95cf84d187ab35d92353af354ed0 100644 (file)
@@ -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_parented_fwnode(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_parented_fwnode(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_parented_fwnode(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);
index 2652c4cfd877f2ea20d502d7047f3c3d7efa2638..baf77cd167c426824b73acf52f5d29e6724ac6ec 100644 (file)
@@ -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;
 }