drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
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@glider.be>
---
This would have prevented the issue fixed by "[PATCH] arm64: dts:
renesas: r8a78000: Fix out-of-range SPI interrupt numbers"[1].
[1] https://lore.kernel.org/1f9dd274720ea1b66617a5dd84f76c3efc829dc8.1772641415.git.geert+renesas@glider.be
---
drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 20f13b686ab22faf..d75163e71bf22473 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1603,15 +1603,27 @@ 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] > 16)
+ 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 */
--
2.43.0
On 3/4/26 7:31 PM, Geert Uytterhoeven wrote:
> 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@glider.be>
> ---
> This would have prevented the issue fixed by "[PATCH] arm64: dts:
> renesas: r8a78000: Fix out-of-range SPI interrupt numbers"[1].
>
> [1] https://lore.kernel.org/1f9dd274720ea1b66617a5dd84f76c3efc829dc8.1772641415.git.geert+renesas@glider.be
> ---
> drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 20f13b686ab22faf..d75163e71bf22473 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1603,15 +1603,27 @@ 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] > 16)
Not 15? Don't PPIs use INTIDs 16-31?
> + pr_warn_once("PPI %u out of range (use EPPI?)\n",
> + fwspec->param[1]);
> *hwirq = fwspec->param[1] + 16;
> break;
[...]
MBR, Sergey
Hi Sergey,
On Wed, 4 Mar 2026 at 18:05, Sergey Shtylyov <sergei.shtylyov@gmail.com> wrote:
> On 3/4/26 7:31 PM, Geert Uytterhoeven wrote:
> > 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@glider.be>
> > ---
> > This would have prevented the issue fixed by "[PATCH] arm64: dts:
> > renesas: r8a78000: Fix out-of-range SPI interrupt numbers"[1].
> >
> > [1] https://lore.kernel.org/1f9dd274720ea1b66617a5dd84f76c3efc829dc8.1772641415.git.geert+renesas@glider.be
> > ---
> > drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> > index 20f13b686ab22faf..d75163e71bf22473 100644
> > --- a/drivers/irqchip/irq-gic-v3.c
> > +++ b/drivers/irqchip/irq-gic-v3.c
> > @@ -1603,15 +1603,27 @@ 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] > 16)
>
> Not 15? Don't PPIs use INTIDs 16-31?
Thank you, that is indeed an off-by-one bug.
Will fix.
>
> > + pr_warn_once("PPI %u out of range (use EPPI?)\n",
> > + fwspec->param[1]);
> > *hwirq = fwspec->param[1] + 16;
> > break;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
© 2016 - 2026 Red Hat, Inc.