]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
of/irq: Add interrupt affinity reporting interface
authorMarc Zyngier <maz@kernel.org>
Mon, 20 Oct 2025 12:29:20 +0000 (13:29 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 27 Oct 2025 16:16:32 +0000 (17:16 +0100)
Plug the irq_populate_fwspec_info() helper into the OF layer to offer an
interrupt affinity reporting function.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Will Deacon <will@kernel.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20251020122944.3074811-4-maz@kernel.org
drivers/of/irq.c
include/linux/of_irq.h

index 65c3c23255b74d695e18fc77e1b50b0f1169ee61..168fde921bd27718dab035436290e48296c07a2f 100644 (file)
@@ -479,6 +479,26 @@ out:
 }
 EXPORT_SYMBOL_GPL(of_irq_get);
 
+const struct cpumask *of_irq_get_affinity(struct device_node *dev, int index)
+{
+       struct of_phandle_args oirq;
+       struct irq_fwspec_info info;
+       struct irq_fwspec fwspec;
+       int rc;
+
+       rc = of_irq_parse_one(dev, index, &oirq);
+       if (rc)
+               return NULL;
+
+       of_phandle_args_to_fwspec(oirq.np, oirq.args, oirq.args_count,
+                                 &fwspec);
+
+       if (irq_populate_fwspec_info(&fwspec, &info))
+               return NULL;
+
+       return info.affinity;
+}
+
 /**
  * of_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number
  * @dev: pointer to device tree node
index 1db8543dfc8a621d00fc42544c7e522682537d7c..1c2bc028180712082f9d955275e333949b882970 100644 (file)
@@ -43,6 +43,8 @@ extern int of_irq_parse_one(struct device_node *device, int index,
                          struct of_phandle_args *out_irq);
 extern int of_irq_count(struct device_node *dev);
 extern int of_irq_get(struct device_node *dev, int index);
+extern const struct cpumask *of_irq_get_affinity(struct device_node *dev,
+                                                     int index);
 extern int of_irq_get_byname(struct device_node *dev, const char *name);
 extern int of_irq_to_resource_table(struct device_node *dev,
                struct resource *res, int nr_irqs);
@@ -76,6 +78,11 @@ static inline int of_irq_get_byname(struct device_node *dev, const char *name)
 {
        return 0;
 }
+static inline const struct cpumask *of_irq_get_affinity(struct device_node *dev,
+                                                       int index)
+{
+       return NULL;
+}
 static inline int of_irq_to_resource_table(struct device_node *dev,
                                           struct resource *res, int nr_irqs)
 {