Patch "i2c: xiic: defer RX_FULL until all trailing bytes are in FIFO" has been added to the 6.6-stable tree
Quoted 63 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
i2c: xiic: defer
RX_FULLuntil all trailing bytes are in FIFOto the 6.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
i2c-xiic-defer-rx_full-until-all-trailing-bytes-are-.patch
and it can be found in the queue-6.6 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
commit
f350cc9aac60df9c804cf99ea413ea2cb6109edbAuthor: Abdurrahman Hussain <[email protected]> Date: Thu Sep 24 17:10:36 2026 -0700i2c: xiic: defer
RX_FULLuntil all trailing bytes are in FIFO[ Upstream commit
e6fe3ea04f0113fe4d47c03d76e03805a4768ca7]For the normal path of
xiic_smbus_block_read_setup()-- the trailing bytes all fit in one Rx FIFO fill -- RFD was programmed two below the byte count, which fires theRX_FULLinterrupt while the last byte is still in flight.xiic_read_rx()then lands in itsbytes_rem== 1 branch and sets NACK on a byte still on the wire, truncating the read.Without PEC this is harmless: the truncated byte is the dummy one the caller never looks at. With PEC enabled it is the PEC byte itself, and
i2c_smbus_check_pec()fails the transfer with-EBADMSG.Raise the threshold by one so
RX_FULLfires only once every remaining byte is already buffered. That routes the drain through xiic_read_rx()'sbytes_rem== 0 path, which reads everything out and emits the stop cleanly. The only change for the non-PEC case is that the controller waits one extra byte-time before servicing the interrupt.
rfd_setstays inside the 4 bits ofXIIC_RFD_REG_OFFSET: this branch is only reached whenrxmsg_len+pec_len<=IIC_RX_FIFO_DEPTH, so the value is at mostIIC_RX_FIFO_DEPTH- 1.Fixes e4c1ff772e1a ("i2c: xiic: Add smbus_block_read functionality")Signed-off-by Abdurrahman Hussain <[email protected]>Cc <[email protected]> # v6.3+Acked-by Michal Simek <[email protected]>Signed-off-by Andi Shyti <[email protected]>Signed-off-by Sasha Levin <[email protected]>drivers/i2c/busses/i2c-xiic.c +0
-2@@ -558,11 +558,11 @@ static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c) i2c->smbus_actual_len =1 + rxmsg_len + pec_len; }else {/* -* All trailing bytes fit in the Rx FIFO. The widened -* condition above guarantees rxmsg_len + pec_len >= 2,
drivers/i2c/busses/i2c-xiic.c static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c) · line 568
Quoted 10 lines
drivers/i2c/busses/i2c-xiic.c +4
-2-* so this cannot underflow. +* All trailing bytes fit in the Rx FIFO. Defer RX_FULL +* until every one of them is buffered, so the drain +* takes xiic_read_rx()'s bytes_rem == 0 path. */ - rfd_set = rxmsg_len + pec_len -2 ; + rfd_set = rxmsg_len + pec_len -1 ; i2c->rx_msg->len = rxmsg_len +1 + pec_len; }xiic_setreg8 (i2c,XIIC_RFD_REG_OFFSET , rfd_set);
Hi Sasha,
This patch should be avoided. I have send a revert earlier.
Regards,
Abdurrahman
Sasha Levin
maintainerQuoted 8 lines · Sasha Levin
Quoted 5 lines
This is a note to let you know that I've just added the patch titled
i2c: xiic: defer
RX_FULLuntil all trailing bytes are in FIFOto the 6.6-stable tree
This patch should be avoided. I have send a revert earlier.
Thanks, I have dropped it from the 6.18, 6.12 and 6.6 queues.
Signature · 2 lines
Thanks, Sasha