aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-07-01 15:00:56 -0500
committerMarc Zyngier <maz@kernel.org>2022-07-07 09:38:04 +0100
commitaa0813581b8d37bdd91cd40b67ef79ffa45104b2 (patch)
tree46ac9b881b3a2ed8a57661b83bb5a408447d83b2
parentgenirq: Return a const cpumask from irq_data_get_affinity_mask (diff)
downloadlinux-dev-aa0813581b8d37bdd91cd40b67ef79ffa45104b2.tar.xz
linux-dev-aa0813581b8d37bdd91cd40b67ef79ffa45104b2.zip
genirq: Provide an IRQ affinity mask in non-SMP configs
IRQ affinity masks are not allocated in uniprocessor configurations. This requires special case non-SMP code in drivers for irqchips which have per-CPU enable or mask registers. Since IRQ affinity is always the same in a uniprocessor configuration, we can provide a correct affinity mask without allocating one per IRQ. By returning a real cpumask from irq_data_get_affinity_mask even when SMP is disabled, irqchip drivers which iterate over that mask will automatically do the right thing. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220701200056.46555-9-samuel@sholland.org
-rw-r--r--include/linux/irq.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 02073f7a156e..996e22744edd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -151,7 +151,9 @@ struct irq_common_data {
#endif
void *handler_data;
struct msi_desc *msi_desc;
+#ifdef CONFIG_SMP
cpumask_var_t affinity;
+#endif
#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
cpumask_var_t effective_affinity;
#endif
@@ -882,13 +884,19 @@ static inline int irq_data_get_node(struct irq_data *d)
static inline
const struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
{
+#ifdef CONFIG_SMP
return d->common->affinity;
+#else
+ return cpumask_of(0);
+#endif
}
static inline void irq_data_update_affinity(struct irq_data *d,
const struct cpumask *m)
{
+#ifdef CONFIG_SMP
cpumask_copy(d->common->affinity, m);
+#endif
}
static inline const struct cpumask *irq_get_affinity_mask(int irq)