Skip to content

Commit 54fdf6a

Browse files
committed
genirq: Introduce IRQD_MANAGED_SHUTDOWN
Affinity managed interrupts should keep their assigned affinity accross CPU hotplug. To avoid magic hackery in device drivers, the core code shall manage them transparently. This will set these interrupts into a managed shutdown state when the last CPU of the assigned affinity mask goes offline. The interrupt will be restarted when one of the CPUs in the assigned affinity mask comes back online. Introduce the necessary state flag and the accessor functions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Jens Axboe <axboe@kernel.dk> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Keith Busch <keith.busch@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Christoph Hellwig <hch@lst.de> Link: http://lkml.kernel.org/r/20170619235446.954523476@linutronix.de
1 parent c7d6c9d commit 54fdf6a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

include/linux/irq.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ struct irq_data {
207207
* IRQD_FORWARDED_TO_VCPU - The interrupt is forwarded to a VCPU
208208
* IRQD_AFFINITY_MANAGED - Affinity is auto-managed by the kernel
209209
* IRQD_IRQ_STARTED - Startup state of the interrupt
210+
* IRQD_MANAGED_SHUTDOWN - Interrupt was shutdown due to empty affinity
211+
* mask. Applies only to affinity managed irqs.
210212
*/
211213
enum {
212214
IRQD_TRIGGER_MASK = 0xf,
@@ -225,6 +227,7 @@ enum {
225227
IRQD_FORWARDED_TO_VCPU = (1 << 20),
226228
IRQD_AFFINITY_MANAGED = (1 << 21),
227229
IRQD_IRQ_STARTED = (1 << 22),
230+
IRQD_MANAGED_SHUTDOWN = (1 << 23),
228231
};
229232

230233
#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
@@ -343,6 +346,11 @@ static inline bool irqd_is_started(struct irq_data *d)
343346
return __irqd_to_state(d) & IRQD_IRQ_STARTED;
344347
}
345348

349+
static inline bool irqd_is_managed_shutdown(struct irq_data *d)
350+
{
351+
return __irqd_to_state(d) & IRQD_MANAGED_SHUTDOWN;
352+
}
353+
346354
#undef __irqd_to_state
347355

348356
static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)

kernel/irq/internals.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ static inline void irqd_clr_move_pending(struct irq_data *d)
193193
__irqd_to_state(d) &= ~IRQD_SETAFFINITY_PENDING;
194194
}
195195

196+
static inline void irqd_set_managed_shutdown(struct irq_data *d)
197+
{
198+
__irqd_to_state(d) |= IRQD_MANAGED_SHUTDOWN;
199+
}
200+
201+
static inline void irqd_clr_managed_shutdown(struct irq_data *d)
202+
{
203+
__irqd_to_state(d) &= ~IRQD_MANAGED_SHUTDOWN;
204+
}
205+
196206
static inline void irqd_clear(struct irq_data *d, unsigned int mask)
197207
{
198208
__irqd_to_state(d) &= ~mask;

0 commit comments

Comments
 (0)