From nobody Wed Apr 1 12:32:18 2026 Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB63C3BADBD for ; Tue, 31 Mar 2026 10:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774952855; cv=none; b=m6feIxXeHL0c6mmCQ/sAbkVVAU3yiUyhPApjh+Nue3PyRCImtvRY1rLJhZIKvHy/XqyHz6pM/Fq9K+3jOYQjeTjwOYKE/OKhkqVdXBeTb/y95S3GCeaS2pMkRzqRm1CZwgiqEi4hgKXYPpNmJRq+So+XO5GDvD0yDtMWiHhLFfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774952855; c=relaxed/simple; bh=zIgtQhuTmrCeR6fcQehtNEBPNXYnZP35LwWuE5X6gn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:To:CC; b=BQaSuayXd3oa+2HU8haBmh42o8mOOztbK/9qlZxehROgBgvXbvtJ+phfz33ZcDoXSpB4NnTtdNqJ55ZiAqCToUgcr/45h6Joa/ZmfOC5x/KwiRvurj7BFk5Yc3ufP1QztlURcVtYz5kk8nN+Lolix5I+KVDREIujrGCIAH0fwX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 31 Mar 2026 18:27:30 +0800 Received: from [127.0.1.1] (192.168.10.13) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Tue, 31 Mar 2026 18:27:30 +0800 From: Billy Tsai Date: Tue, 31 Mar 2026 18:27:30 +0800 Subject: [PATCH] i3c: mipi-i3c-hci: fix IBI payload length calculation for final status Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20260331-i3c-hci-dma-v1-1-e5cd295c44ff@aspeedtech.com> X-B4-Tracking: v=1; b=H4sIAJGhy2kC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDY2ND3UzjZN2M5EzdlNxEXePExFRLA4skk1SLVCWgjoKi1LTMCrBp0bG 1tQBdlUZGXQAAAA== X-Change-ID: 20260331-i3c-hci-dma-3aae908b4e8e To: Alexandre Belloni , Frank Li , Nicolas Pitre , Boris Brezillon CC: , , "Billy Tsai" X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774952850; l=1768; i=billy_tsai@aspeedtech.com; s=20251118; h=from:subject:message-id; bh=zIgtQhuTmrCeR6fcQehtNEBPNXYnZP35LwWuE5X6gn0=; b=R/dEiDaif6flgd6FrXFdKebF7xzjUq2k2wBtVGbbUfG0G+e9RLulivuC1yZHGtLtzdWWQXdoQ +0deuL57+wgBGvrOAazNFsowVUkkvbK/vpFi4beCh2J6FhWhhe/+hon X-Developer-Key: i=billy_tsai@aspeedtech.com; a=ed25519; pk=/A8qvgZ6CPfnwKgT6/+k+nvXOkN477MshEGJvVdzeeQ= In DMA mode, the IBI status descriptor encodes the payload using CHUNKS (number of chunks) and DATA_LENGTH (valid bytes in the last chunk). All preceding chunks are implicitly full-sized. The current code accumulates full chunk sizes for non-final status descriptors, but for the final status descriptor it only adds DATA_LENGTH. This ignores the contribution of the preceding full chunks described by the same final status entry. As a result, the computed IBI payload length is truncated whenever the final status spans multiple chunks. For example, with a chunk size of 4 bytes, CHUNKS=3D2 and DATA_LENGTH=3D1 should result in a total payload size of 5 bytes, but the current code reports only 1 byte. Fix the calculation by adding the size of (CHUNKS - 1) full chunks plus DATA_LENGTH for the last chunk. Fixes: 9ad9a52cce28 ("i3c/master: introduce the mipi-i3c-hci driver") Signed-off-by: Billy Tsai Reviewed-by: Frank Li --- drivers/i3c/master/mipi-i3c-hci/dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mip= i-i3c-hci/dma.c index b903a2da1fd1..f4c76f168276 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -721,6 +721,7 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, st= ruct hci_rh_data *rh) if (!(ibi_status & IBI_LAST_STATUS)) { ibi_size +=3D chunks * rh->ibi_chunk_sz; } else { + ibi_size +=3D (chunks - 1) * rh->ibi_chunk_sz; ibi_size +=3D FIELD_GET(IBI_DATA_LENGTH, ibi_status); last_ptr =3D ptr; break; --- base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f change-id: 20260331-i3c-hci-dma-3aae908b4e8e Best regards, --=20 Billy Tsai