From: sashiko-bot@kernel.org
To: "Jisheng Zhang" <jszhang@kernel.org>
Cc: Frank.Li@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
linux-i3c@lists.infradead.org
Subject: Re: [PATCH v3] i3c: dw: reduce do_daa time if there's no client
Date: Wed, 19 Aug 2026 05:22:08 +0000 [thread overview]
Message-ID: <20260819052209.5BA2F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819044833.32611-1-jszhang@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Preexisting bug: `dw_i3c_master_daa` assumes `master->free_pos` is contiguous. A fragmented DAT can cause the hardware to overwrite existing devices and the software to drop newly assigned devices.
--
--- Patch [1]: [PATCH v3] i3c: dw: reduce do_daa time if there's no client ---
commit e31611e77943457ade6c812c1e49e6efc9e01ce2
Author: Jisheng Zhang <jszhang@kernel.org>
i3c: dw: reduce do_daa time if there's no client
This commit modifies dw_i3c_master_daa() to initialize cmd->rx_len to
master->maxdevs. This prevents the driver from attempting to add nonexistent
devices when an address assignment command times out on an empty bus.
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 0a3799a4ce872..4563d8761ba0b 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -921,6 +921,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> goto rpm_out;
> }
> cmd = &xfer->cmds[0];
> + cmd->rx_len = master->maxdevs;
> cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
> cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
> COMMAND_PORT_DEV_INDEX(pos) |
[Severity: High]
This is a pre-existing issue, but does this hardware instruction safely handle
fragmented Device Address Tables (DAT)?
If master->free_pos is fragmented (for example, devices are present at index 0
and 2, but index 1 is detached), dw_i3c_master_get_free_pos() returns pos = 1.
The hardware is then instructed to assign addresses sequentially for
master->maxdevs - 1 devices starting at DEV_INDEX 1.
If the DesignWare I3C hardware sequentially iterates from DEV_INDEX without
skipping occupied slots, won't it assign a new device to the pre-existing
address at DAT[2] during a DAA (like Hot-Join), causing a bus collision?
Furthermore, looking later in dw_i3c_master_daa():
newdevs &= ~olddevs;
If the hardware sequentially overwrote slot 2, that index was originally in
olddevs and is now masked out by this calculation. Won't the driver then
silently drop the newly assigned device since it gets cleared from the
newdevs bitmask?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819044833.32611-1-jszhang@kernel.org?part=1
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2026-08-19 5:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 4:48 [PATCH v3] i3c: dw: reduce do_daa time if there's no client Jisheng Zhang
2026-08-19 5:22 ` sashiko-bot [this message]
2026-08-19 11:52 ` Alexandre Belloni
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=20260819052209.5BA2F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=jszhang@kernel.org \
--cc=linux-i3c@lists.infradead.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