From: sashiko-bot@kernel.org
To: "Lakshay Piplani" <lakshay.piplani@nxp.com>
Cc: devicetree@vger.kernel.org, Frank.Li@kernel.org, robh@kernel.org,
linux-i3c@lists.infradead.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
conor+dt@kernel.org
Subject: Re: [PATCH v18 8/8] i3c: hub: p3h2x4x: Add SMBus slave mode support
Date: Thu, 03 Sep 2026 06:41:40 +0000 [thread overview]
Message-ID: <20260903064140.A89161F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903062108.2712296-9-lakshay.piplani@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] W1C race condition during SMBus overflow handling causes dropped packets due to unintended clearing of buffer receive flags.
--
commit e4cc436823b4732e048945defcd4e5c9e5598e8d
Author: Lakshay Piplani <lakshay.piplani@nxp.com>
i3c: hub: p3h2x4x: Add SMBus slave mode support
Add SMBus slave mode support for the P3H2x4x hub SMBus target ports.
The hub SMBus slave agent can receive downstream payloads into target
buffers and report receive events through IBI.
> diff --git a/drivers/i3c/hub/p3h2840_i3c_hub_smbus.c b/drivers/i3c/hub/p3h2840_i3c_hub_smbus.c
> index a3324cc365956..7fdfa79dfeb6c 100644
> --- a/drivers/i3c/hub/p3h2840_i3c_hub_smbus.c
> +++ b/drivers/i3c/hub/p3h2840_i3c_hub_smbus.c
[ ... ]
> @@ -15,6 +17,178 @@ enum p3h2x4x_smbus_desc_idx {
[ ... ]
> +void p3h2x4x_ibi_handler(struct i3c_device *i3cdev,
> + const struct i3c_ibi_payload *payload)
> +{
[ ... ]
> + /* process data receive buffer */
> + switch (FIELD_GET(BUF_RECEIVED_FLAG_MASK, target_port_status)) {
> + case P3H2X4X_TARGET_BUF_0_RECEIVE_VAL:
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_0, i);
> + break;
> + case P3H2X4X_TARGET_BUF_1_RECEIVE_VAL:
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_1, i);
> + break;
> + case P3H2X4X_TARGET_BUF_0_1_RECEIVE_VAL:
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_0, i);
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_1, i);
> + break;
> + case P3H2X4X_TARGET_BUF_OVRFL_VAL:
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_0, i);
> + p3h2x4x_read_smbus_agent_rx_buf(i3cdev, RCV_BUF_1, i);
> + regmap_write(p3h2x4x_i3c_hub->regmap, P3H2X4X_TP0_SMBUS_AGNT_STS + i,
> + P3H2X4X_TARGET_BUF_OVRFL);
[Severity: High]
Since P3H2X4X_TARGET_BUF_OVRFL is defined in drivers/i3c/hub/p3h2840_i3c_hub.h
as GENMASK(3, 1), does this W1C (write-one-to-clear) operation inadvertently
clear bits 1 and 2 in addition to the overflow bit (bit 3)?
If a new SMBus packet arrives immediately after reading the buffers (which
would set BIT(1) again), writing GENMASK(3, 1) to this W1C status register
would clear the overflow bit but also clear the newly set receive flags.
Can this race condition cause the driver to drop incoming packets without
processing them?
> + dev_err(&i3cdev->dev, "Overflow, reading buffer zero and one\n");
> + break;
> + default:
> + regmap_write(p3h2x4x_i3c_hub->regmap,
> + P3H2X4X_TP0_SMBUS_AGNT_STS + i,
> + target_port_status & BUF_RECEIVED_FLAG_MASK);
> + break;
> + }
> + }
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903062108.2712296-1-lakshay.piplani@nxp.com?part=8
prev parent reply other threads:[~2026-09-03 6:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 6:21 [PATCH v18 0/8] Add support for NXP P3H2x4x I3C hub driver Lakshay Piplani
2026-09-03 6:21 ` [PATCH v18 1/8] i3c: master: Add APIs for I3C hub support Lakshay Piplani
2026-09-03 6:34 ` sashiko-bot
2026-09-03 6:21 ` [PATCH v18 2/8] i3c: master: Add controller-only device operation helpers Lakshay Piplani
2026-09-03 6:35 ` sashiko-bot
2026-09-03 6:21 ` [PATCH v18 3/8] dt-bindings: i3c: Add NXP P3H2x4x i3c-hub support Lakshay Piplani
2026-09-03 6:21 ` [PATCH v18 4/8] mfd: p3h2x4x: Add driver for NXP P3H2x4x i3c hub and on-die regulator Lakshay Piplani
2026-09-03 6:35 ` sashiko-bot
2026-09-03 6:21 ` [PATCH v18 5/8] regulator: p3h2x4x: Add driver for on-die regulators in NXP P3H2x4x i3c hub Lakshay Piplani
2026-09-03 6:31 ` sashiko-bot
2026-09-03 6:21 ` [PATCH v18 6/8] i3c: hub: Add support for the I3C interface in the I3C hub Lakshay Piplani
2026-09-03 6:38 ` sashiko-bot
2026-09-03 6:21 ` [PATCH v18 7/8] i3c: hub: p3h2x4x: Add support for NXP P3H2x4x I3C hub functionality Lakshay Piplani
2026-09-03 6:21 ` [PATCH v18 8/8] i3c: hub: p3h2x4x: Add SMBus slave mode support Lakshay Piplani
2026-09-03 6:41 ` sashiko-bot [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=20260903064140.A89161F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lakshay.piplani@nxp.com \
--cc=linux-i3c@lists.infradead.org \
--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