Subject: Re: [PATCH v2] irqchip/gic-v3: Print a warning for out-of-range interrupt numbers

From: Marc Zyngier <[email-masked]>
Date: Thu, 26 Mar 2026 16:00:31 +0000

On Fri, 06 Mar 2026 12:13:32 +0000,
Geert Uytterhoeven <[email-masked]> 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 <[email-masked]>
> ---
> This would have prevented the issue fixed by "[PATCH] arm64: dts:
> renesas: r8a78000: Fix out-of-range SPI interrupt numbers"[1].
> 
> v2:
>   - Fix off-by-one error in PPI range check.
> 
> [1] https://lore.kernel.org/1f9dd[email-masked]/
> ---
>  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..9e97505d4b767043 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] > 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 */

Acked-by: Marc Zyngier <[email-masked]>

	M.

-- 
Without deviation from the norm, progress is not possible.