[tip: irq/drivers] irqchip/gic-v3: Print a warning for out-of-range interrupt numbers

From: tip-bot2 for Geert Uytterhoeven

Date: Thu Mar 26 2026 - 12:38:26 EST


The following commit has been merged into the irq/drivers branch of tip:

Commit-ID: 42972b5464295450ce55f457645917aba4d54ead
Gitweb: https://git.kernel.org/tip/42972b5464295450ce55f457645917aba4d54ead
Author: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
AuthorDate: Fri, 06 Mar 2026 13:13:32 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Thu, 26 Mar 2026 17:26:14 +01:00

irqchip/gic-v3: Print a warning for out-of-range interrupt numbers

gic_irq_domain_translate() does not check if an interrupt number lies
within the valid range of the specified interrupt type. Add these checks,
and print a warning if the interrupt number is out of range.

This can help flagging incorrectly described Extended SPI and PPI
interrupts in DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Acked-by: Marc Zyngier <maz@xxxxxxxxxx>
Link: https://patch.msgid.link/ce695ea46decc816974179314a86f2b9b5cad6a9.1772799134.git.geert+renesas@xxxxxxxxx
---
drivers/irqchip/irq-gic-v3.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 6dc9827..99444a1 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1603,15 +1603,23 @@ static int gic_irq_domain_translate(struct irq_domain *d,

switch (fwspec->param[0]) {
case 0: /* SPI */
+ if (fwspec->param[1] > 987)
+ pr_warn_once("SPI %u out of range (use ESPI?)\n", fwspec->param[1]);
*hwirq = fwspec->param[1] + 32;
break;
case 1: /* PPI */
+ if (fwspec->param[1] > 15)
+ pr_warn_once("PPI %u out of range (use EPPI?)\n", fwspec->param[1]);
*hwirq = fwspec->param[1] + 16;
break;
case 2: /* ESPI */
+ if (fwspec->param[1] > 1023)
+ pr_warn_once("ESPI %u out of range\n", fwspec->param[1]);
*hwirq = fwspec->param[1] + ESPI_BASE_INTID;
break;
case 3: /* EPPI */
+ if (fwspec->param[1] > 63)
+ pr_warn_once("EPPI %u out of range\n", fwspec->param[1]);
*hwirq = fwspec->param[1] + EPPI_BASE_INTID;
break;
case GIC_IRQ_TYPE_LPI: /* LPI */