From: sashiko-bot@kernel.org
To: "Ghennadi Procopciuc" <ghennadi.procopciuc@oss.nxp.com>
Cc: imx@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 2/6] irqchip: Add NXP S32N79 MRU MSI controller driver
Date: Fri, 04 Dec 2026 13:56:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-249905@kernel.org> (raw)
In-Reply-To: <20261204-b4-s32n79-mru-msi-v1-2-e66f9b0dfa79@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] irqchip: irq-mru-msi: stale MRU_MBSTAT_MBS0 stuck after
mru_chan_disable()
- [Medium] irqchip: missing readback after status clear in
mru_msi_irq_handler()
- [Medium] irqchip: mru-msi enables channel before irq_startup()
breaking redirect
- [Low] irqchip: irq-mru-msi: spurious irq_set_affinity() warnings on
non-SMP
--
commit 03fca14b0ce76bed8370472a06fe8f139d02a756
Author: Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>
irqchip: Add NXP S32N79 MRU MSI controller driver
This commit adds an MSI parent irqchip driver for the NXP S32N79 Message
Receive Unit (MRU) blocks, exposing each MRU channel mailbox as an MSI
target and demultiplexing the shared per-MRU GIC SPIs.
> diff --git a/drivers/irqchip/irq-mru-msi.c b/drivers/irqchip/irq-mru-msi.c
> new file mode 100644
> index 0000000000000..13d184b2ca2c0
> --- /dev/null
> +++ b/drivers/irqchip/irq-mru-msi.c
> @@ -0,0 +1,402 @@
[ ... ]
> +static void mru_chan_disable(void __iomem *chan)
> +{
> + u32 cfg0 = readl(chan + MRU_CH_CFG0);
> +
> + cfg0 &= ~MRU_CFG0_IE;
> + writel(cfg0, chan + MRU_CH_CFG0);
> +
> + cfg0 &= ~MRU_CFG0_MBE0;
> + writel(cfg0, chan + MRU_CH_CFG0);
> +
> + cfg0 &= ~MRU_CFG0_CHE;
> + writel(cfg0, chan + MRU_CH_CFG0);
> +}
[Severity: Medium]
Can mru_chan_disable() leave MRU_MBSTAT_MBS0 latched after MRU_CFG0_CHE is
cleared?
If an MSI was pending at teardown or arrives before MRU_CFG0_MBE0 is cleared,
MBS0 stays set with CHE clear. Because writes to channel registers are
ignored while CHE is clear, every sibling channel interrupt in
mru_msi_irq_handler() will fail to clear MBS0 and log an unexpected message.
Similarly, mru_msi_domain_alloc() enables the channel before
irq_domain_insert_irq() publishes the revmap entry, leaving a brief window
where a sibling interrupt can observe MBS0 set before the mapping exists.
Clearing MRU_MBSTAT_MBS0 while CHE is still set (or resetting the channel
with MRU_CFG0_CHR) and skipping disabled channels in mru_msi_irq_handler()
would avoid this.
[ ... ]
> +static int mru_msi_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *args)
> +{
[ ... ]
> + irq_domain_set_info(domain, virq, pos, &mru_msi_parent_chip, priv,
> + handle_edge_irq, NULL, NULL);
> +
> + mru_chan_enable(mru_chan_base(priv, pos));
> +
> + return 0;
> +}
[Severity: Medium]
Is it safe to enable the MRU channel in mru_msi_domain_alloc() before
irq_startup() has run irq_chip_redirect_set_affinity()?
When request_irq() uses IRQF_NO_AUTOEN, desc->action is installed while
effective_affinity stays empty and desc->redirect.target_cpu stays 0. If a
mailbox write fires before irq_startup() (for example on a non-PVM PCI MSI
device), demux_redirect_remote() queues desc->redirect.work onto CPU 0.
If CPU 0 is offline (migrate_one_irq() skips unstarted IRQs),
irq_work_queue_on() warns and leaves IRQ_WORK_PENDING | IRQ_WORK_BUSY stuck
on offline CPU 0, dropping future redirected interrupts for that vector and
hanging synchronize_irq() or free_irq() in irq_work_sync().
Moving MRU_CFG0_IE control to irq_mask/irq_unmask (or
irq_startup/irq_shutdown) with MSI_FLAG_PCI_MSI_MASK_PARENT would keep the
channel masked until irq_startup().
[ ... ]
> + for (chan = 0; chan < MRU_CHANS_PER_MRU; chan++) {
> + void __iomem *mbstat = mru->base + chan * MRU_CH_STRIDE +
> + MRU_CH_MBSTAT;
> +
> + if (!(readl(mbstat) & MRU_MBSTAT_MBS0))
> + continue;
> +
> + writel(MRU_MBSTAT_MBS0, mbstat);
> +
> + pos = mru_mru2pos(priv, mru->index, chan);
> + if (!generic_handle_demux_domain_irq(priv->domain, pos))
> + dev_err_ratelimited(priv->dev,
> + "unexpected message on MRU%u channel %u\n",
> + mru->index, chan);
> + }
> +
> + chained_irq_exit(chip, desc);
> +}
[Severity: Medium]
Does this writel(MRU_MBSTAT_MBS0, mbstat) need a readback before dispatching
and exiting the chained handler?
mru->base is mapped with ioremap() (PROT_DEVICE_nGnRE on arm64), so writel()
is posted. For the last channel, or when demux_redirect_remote() redirects
the vector to another CPU, no further read from mru->base occurs before
chained_irq_exit() writes ICC_EOIR1_EL1 or ICC_DIR_EL1.
Because GICv3 system register writes are not ordered behind posted MMIO
writes, the level-high SPI can be deactivated before the clear reaches the
MRU, causing spurious SPI re-entries (or a lost MSI if a redirected handler
re-arms the endpoint before the clear arrives).
A readl(mbstat) right after the write ensures the clear has reached the MRU.
[ ... ]
> + cpu = cpumask_local_spread(i, NUMA_NO_NODE);
> + ret = irq_set_affinity(mru->irq, cpumask_of(cpu));
> + if (ret)
> + dev_warn(dev, "MRU%u: cannot set the SPI affinity: %d\n",
> + i, ret);
[Severity: Low]
Will this log a spurious warning for every MRU on !CONFIG_SMP builds?
CONFIG_NXP_MRU_MSI does not depend on SMP, and on !CONFIG_SMP
irq_set_affinity() is a stub that always returns -EINVAL. Guarding the
affinity setup with if (IS_ENABLED(CONFIG_SMP)) would avoid the boot-time
warnings.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-b4-s32n79-mru-msi-v1-0-e66f9b0dfa79@oss.nxp.com?part=2
next prev parent reply other threads:[~2026-12-04 13:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 12:56 [PATCH 0/6] irqchip: Add NXP S32N79 MRU MSI controller Ghennadi Procopciuc via B4 Relay
2026-12-04 12:56 ` [PATCH 1/6] dt-bindings: interrupt-controller: " Ghennadi Procopciuc via B4 Relay
2026-12-04 13:21 ` sashiko-bot
2026-12-04 12:56 ` [PATCH 2/6] irqchip: Add NXP S32N79 MRU MSI controller driver Ghennadi Procopciuc via B4 Relay
2026-12-04 13:56 ` sashiko-bot [this message]
2026-12-04 17:51 ` Frank Li
2026-12-04 19:26 ` Thomas Gleixner
2026-12-04 12:56 ` [PATCH 3/6] MAINTAINERS: Add entry for " Ghennadi Procopciuc via B4 Relay
2026-12-04 12:56 ` [PATCH 4/6] arm64: dts: s32n79: add MRU MSI controller node Ghennadi Procopciuc via B4 Relay
2026-12-04 14:04 ` sashiko-bot
2026-12-04 12:56 ` [PATCH 5/6] arm64: dts: s32n79-rdb: enable the MRU MSI controller Ghennadi Procopciuc via B4 Relay
2026-12-04 12:56 ` [PATCH 6/6] arm64: dts: s32n79: route the NETC IEP18 MSIs to the MRU Ghennadi Procopciuc via B4 Relay
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=sashiko-outbox-249905@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ghennadi.procopciuc@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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