[RFC PATCH 01/10] genirq: Add IRQCHIP_AFFINITY_FILTERABLE flag
From: Kris Pan
Date: Sun Nov 29 2026 - 22:40:31 EST
Runtime IRQ isolation needs to program a mask which differs from
irq_common_data.affinity for unmanaged interrupts: it is either the
request with runtime-isolated CPUs subtracted, or a relocation to
housekeeping CPUs when an automatic placement loses every online
target. Legacy irqchips which derive mask/unmask or routing state
directly from the requested affinity cannot tolerate that divergence.
Define IRQCHIP_AFFINITY_FILTERABLE for delivery irqchips which can
safely accept a filtered or relocated mask, and
IRQCHIP_AFFINITY_PASSTHROUGH for the forwarding levels above them
which only hand the mask to their parent. The core requires every
level which implements .irq_set_affinity to be one of the two, so an
unmarked domain keeps filtering off instead of inheriting it from a
parent. Expose both flags in debugfs. No irqchip opts in yet.
Signed-off-by: Kris Pan <kris.pan@xxxxxxxxx>
---
include/linux/irq.h | 23 +++++++++++++++++++++++
kernel/irq/debugfs.c | 2 ++
2 files changed, 25 insertions(+)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f485369b1b4f7..d47ebe8ec3708 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -569,6 +569,27 @@ struct irq_chip {
* IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
* IRQCHIP_IMMUTABLE: Don't ever change anything in this chip
* IRQCHIP_MOVE_DEFERRED: Move the interrupt in actual interrupt context
+ * IRQCHIP_AFFINITY_FILTERABLE: Delivery chip accepts a filtered or
+ * relocated affinity mask instead of the
+ * requested one. Set it on the level
+ * which programs the delivery target; the
+ * core walks the parent chain and requires
+ * every level which implements
+ * .irq_set_affinity to be FILTERABLE or
+ * PASSTHROUGH. A chip which derives
+ * routing from irq_common_data.affinity
+ * must not opt in. The opt-in also covers
+ * the initial placement: the activation
+ * path must respect the runtime isolation
+ * filter before the first affinity request
+ * runs.
+ * IRQCHIP_AFFINITY_PASSTHROUGH: Forwarding level above a filterable
+ * delivery chip. The chip only hands the
+ * mask to its parent and derives no state
+ * from it, so it accepts a filtered mask.
+ * An unmarked level which implements
+ * .irq_set_affinity disables filtering for
+ * the whole chain.
*/
enum {
IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -584,6 +605,8 @@ enum {
IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
IRQCHIP_IMMUTABLE = (1 << 11),
IRQCHIP_MOVE_DEFERRED = (1 << 12),
+ IRQCHIP_AFFINITY_FILTERABLE = (1 << 13),
+ IRQCHIP_AFFINITY_PASSTHROUGH = (1 << 14),
};
#include <linux/irqdesc.h>
diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index 5c5ebaee35f2c..3bdc5a388ea5f 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -54,6 +54,8 @@ static const struct irq_bit_descr irqchip_flags[] = {
BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND),
BIT_MASK_DESCR(IRQCHIP_IMMUTABLE),
BIT_MASK_DESCR(IRQCHIP_MOVE_DEFERRED),
+ BIT_MASK_DESCR(IRQCHIP_AFFINITY_FILTERABLE),
+ BIT_MASK_DESCR(IRQCHIP_AFFINITY_PASSTHROUGH),
};
static void
--
2.43.0