[PATCH v3 2/8] LoongArch: Override arch_dynirq_lower_bound to reserve LPC IRQs
From: Icenowy Zheng
Date: Sat Mar 14 2026 - 12:29:42 EST
Loongson 7A PCH chips all contain a LPC controller, which is used in
some devices to connect legacy ISA devices (e.g. 8259 PS/2 controller).
The LPC IRQ driver will register LPC IRQs at the fixed range 0~15, and
the PCH PIC IRQ driver uses dynamic allocation. However the LPC IRQs are
currently not exempted from dynamic allocation.
The currently setup work by accident because the LPC IRQ controller is
the first consumer of PIC IRQ controller, and the PIC IRQ number is
allocated after LPC IRQs are registered. Such setup is fragile and will
stop to work when the LPC IRQ driver is reworked.
Override arch_dynirq_lower_bound() to reserve LPC IRQs from dynamic
allocation, to prevent IRQ number collision and allow rework of the LPC
IRQ driver.
Signed-off-by: Icenowy Zheng <zhengxingda@xxxxxxxxxxx>
---
arch/loongarch/kernel/irq.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/loongarch/kernel/irq.c b/arch/loongarch/kernel/irq.c
index 80946cafaec1b..7bf68a7a5f4b3 100644
--- a/arch/loongarch/kernel/irq.c
+++ b/arch/loongarch/kernel/irq.c
@@ -11,6 +11,7 @@
#include <linux/irqchip.h>
#include <linux/kernel_stat.h>
#include <linux/proc_fs.h>
+#include <linux/minmax.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
@@ -99,6 +100,11 @@ int __init arch_probe_nr_irqs(void)
return NR_IRQS_LEGACY;
}
+unsigned int arch_dynirq_lower_bound(unsigned int from)
+{
+ return MAX(from, NR_IRQS_LEGACY);
+}
+
void __init init_IRQ(void)
{
int i;
--
2.52.0