Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/irq: Add interrupt affinity reporting interface

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

authored by

Marc Zyngier and committed by
Thomas Gleixner
5404f5c0 5324fe21

+27
+20
drivers/of/irq.c
··· 479 479 } 480 480 EXPORT_SYMBOL_GPL(of_irq_get); 481 481 482 + const struct cpumask *of_irq_get_affinity(struct device_node *dev, int index) 483 + { 484 + struct of_phandle_args oirq; 485 + struct irq_fwspec_info info; 486 + struct irq_fwspec fwspec; 487 + int rc; 488 + 489 + rc = of_irq_parse_one(dev, index, &oirq); 490 + if (rc) 491 + return NULL; 492 + 493 + of_phandle_args_to_fwspec(oirq.np, oirq.args, oirq.args_count, 494 + &fwspec); 495 + 496 + if (irq_populate_fwspec_info(&fwspec, &info)) 497 + return NULL; 498 + 499 + return info.affinity; 500 + } 501 + 482 502 /** 483 503 * of_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number 484 504 * @dev: pointer to device tree node
+7
include/linux/of_irq.h
··· 43 43 struct of_phandle_args *out_irq); 44 44 extern int of_irq_count(struct device_node *dev); 45 45 extern int of_irq_get(struct device_node *dev, int index); 46 + extern const struct cpumask *of_irq_get_affinity(struct device_node *dev, 47 + int index); 46 48 extern int of_irq_get_byname(struct device_node *dev, const char *name); 47 49 extern int of_irq_to_resource_table(struct device_node *dev, 48 50 struct resource *res, int nr_irqs); ··· 77 75 static inline int of_irq_get_byname(struct device_node *dev, const char *name) 78 76 { 79 77 return 0; 78 + } 79 + static inline const struct cpumask *of_irq_get_affinity(struct device_node *dev, 80 + int index) 81 + { 82 + return NULL; 80 83 } 81 84 static inline int of_irq_to_resource_table(struct device_node *dev, 82 85 struct resource *res, int nr_irqs)