public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Javier Achirica <jachirica@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, tglx@kernel.org
Subject: Re: [PATCH v1] irqchip: fix mask alignment in gic-v2m
Date: Mon, 23 Mar 2026 13:37:46 +0000	[thread overview]
Message-ID: <86zf3y4qfp.wl-maz@kernel.org> (raw)
In-Reply-To: <CACixm23xGCdrZ5wy7+KyLHcdxRK+-XK6R0grg1uJA0Bo_s_YbA@mail.gmail.com>

On Sat, 21 Mar 2026 14:12:16 +0000,
Javier Achirica <jachirica@gmail.com> wrote:
> 
> commit 2ef3886ce626dcdab0cbc452dbbebc19f57133d8 ("irqchip/gic-v2m: Handle
> Multiple MSI base IRQ Alignment") introduced a regression in kernel 6.12.58
> affecting PCIe devices using GICv2m MSI on a Qualcomm (arm64) platform.
> 
> It uses nr_irqs parameter to generate a mask to align the MSI base address,
> but this mask isn't properly generated when nr_irqs isn't a power of two.
> This bug was found while adding support for the TCL HH500V router in OpenWrt.
> 
> This patch fixes the issue, can be cleanly applied to the 6.12.x tree and,
> with a small fuzz, to 7.0.x.
> 
> Signed-off-by: Javier Achirica <jachirica@gmail.com>
> Cc: stable@vger.kernel.org
> ---
> --- a/drivers/irqchip/irq-gic-v2m.c     2026-03-20 09:45:22.170192561 +0100
> +++ b/drivers/irqchip/irq-gic-v2m.c     2026-03-20 09:45:26.284210783 +0100
> @@ -158,7 +158,7 @@
>         struct v2m_data *v2m = NULL, *tmp;
>         int hwirq, i, err = 0;
>         unsigned long offset;
> -       unsigned long align_mask = nr_irqs - 1;
> +       unsigned long align_mask = roundup_pow_of_two(nr_irqs) - 1;
> 
>         spin_lock(&v2m_lock);
>         list_for_each_entry(tmp, &v2m_nodes, entry) {
> 

This looks wrong for a bunch of reasons:

- you're hacking the allocation path, but not the free path -- what
  could possibly go wrong?

- nr_irqs not being a power of two to start with is more indicative of
  a bug somewhere else in the system. The only case where we allocate
  more than a single IRQ at a time is for Multi-MSI, and that is
  definitely a power-of-two construct.

I have seen other reports, all concerning QC based HW allocating silly
(aka non Po2) numbers of interrupts for Nulti-MSI devices, and I think
we should instead address the root cause, most likely in the PCI code.

Thanks,

	M.

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


  reply	other threads:[~2026-03-23 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21 14:12 [PATCH v1] irqchip: fix mask alignment in gic-v2m Javier Achirica
2026-03-23 13:37 ` Marc Zyngier [this message]
2026-03-24 15:08   ` Thomas Gleixner

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=86zf3y4qfp.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=jachirica@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox