[PATCH v4 1/3] i2c: xiic: preserve PEC byte length in SMBus block read setup

Abdurrahman Hussain abdurrahman at nexthop.ai
Mon Sep 21 11:22:41 PDT 2026


On Mon Sep 21, 2026 at 1:43 AM PDT, Andi Shyti wrote:
> Hi Abdurraham,
>
> ...
>
>>  		xiic_read_rx(i2c);
>>  		if (xiic_rx_space(i2c) == 0) {
>> +			/*
>> +			 * If the setup path padded a short SMBus block read up
>> +			 * to SMBUS_BLOCK_READ_MIN_LEN for the HW exit
>> +			 * workaround, trim rx_msg->len back to the number of
>> +			 * bytes that are actually valid so the SMBus core's
>> +			 * PEC check reads the right index. Must happen before
>> +			 * the rx_msg = NULL below.
>> +			 */
>> +			if (i2c->rx_msg && i2c->smbus_actual_len)
>> +				i2c->rx_msg->len = i2c->smbus_actual_len;
>
> We do need to reset smbus_actual_len at every xiic_start_recv(),
> otherwise this would be true for every rx_msg. Right?
>
> Andi
>

Right. Patch 3 clears it in the BNB handler, but the ARB_LOST /
TX_ERROR branch goes straight to out: and never reaches it, so an
aborted block read leaves it set for the next receive.

v5 clears it in xiic_start_recv() and drops the now-redundant reset
from patch 3. Patch 2 unchanged.

v5 also tags all three with Fixes: e4c1ff772e1a and Cc: stable - one
commit introduced all three, and a PEC block read needs all three.

Abdurrahman



More information about the linux-arm-kernel mailing list