[PATCH v2] i3c: master: amd: Report direct CCC read length in payload.actual_len

Shubham Patil posted 1 patch 2 weeks, 3 days ago
drivers/i3c/master/amd-i3c-master.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v2] i3c: master: amd: Report direct CCC read length in payload.actual_len
Posted by Shubham Patil 2 weeks, 3 days ago
The I3C core expects master drivers to leave payload.len unchanged and
report the number of bytes received on GET CCCs via payload.actual_len.
The AMD driver was overwriting payload.len after direct read CCCs.

Set payload.actual_len from the directed command's rx_actual in
xi3c_master_send_direct_ccc_cmd() instead of modifying payload.len.

Fixes:629a6ddd1d9a ("i3c: master: Add driver for AMD AXI
I3C master controller")
Signed-off-by: Shubham Patil <shubhamsanjay.patil@amd.com>
---
Changes in v2:
- Added Fixes tag
---
 drivers/i3c/master/amd-i3c-master.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i3c/master/amd-i3c-master.c b/drivers/i3c/master/amd-i3c-master.c
index ef5ad5abb788..f205aa06f9b8 100644
--- a/drivers/i3c/master/amd-i3c-master.c
+++ b/drivers/i3c/master/amd-i3c-master.c
@@ -806,8 +806,8 @@ static int xi3c_master_send_direct_ccc_cmd(struct xi3c_master *master,
 
 	/* Report actual byte count so the core sees the right length on short reads */
 	if (!ret && ccc->rnw)
-		ccc->dests[0].payload.len = min(xfer->cmds[1].rx_actual,
-						ccc->dests[0].payload.len);
+		ccc->dests[0].payload.actual_len = min(xfer->cmds[1].rx_actual,
+						       ccc->dests[0].payload.len);
 
 	return ret;
 }
-- 
2.34.1
Re: [PATCH v2] i3c: master: amd: Report direct CCC read length in payload.actual_len
Posted by Alexandre Belloni 3 days, 21 hours ago
On Tue, 08 Sep 2026 16:42:07 +0530, Shubham Patil wrote:
> The I3C core expects master drivers to leave payload.len unchanged and
> report the number of bytes received on GET CCCs via payload.actual_len.
> The AMD driver was overwriting payload.len after direct read CCCs.
> 
> Set payload.actual_len from the directed command's rx_actual in
> xi3c_master_send_direct_ccc_cmd() instead of modifying payload.len.
> 
> [...]

Applied, thanks!

[1/1] i3c: master: amd: Report direct CCC read length in payload.actual_len
      https://git.kernel.org/i3c/c/bf9ec06c90dc

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Re: [PATCH v2] i3c: master: amd: Report direct CCC read length in payload.actual_len
Posted by Frank Li 2 weeks, 1 day ago
On Tue, Sep 08, 2026 at 04:42:07PM +0530, Shubham Patil wrote:
> The I3C core expects master drivers to leave payload.len unchanged and
> report the number of bytes received on GET CCCs via payload.actual_len.
> The AMD driver was overwriting payload.len after direct read CCCs.
>
> Set payload.actual_len from the directed command's rx_actual in
> xi3c_master_send_direct_ccc_cmd() instead of modifying payload.len.
>
> Fixes:629a6ddd1d9a ("i3c: master: Add driver for AMD AXI
> I3C master controller")
> Signed-off-by: Shubham Patil <shubhamsanjay.patil@amd.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Changes in v2:
> - Added Fixes tag
> ---
>  drivers/i3c/master/amd-i3c-master.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/amd-i3c-master.c b/drivers/i3c/master/amd-i3c-master.c
> index ef5ad5abb788..f205aa06f9b8 100644
> --- a/drivers/i3c/master/amd-i3c-master.c
> +++ b/drivers/i3c/master/amd-i3c-master.c
> @@ -806,8 +806,8 @@ static int xi3c_master_send_direct_ccc_cmd(struct xi3c_master *master,
>
>  	/* Report actual byte count so the core sees the right length on short reads */
>  	if (!ret && ccc->rnw)
> -		ccc->dests[0].payload.len = min(xfer->cmds[1].rx_actual,
> -						ccc->dests[0].payload.len);
> +		ccc->dests[0].payload.actual_len = min(xfer->cmds[1].rx_actual,
> +						       ccc->dests[0].payload.len);
>
>  	return ret;
>  }
> --
> 2.34.1
>