From nobody Sun Jun 14 00:55:20 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 9E061398902 for ; Tue, 7 Apr 2026 08:53:33 +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=1775552015; cv=none; b=AohHGO4ayo+6HwOhv8bl1nNGXvPqzRO7rW1EDyXNmQje4KR6/uxNgUE/A8ifSeJQqL08fGxIANo7ryKwvrBBFHjkGG5kBdkmP6JjPQS7mZuInaPhLS9uQyUojogmQwDz7omBevc/4jagnjWmensISTYwDgald4JVMVO8IwEWmpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775552015; c=relaxed/simple; bh=Or/zZZGLrrzPf2EdaVK1/ziZnZ6hjMOXO4vgwgcl650=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:To:CC; b=O51KSin1gxGrS38nVfLY7r9NXna+u+q7aY2uR0MR3gAefJhpvcVnRM/LmIUla4aOVfFGjbYFoq9ueZjKvgQUSVV9r4OvLOTZGJJGhL8eRncv9t2hO+I+7MBe9CYaFe1RNG3EG54A4Cjtg4y2ZURPGlybWV1k0hMPoUOfNx8SNBs= 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, 7 Apr 2026 16:53:31 +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, 7 Apr 2026 16:53:31 +0800 From: Billy Tsai Date: Tue, 7 Apr 2026 16:53:23 +0800 Subject: [PATCH v2] 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: <20260407-i3c-hci-dma-v2-1-a583187b9d22@aspeedtech.com> X-B4-Tracking: v=1; b=H4sIAALG1GkC/23Myw6CMBCF4Vchs3ZML2DAFe9hWNTp1M6CS1pCN IR3t7J2+Z/kfDtkTsIZ7tUOiTfJMk8lzKUCim56MYovDUaZm7JWo1jCSIJ+dGid4061z5pbhvJ YEgd5n9pjKB0lr3P6nPimf+t/Z9OokRvypmuorkPoXV6Y/coUrzSPMBzH8QXjuPl8qwAAAA== 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=1775552011; l=2295; i=billy_tsai@aspeedtech.com; s=20251118; h=from:subject:message-id; bh=Or/zZZGLrrzPf2EdaVK1/ziZnZ6hjMOXO4vgwgcl650=; b=n8SoCbmdq9dZlD9L3DECW4FtqqwkcCsYNGvzBj+fZVVvyLgCWvhT/VY/TWhpJcBakudWVnuB2 op5cfD0Ab3zCW2uLURKWURhDkgaaOmOa5SaLq+t782ujqDoTK+UmPXl 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 --- Changes in v2: - EDITME: describe what is new in this series revision. - EDITME: use bulletpoints and terse descriptions. - Link to v1: https://lore.kernel.org/r/20260331-i3c-hci-dma-v1-1-e5cd295c4= 4ff@aspeedtech.com --- Changes in v2: - Fix IBI processing logic to properly handle IBIs without data payload. - Link to v1: https://lore.kernel.org/r/20260331-i3c-hci-dma-v1-1-e5cd295c4= 4ff@aspeedtech.com --- drivers/i3c/master/mipi-i3c-hci/dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mip= i-i3c-hci/dma.c index b903a2da1fd1..c7272155c486 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -721,7 +721,10 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, s= truct hci_rh_data *rh) if (!(ibi_status & IBI_LAST_STATUS)) { ibi_size +=3D chunks * rh->ibi_chunk_sz; } else { - ibi_size +=3D FIELD_GET(IBI_DATA_LENGTH, ibi_status); + if (chunks) { + 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