From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796400700; b=LoqlFfgyWZ+ZAEL/QzM5RBRJU4CPv4uXwr63ZLejd0a2jvdSn+Veb3hDr74Nm9gyVBwx Ua80Za/YWX7VNwTMCqvLEGzlcndnRoI52e66iqYV9cxDjRYHosau9rROs3ii+IKNUXOKR //AZXqjzgxRhMMSIFOVt95hKjz09fvciFTLxziKDpwnYLjKdIvubnJaEszU+ArbCJ0Oxf LO8aptXyqWvLpwJW2UwiajYwMdn69YyPE5ZB64kBUw5RjqXlrnQjkBsUUv0/EGg2bQrcW 2tA5ky2B/hqOudW9TtZ1J5qf9tDI/K9B1o5YMNbzf7V/enN9FuvTEXc+nxSPx8ikOzg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796400700; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Hnr0KP5R3glIoidM9I4QvBup9o/9JRp/rnk+FvMv1FY=; b=EKinvP7gCUidNBlh3jtQOj9CeZ0UIQax2OxY5t2q9Bl8UQnnLTVTGYun3Ip0DgGex09T lKKsGm4G6nKhxWyoWo6ZG8LtGsSTx5UyWr1INHNlFmLRDJzUsonaeRDZx3DVww5wCA1Py 9PQ/6cLIzsdoXQc+COO5clW0YXQigbGGF7ezxWi6QUQaGnaQgstSKER+kMlSN0Uj4HSFy oTvAM3D8wGXzCkabqo5KxlZiyjoEBFwqt6l2S95IXxbspriCmAaCvMadr3a3K/btbnFUI ciHHR8t544/N/vi79Hk6hiS9B/a8UDErnjWNad77ioLZDcCv9GlzxbvnziX3XMGqyKw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QKZlHl51; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AE13606A332 for ; Fri, 4 Dec 2026 16:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QKZlHl51 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD2D1F00897; Fri, 4 Dec 2026 16:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796400700; bh=Hnr0KP5R3glIoidM9I4QvBup9o/9JRp/rnk+FvMv1FY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=QKZlHl51EY7sJlEpBXfSr+0Rc4wpijq1i4zZFE0KEDwzs68cQIl6q2J6+ZDLxV2Xa ttSqsDRdZByuli8vKYQF6E4cqMLvAAutEQyBo0wyi9xgvwqT17MCfJRFTFVVOC03tS keFro4nu7NzM4VqNwYawkhb8RCKHDo/r//6KcBGzemtORJpb5awNBGoaXEJAosgLbF mpc1NBj97xjL0fTWXxfDjFT/xOStBK+A1gQroF6LfsnKtnkB3HM0gRUSSU6VWtUX9R q1rkvvp1ruF53TbUVjr0gpf367PMlAm1DIvcF9+SMvrq+HO8KkNmUMS6pTz8naLnVG LAXGBm0Umsh5Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers Reply-To: sashiko-reviews@lists.linux.dev To: "Vishnu Santhosh" Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-1-abc2e80a03af@oss.qualcomm.com> References: <20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com> <20261203-qcom-bam-dmux-qmap-v1-1-abc2e80a03af@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 16:11:38 +0000 X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] dmaengine: qcom: bam_dma: uncached RX FIFO reads when callback_result is NULL - [Medium] dmaengine: qcom: bam_dma: dma_rmb() does not order MMIO readl_relaxed() -- commit cd588835da7396c54277f73b33e53000bbc1fb9a Author: Vishnu Santhosh dmaengine: qcom: bam_dma: report residue for completed RX transfers This commit adds bam_update_rx_result() to read hardware-written descriptor sizes from the RX FIFO on transfer completion and report the unused bytes as residue via callback_result. > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index e62e411dc8f8b..b5d661b9af3df 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -834,6 +834,57 @@ static int bam_resume(struct dma_chan *chan) [ ... ] > +static void bam_update_rx_result(struct bam_chan *bchan, > + struct bam_async_desc *async_desc) > +{ > + struct bam_desc_hw *fifo =3D PTR_ALIGN(bchan->fifo_virt, > + sizeof(struct bam_desc_hw)); > + u32 i; > + > + if (async_desc->dir !=3D DMA_DEV_TO_MEM) > + return; > + > + /* Read the written back sizes only after reading BAM_P_SW_OFSTS */ > + dma_rmb(); [Severity: Medium] Is dma_rmb() sufficient to order FIFO reads after the readl_relaxed() of BAM_P_SW_OFSTS in process_channel_irqs()? As Documentation/memory-barriers.txt notes, dma_*() barriers do not order MMIO accesses. On 32-bit ARMv7, dma_rmb() emits dmb(osh) instead of the dsb() used by readl(), allowing bchan->fifo_virt reads to see stale sizes and report a wrong residue to clients like BAM-DMUX. Also, because process_channel_irqs() calls bam_update_rx_result() inside the desc_list loop, the barrier runs once per completed descriptor instead of once per channel interrupt. Using readl() for BAM_P_SW_OFSTS in process_channel_irqs() and removing dma_rmb() here addresses both. > + > + for (i =3D 0; i < async_desc->xfer_len; i++) { > + u16 expected =3D le16_to_cpu(async_desc->curr_desc[i].size); > + u16 received =3D le16_to_cpu(fifo[(bchan->head + i) % > + MAX_DESCRIPTORS].size); [Severity: Medium] Should bam_update_rx_result() return early when !async_desc->vd.tx.callback_result? bchan->fifo_virt is allocated with dma_alloc_wc(), so this loop does up to async_desc->xfer_len uncached reads in hardirq under bchan->vc.lock. Existing clients such as QCE crypto set only a plain callback, so vd->tx_result is discarded and every RX completion pays this latency hit. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-qcom-bam-d= mux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com?part=3D1