From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42DD126CE33; Fri, 21 Nov 2025 13:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732607; cv=none; b=sMK7vCCubyOLyMZEn0qrRR2sR21x28MWa9s9bFUc140nNuAn2a3MpOYJ6aR+FrOJOcqY8LF2aO4UDMEhsyVDpgwl8AV/OWSM6yQhMal7BbKATkk4X8QonZrgaVTO1xm29AMlziZHtfN/FvEqI3fwyeH7DGmQLc19/7nfPJ+SzGA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732607; c=relaxed/simple; bh=dTisBosMkuA+1UZ5/Rbb1ax0o5/P6v3/WN6SRhKVljE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYnU2YiMXYw6wIRctFYM4e63EPoCCLJJnX0jQfaDfD6HvkMAn+PzmbJ4Da5DGmlhSWWCVelC64Xd/ThZeJn0wmrACUv1h9ji4ZA6pQtcOnVGzjm9U4xRfjbMnnL/U31ghrVzS7FLjadg9xB5ryOuMwvVF3gqTw1JAibonZ4PagQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=erOaYkiw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="erOaYkiw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFF15C4CEF1; Fri, 21 Nov 2025 13:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732607; bh=dTisBosMkuA+1UZ5/Rbb1ax0o5/P6v3/WN6SRhKVljE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=erOaYkiwLoBryZ+B11oO01iXMCl1MF0ta2O/sFpqCqld08bEZ93vfzWGO3sI6MZdl 4rXljmhTgXGfuKTYa+06t0+mvDsaJ3vKz1uky/hoPQi3miT2J1/iHx92ZAh1Xa18xv p7uQLKMVq0rH5u2da89hVGxWIyOwB2GBtGKHeHb0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Devendra K Verma , Vinod Koul , Sasha Levin Subject: [PATCH 6.6 181/529] dmaengine: dw-edma: Set status for callback_result Date: Fri, 21 Nov 2025 14:08:00 +0100 Message-ID: <20251121130237.457269267@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Devendra K Verma [ Upstream commit 5e742de97c806a4048418237ef1283e7d71eaf4b ] DMA Engine has support for the callback_result which provides the status of the request and the residue. This helps in determining the correct status of the request and in efficient resource management of the request. The 'callback_result' method is preferred over the deprecated 'callback' method. Signed-off-by: Devendra K Verma Link: https://lore.kernel.org/r/20250821121505.318179-1-devverma@amd.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/dw-edma/dw-edma-core.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 68236247059d1..9ae789d4aca7b 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -595,6 +595,25 @@ dw_edma_device_prep_interleaved_dma(struct dma_chan *dchan, return dw_edma_device_transfer(&xfer); } +static void dw_hdma_set_callback_result(struct virt_dma_desc *vd, + enum dmaengine_tx_result result) +{ + u32 residue = 0; + struct dw_edma_desc *desc; + struct dmaengine_result *res; + + if (!vd->tx.callback_result) + return; + + desc = vd2dw_edma_desc(vd); + if (desc) + residue = desc->alloc_sz - desc->xfer_sz; + + res = &vd->tx_result; + res->result = result; + res->residue = residue; +} + static void dw_edma_done_interrupt(struct dw_edma_chan *chan) { struct dw_edma_desc *desc; @@ -608,6 +627,8 @@ static void dw_edma_done_interrupt(struct dw_edma_chan *chan) case EDMA_REQ_NONE: desc = vd2dw_edma_desc(vd); if (!desc->chunks_alloc) { + dw_hdma_set_callback_result(vd, + DMA_TRANS_NOERROR); list_del(&vd->node); vchan_cookie_complete(vd); } @@ -644,6 +665,7 @@ static void dw_edma_abort_interrupt(struct dw_edma_chan *chan) spin_lock_irqsave(&chan->vc.lock, flags); vd = vchan_next_desc(&chan->vc); if (vd) { + dw_hdma_set_callback_result(vd, DMA_TRANS_ABORTED); list_del(&vd->node); vchan_cookie_complete(vd); } -- 2.51.0