From: sashiko-bot@kernel.org
To: "Wolfram Sang" <wsa+renesas@sang-engineering.com>
Cc: linux-i3c@lists.infradead.org, Frank.Li@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 2/2] i3c: renesas: add R-Car Gen5 support
Date: Tue, 01 Dec 2026 10:14:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-243057@kernel.org> (raw)
In-Reply-To: <20261201095257.4446-6-wsa+renesas@sang-engineering.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] i3c: renesas: unconditional else in renesas_i3c_main_isr()
clears BST
- [High] i3c: renesas: uncleared INTCLR bits in renesas_i3c_main_isr()
cause IRQ storm
--
commit bdbb91ae79ac40e75be22799e9417fb7d14818fc
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
i3c: renesas: add R-Car Gen5 support
This commit adds R-Car Gen5 support to the Renesas I3C controller driver by
introducing a central interrupt handler for single-IRQ platforms and adding
the renesas,rcar-gen5-i3c compatible string.
> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index 5719b78f05036..e111074540049 100644
> --- a/drivers/i3c/master/renesas-i3c.c
> +++ b/drivers/i3c/master/renesas-i3c.c
[ ... ]
> @@ -1427,6 +1441,52 @@ static irqreturn_t renesas_i3c_start_isr(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> +static irqreturn_t renesas_i3c_main_isr(int irq, void *data)
> +{
> + struct renesas_i3c *i3c = data;
> +
> + u32 ntst, bst, ntst_filterd, bst_filterd;
> + irqreturn_t ret = IRQ_NONE;
> +
> + ntst = renesas_readl(i3c->regs, NTST);
> + ntst_filterd = ntst & renesas_readl(i3c->regs, NTIE);
> + bst = renesas_readl(i3c->regs, BST);
> + bst_filterd = bst & renesas_readl(i3c->regs, BIE);
> +
> + if (ntst_filterd & NTST_TDBEF0) {
> + ret |= renesas_i3c_tx_isr(irq, data);
> + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTTX0);
> + }
> +
> + if (ntst_filterd & NTST_RDBFF0) {
> + ret |= renesas_i3c_rx_isr(irq, data);
> + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRX0);
> + }
> +
> + if (ntst_filterd & NTST_RSPQFF) {
> + ret |= renesas_i3c_resp_isr(irq, data);
> + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRESP);
> + }
> +
> + if (ntst_filterd & ~(NTST_RSPQFF | NTST_RDBFF0 | NTST_TDBEF0)) {
> + renesas_writel(i3c->regs, INTCLR, INTCLR_ALL);
> + ret |= IRQ_HANDLED;
> + }
[Severity: High]
Can gating the INTCLR writes on ntst_filterd leave an INTCLR bit latched and
cause an interrupt storm?
Several paths clear NTIE or NTST without clearing INTCLR. For example,
renesas_i3c_irqs_mask_and_clear_locked() (called from renesas_i3c_stop_isr(),
on transfer timeouts, and when xferqueue.cur is NULL) writes 0 to NTIE and
NTST without touching INTCLR. Similarly, renesas_i3c_resp_isr() clears
NTIE_TDBEIE0 or drains the RX FIFO and clears NTIE_RDBFIE0 after
renesas_i3c_main_isr() has already snapshotted ntst_filterd, and
renesas_i3c_start_isr() clears NTIE_TDBEIE0 on I2C reads without clearing
INTCLR_INTTX0.
If an INTCLR bit is latched when its NTIE or NTST bit is cleared, later calls
to renesas_i3c_main_isr() see ntst_filterd == 0 and never clear INTCLR, while
the unconditional else branch below returns IRQ_HANDLED so the generic IRQ
layer cannot disable the stuck interrupt.
> +
> + if (bst_filterd & BST_STCNDDF) {
> + ret |= renesas_i3c_start_isr(irq, data);
> + } else if (bst_filterd & BST_SPCNDDF) {
> + ret |= renesas_i3c_stop_isr(irq, data);
> + } else if (bst_filterd & BST_TENDF || bst_filterd & BST_NACKDF) {
> + ret |= renesas_i3c_tend_isr(irq, data);
> + } else {
> + renesas_clear_bit(i3c->regs, BST, bst);
> + ret |= IRQ_HANDLED;
> + }
[Severity: High]
Should the final else branch check "else if (bst_filterd)"?
As written, whenever bst_filterd is 0 (such as on any NTST-only interrupt or
a spurious interrupt), this branch clears raw bst status bits in BST without
holding i3c->xferqueue.lock and forces ret |= IRQ_HANDLED. Because
renesas_i3c_hw_init() enables BSTE_ALL_FLAG in BSTE, BST latches status bits
even while their enable bits in BIE are masked. When renesas_i3c_tx_isr()
writes the final I2C byte and enables BIE_TENDIE, returning to
renesas_i3c_main_isr() enters this else block and clears bst in BST, which
can drop BST_TENDF and stall the I2C transfer until timeout. It also
prevents renesas_i3c_main_isr() from ever returning IRQ_NONE.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201095257.4446-4-wsa+renesas@sang-engineering.com?part=2
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2026-12-01 10:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:52 [PATCH 0/2] i3c: renesas: add R-Car Gen5 support Wolfram Sang
2026-12-01 9:52 ` [PATCH 1/2] dt-bindings: i3c: renesas,i3c: " Wolfram Sang
2026-12-01 21:12 ` Frank Li
2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang
2026-12-01 10:14 ` sashiko-bot [this message]
2026-12-01 21:55 ` Frank Li
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-243057@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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