@@ -260,6 +260,8 @@ extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
extern int
irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
+extern int irq_get_affinity(unsigned int irq, struct cpumask *mask);
+
#else /* CONFIG_SMP */
static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -290,6 +292,12 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
{
return 0;
}
+
+static inline int irq_get_affinity(unsigned int irq, struct cpumask *mask)
+{
+ return -EINVAL;
+}
+
#endif /* CONFIG_SMP */
/*
@@ -246,6 +246,24 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
}
EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
+int irq_get_affinity(unsigned int irq, struct cpumask *mask)
+{
+ struct irq_desc *desc = irq_to_desc(irq);
+ unsigned long flags;
+
+ if (!mask)
+ return -EINVAL;
+
+ raw_spin_lock_irqsave(&desc->lock, flags);
+ if (!irqd_irq_disabled(&desc->irq_data))
+ cpumask_copy(mask, desc->irq_data.affinity);
+ else
+ cpumask_clear(mask);
+ raw_spin_unlock_irqrestore(&desc->lock, flags);
+
+ return 0;
+}
+
static void irq_affinity_notify(struct work_struct *work)
{
struct irq_affinity_notify *notify =
Export irq_get_affinity API for drivers to read the smp affinity of an IRQ safely. Signed-off-by: Lina Iyer <lina.iyer@linaro.org> --- include/linux/interrupt.h | 8 ++++++++ kernel/irq/manage.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+)