DMA Engine development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: dmaengine@vger.kernel.org,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>
Subject: Re: [PATCH 1/8] dmaengine: ptdma: unmap descriptor before completing cookie
Date: Mon, 12 Oct 2026 09:51:53 -0500	[thread overview]
Message-ID: <asz0CTIrzSgAq5zO@SMW015318> (raw)
In-Reply-To: <20261010124348.19055-2-wsa+renesas@sang-engineering.com>

On Sat, Oct 10, 2026 at 02:43:39PM +0200, Wolfram Sang wrote:
> To ensure that buffers are flushed, make sure that the descriptor gets
> unmapped before completing the cookie.
>
> Link: https://lore.kernel.org/r/20261009093745.539924-1-vkoul@kernel.org
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/dma/amd/ptdma/ptdma-dmaengine.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c
> index 628c49ce5de9..7f51d1e6c727 100644
> --- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c
> +++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c
> @@ -224,8 +224,8 @@ static struct pt_dma_desc *pt_handle_active_desc(struct pt_dma_chan *chan,
>  				if (desc->status != DMA_ERROR)
>  					desc->status = DMA_COMPLETE;
>
> -				dma_cookie_complete(tx_desc);
>  				dma_descriptor_unmap(tx_desc);
> +				dma_cookie_complete(tx_desc);

I think we should consider add new APIs/Helper, such as

dmaengine_unmap_and_cookie_complete(), which do both works.

Frank

>  				list_del(&desc->vd.node);
>  			} else {
>  				/* Don't handle it twice */
> @@ -362,8 +362,8 @@ static void pt_cmd_callback_work(void *data, int err)
>  		if (desc->status != DMA_ERROR)
>  			desc->status = DMA_COMPLETE;
>
> -		dma_cookie_complete(tx_desc);
>  		dma_descriptor_unmap(tx_desc);
> +		dma_cookie_complete(tx_desc);
>  	} else {
>  		tx_desc = NULL;
>  	}
> --
> 2.53.0
>

  parent reply	other threads:[~2026-10-12 14:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 12:43 [PATCH 0/8] dmaengine: unmap descriptor before completing cookie Wolfram Sang
2026-10-10 12:43 ` [PATCH 1/8] dmaengine: ptdma: " Wolfram Sang
2026-10-10 12:57   ` sashiko-bot
2026-10-12 14:51   ` Frank Li [this message]
2026-10-10 12:43 ` [PATCH 2/8] dmaengine: fsl_raid: " Wolfram Sang
2026-10-10 12:43 ` [PATCH 3/8] dmaengine: idxd: " Wolfram Sang
2026-10-10 12:43 ` [PATCH 4/8] dmaengine: ioat: " Wolfram Sang
2026-10-10 12:43 ` [PATCH 5/8] dmaengine: mv_xor_v2: " Wolfram Sang
2026-10-10 12:54   ` sashiko-bot
2026-10-10 12:43 ` [PATCH 6/8] dmaengine: plx_dma: " Wolfram Sang
2026-10-10 12:56   ` sashiko-bot
2026-10-10 12:43 ` [PATCH 7/8] dmaengine: switchtec-dma: " Wolfram Sang
2026-10-10 12:54   ` sashiko-bot
2026-10-10 12:43 ` [PATCH 8/8] dmaengine: xgene-dma: " Wolfram Sang
2026-10-12 10:42 ` [PATCH 0/8] dmaengine: " Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=asz0CTIrzSgAq5zO@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=vkoul@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox