[PATCH v2 1/7] genirq: reserve NR_IRQS_LEGACY IRQs in dynirq by default
From: Icenowy Zheng
Date: Wed Feb 11 2026 - 04:45:25 EST
Several architectures define NR_IRQS_LEGACY to reserve a low range of IRQ
numbers for fixed legacy allocations (e.g. ISA interrupts) which should
not be handed out by the dynamic IRQ allocator.
arch_dynirq_lower_bound() exists to enforce this, but today only x86 wires
it up. In the current boot order this typically works because legacy IRQ
domains register early and claim the low IRQ numbers first; however, that
assumption breaks if the legacy controller is probed later.
Make the default arch_dynirq_lower_bound() implementation honour
NR_IRQS_LEGACY by clamping the allocation start to at least that value.
Architectures that do not define NR_IRQS_LEGACY keep the current behaviour
(effectively 0). Arm/PowerPC/MIPS/LoongArch use legacy IRQ domains for ISA
interrupts and benefit from this change. x86 and s390 already provide their
own implementations.
Cc: linux-s390@xxxxxxxxxxxxxxx
Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx>
Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
Co-developed-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
Signed-off-by: Icenowy Zheng <zhengxingda@xxxxxxxxxxx>
Tested-by: Yao Zi <me@xxxxxxxx>
---
kernel/softirq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 77198911b8dd4..cdc77d52c36b2 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -1184,5 +1184,5 @@ int __init __weak arch_early_irq_init(void)
unsigned int __weak arch_dynirq_lower_bound(unsigned int from)
{
- return from;
+ return MAX(from, NR_IRQS_LEGACY);
}
--
2.52.0