From: tze.yee.ng@altera.com
To: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Frank Li" <Frank.Li@nxp.com>,
linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
"Jorge Marques" <jorge.marques@analog.com>,
"Przemysław Gaj" <pgaj@cadence.com>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Tommaso Merciai" <tommaso.merciai.xr@bp.renesas.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Adrian Ng Ho Yin" <adrian.ho.yin.ng@altera.com>,
"Felix Gu" <ustc.gu@gmail.com>,
"Manikanta Guntupalli" <manikanta.guntupalli@amd.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Jarkko Nikula" <jarkko.nikula@linux.intel.com>,
imx@lists.linux.dev
Subject: [PATCH v5 0/5] i3c: Improve CCC reliability with actual_len, validation, and Direct GET retry
Date: Fri, 3 Jul 2026 03:51:12 -0700 [thread overview]
Message-ID: <cover.1783074850.git.tze.yee.ng@altera.com> (raw)
From: Tze Yee Ng <tze.yee.ng@altera.com>
This series improves I3C Common Command Code (CCC) handling in the I3C
core and master drivers. It separates requested and received GET payload
lengths, validates GET responses centrally, and retries failed Direct GET
CCCs once by default.
The DesignWare I3C master driver reports standard I3C M0/M2 error codes so
the core can decide when a retry is appropriate. Variable-length GET CCC
rules (GETMRL, GETMXDS) are described by callers via optional_bytes.
Patch 1/5 adds actual_len to struct i3c_ccc_cmd_payload.
Patch 2/5 has all I3C master drivers set actual_len on successful GET
transfers and updates core GET helpers to interpret results from actual_len
instead of len.
Patch 3/5 maps DesignWare CCC hardware errors to I3C M0/M2. M2 is reported
only for broadcast address-header NACK (7'h7E). Target address NACK
returns -EIO.
Patch 4/5 adds retries to struct i3c_ccc_cmd, validates GET payload length
in i3c_master_send_ccc_cmd_locked() after a successful transfer, and
retries failed Direct GET CCCs when the driver reports failure or an I3C
error. Validation failures are not retried.
Patch 5/5 adds optional_bytes so callers describe variable-length GET CCC
responses. GETMRL and GETMXDS set optional_bytes at the call site.
Changes in v5:
- Split the series into five patches for clearer review:
actual_len API, driver/core adoption, DW error mapping, core validation/
retry, and optional_bytes.
- Fix regression in v4 patch 1: keep actual_len assignment in
dw_i3c_ccc_get(), not dw_i3c_ccc_set().
- Move actual_len adoption in drivers/i3c/master.c into patch 2 so patch 2
matches its title and works on its own.
- Split optional_bytes into its own patch (5/5); patch 4/5 adds strict
exact-length validation and retry only.
- Do not retry on validation failure; retry only on driver/I3C errors.
- Reset actual_len before each GET retry only when cmd->rnw is set.
- Add @retries kernel-doc for struct i3c_ccc_cmd.
- Simplify i3c_ccc_validate_payload_len() per review (drop redundant
exact-length check when optional_bytes == 0).
- Clarify GETMXDS fallback comment: with optional_bytes = 3, a 2-byte
success on the first attempt no longer needs the shorter retry path.
- Add Reviewed-by: Alexandre Mergnat on patch 3/5.
Changes in v4:
- Add actual_len to keep requested and received lengths separate.
- Map M2 only for broadcast-address NACK; not for target-address NACK.
- Replace CCC-ID-specific validation with generic actual_len /
optional_bytes checks.
- Retry Direct GET CCCs on any error (default once), not only M0/M2.
- Add optional_bytes and cmd->retries to ccc.h; drop req_len and
payload.len save/restore in the core.
- Update SVC, Cadence, ADI, Renesas, and MIPI HCI master drivers.
Changes in v3:
- In dw_i3c_master_end_xfer_locked(), move RESPONSE_ERROR_ADDRESS_NACK to
return -EIO.
Changes in v2:
- Split the monolithic patch into three patches (per review feedback).
- Move GET payload validation and CCC retry from the DW driver to
drivers/i3c/master.c.
- Validate GET CCCs only; drop SET payload-length checks (DW
RESPONSE_PORT_DATA_LEN is 0 on SET).
- Retry GET CCCs only; do not repeat side-effecting SET CCCs.
- Tighten GETMRL validation to exactly 2 or 3 bytes; add GETMXDS
2/5-byte handling.
- Expand M0 mapping to CRC/parity/transfer-abort, not only frame
errors.
- Restore dests[].payload.len before retry and on error return.
- Avoid kmalloc on the common single-destination GET path.
Adrian Ng Ho Yin (5):
i3c: ccc: Add actual_len to struct i3c_ccc_cmd_payload
i3c: master: Report actual GET CCC payload length on success
i3c: master: dw: Map CCC hardware errors to I3C M0/M2
i3c: master: Validate GET CCC payload length and retry Direct GET once
i3c: master: Add optional_bytes for variable-length GET CCC validation
drivers/i3c/master.c | 97 ++++++++++++++++++++++----
drivers/i3c/master/adi-i3c-master.c | 2 +
drivers/i3c/master/dw-i3c-master.c | 27 ++++++-
drivers/i3c/master/i3c-master-cdns.c | 2 +
drivers/i3c/master/mipi-i3c-hci/core.c | 5 +-
drivers/i3c/master/renesas-i3c.c | 2 +
drivers/i3c/master/svc-i3c-master.c | 4 +-
include/linux/i3c/ccc.h | 11 ++-
8 files changed, 128 insertions(+), 22 deletions(-)
--
2.43.7
next reply other threads:[~2026-07-03 10:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 10:51 tze.yee.ng [this message]
2026-07-03 10:51 ` [PATCH v5 1/5] i3c: ccc: Add actual_len to struct i3c_ccc_cmd_payload tze.yee.ng
2026-07-03 10:51 ` [PATCH v5 2/5] i3c: master: Report actual GET CCC payload length on success tze.yee.ng
2026-07-03 11:06 ` sashiko-bot
2026-07-03 10:51 ` [PATCH v5 3/5] i3c: master: dw: Map CCC hardware errors to I3C M0/M2 tze.yee.ng
2026-07-03 10:59 ` sashiko-bot
2026-07-03 10:51 ` [PATCH v5 4/5] i3c: master: Validate GET CCC payload length and retry Direct GET once tze.yee.ng
2026-07-03 10:51 ` [PATCH v5 5/5] i3c: master: Add optional_bytes for variable-length GET CCC validation tze.yee.ng
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=cover.1783074850.git.tze.yee.ng@altera.com \
--to=tze.yee.ng@altera.com \
--cc=Frank.Li@nxp.com \
--cc=adrian.ho.yin.ng@altera.com \
--cc=adrian.hunter@intel.com \
--cc=alexandre.belloni@bootlin.com \
--cc=imx@lists.linux.dev \
--cc=jarkko.nikula@linux.intel.com \
--cc=jorge.marques@analog.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manikanta.guntupalli@amd.com \
--cc=miquel.raynal@bootlin.com \
--cc=pgaj@cadence.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tommaso.merciai.xr@bp.renesas.com \
--cc=ustc.gu@gmail.com \
--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