All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Thomas Gleixner <tglx@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] irqchip/gic-v3: Print a warning for out-of-range interrupt numbers
Date: Thu, 26 Mar 2026 16:00:31 +0000	[thread overview]
Message-ID: <86fr5m4m3k.wl-maz@kernel.org> (raw)
In-Reply-To: <ce695ea46decc816974179314a86f2b9b5cad6a9.1772799134.git.geert+renesas@glider.be>

On Fri, 06 Mar 2026 12:13:32 +0000,
Geert Uytterhoeven <geert+renesas@glider.be> 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].
> 
> v2:
>   - Fix off-by-one error in PPI range check.
> 
> [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..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 <maz@kernel.org>

	M.

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


      parent reply	other threads:[~2026-03-26 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 12:13 [PATCH v2] irqchip/gic-v3: Print a warning for out-of-range interrupt numbers Geert Uytterhoeven
2026-03-26 14:43 ` Thomas Gleixner
2026-03-26 16:00 ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fr5m4m3k.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.