Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: "NG, TZE YEE" <tze.yee.ng@altera.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	"Frank.Li@kernel.org" <Frank.Li@kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-i3c@lists.infradead.org" <linux-i3c@lists.infradead.org>
Cc: "NG, ADRIAN HO YIN" <adrian.ho.yin.ng@altera.com>
Subject: Re: [PATCH v5 3/5] i3c: master: dw: Map CCC hardware errors to I3C M0/M2
Date: Mon, 6 Jul 2026 05:56:37 +0000	[thread overview]
Message-ID: <eceadce6-8782-4cb9-b3af-c5451c20cb93@altera.com> (raw)
In-Reply-To: <20260703105931.103B51F00A3F@smtp.kernel.org>

On 3/7/2026 6:59 pm, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] dw_i3c_ccc_set() fails to use dw_i3c_ccc_map_err(), resulting in inconsistent M0 error mapping for CCC SET commands
> --
> 
> commit 0ce229b1e86f48f8bc79433bee08c7da0909bad8
> Author: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
> 
> i3c: master: dw: Map CCC hardware errors to I3C M0/M2
>      
> This commit maps DesignWare I3C master CCC hardware errors to I3C M0/M2 error
> codes. It introduces a new mapping function to handle this translation and
> updates CCC commands to use it.
> 
>> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
>> --- a/drivers/i3c/master/dw-i3c-master.c
>> +++ b/drivers/i3c/master/dw-i3c-master.c
> [ ... ]
>> @@ -781,10 +800,9 @@ static int dw_i3c_ccc_get(struct dw_i3c_master *master, struct i3c_ccc_cmd *ccc)
>>   
>>   	ret = xfer->ret;
>>   	cmd = &xfer->cmds[0];
>> +	ccc->err = dw_i3c_ccc_map_err(cmd->error);
>>   	if (!ret)
>>   		ccc->dests[0].payload.actual_len = cmd->rx_len;
>> -	if (cmd->error == RESPONSE_ERROR_IBA_NACK)
>> -		ccc->err = I3C_ERROR_M2;
> 
> [Severity: Medium]
> Should dw_i3c_ccc_set() also be updated to use the new dw_i3c_ccc_map_err()
> function?
> 
> It looks like dw_i3c_ccc_get() was updated to map M0/M2 errors, but
> dw_i3c_ccc_set() retains the legacy hardcoded check:
> 
> drivers/i3c/master/dw-i3c-master.c:dw_i3c_ccc_set() {
> ...
> 	ret = xfer->ret;
> 	if (xfer->cmds[0].error == RESPONSE_ERROR_IBA_NACK)
> 		ccc->err = I3C_ERROR_M2;
> ...
> }
> 
> Without using the new mapping function here, hardware errors (like CRC,
> Parity, or Frame errors) during CCC SET commands will not be mapped to
> I3C_ERROR_M0, resulting in inconsistent error handling compared to GET
> commands.
> 
>>   
>>   	return ret;
>>   }
> 

Hi maintainers,

Sashiko's comment is valid. dw_i3c_ccc_set() should use 
dw_i3c_ccc_map_err() as well. I will fix it in v6 so SET CCCs get the 
same M0/M2 mapping as GET. SET CCCs are not retried by default, but this 
keeps cmd->err consistent for callers.

Thanks,
Tze Yee

  reply	other threads:[~2026-07-06  5:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 10:51 [PATCH v5 0/5] i3c: Improve CCC reliability with actual_len, validation, and Direct GET retry tze.yee.ng
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-06  5:28     ` NG, TZE YEE
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-06  5:56     ` NG, TZE YEE [this message]
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=eceadce6-8782-4cb9-b3af-c5451c20cb93@altera.com \
    --to=tze.yee.ng@altera.com \
    --cc=Frank.Li@kernel.org \
    --cc=adrian.ho.yin.ng@altera.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-i3c@lists.infradead.org \
    /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