lkml.org 
[lkml]   [2022]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/5] genirq: Provide an IRQ affinity mask in non-SMP configs
Date
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 still provide the correct affinity mask without allocating one
per IRQ. We can reuse the system-wide cpu_possible_mask.

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>
---

include/linux/irq.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index 48ac33ca3703..d716e882c020 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
@@ -879,7 +881,11 @@ static inline int irq_data_get_node(struct irq_data *d)

static inline struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
{
+#ifdef CONFIG_SMP
return d->common->affinity;
+#else
+ return &__cpu_possible_mask;
+#endif
}

static inline struct cpumask *irq_get_affinity_mask(int irq)
--
2.35.1
\
 
 \ /
  Last update: 2022-05-09 05:51    [W:0.078 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site