All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Frank.Li@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev, linux-serial@vger.kernel.org
Subject: Re: [PATCH 1/2] serial: use dmaengine_get_dma_device() instead of chan->device->dev
Date: Fri, 25 Sep 2026 20:19:57 +0000	[thread overview]
Message-ID: <20260925201958.2FC1A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925200850.1678179-1-Frank.Li@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] dma-mapping: asymmetric dma_map_single/unmap pair in pl011
--

commit fb77536d75ed603638aebc851f73960ddf8efe10
Author: Frank Li <Frank.Li@nxp.com>

serial: use dmaengine_get_dma_device() instead of chan->device->dev

This commit replaces direct access to chan->device->dev with the
dmaengine_get_dma_device() API across multiple serial drivers. This correctly
handles per-channel IOMMU mappings and prepares for making DMA engine
provider structures private.

Link: https://lore.kernel.org/imx/67966b47-22cb-4b07-80c7-2044f557dbcb@app.fastmail.com/

> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index c4824c201e1c3..86729ddbdadc8 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c

[ ... ]

> @@ -609,7 +609,7 @@ static void pl011_dma_tx_callback(void *data)
>  
>  	uart_port_lock_irqsave(&uap->port, &flags);
>  	if (uap->dmatx.queued)
> -		dma_unmap_single(dmatx->chan->device->dev, dmatx->dma,
> +		dma_unmap_single(dmaengine_get_dma_device(dmatx->chan), dmatx->dma,

[Severity: High]
Does this change create an asymmetric map/unmap pair in the PL011 driver?

By updating pl011_dma_tx_callback() to use dmaengine_get_dma_device() for the
unmap operation, it appears to no longer match the map operation in
pl011_dma_tx_refill() which was not updated in this patch:

drivers/tty/serial/amba-pl011.c:pl011_dma_tx_refill() {
    ...
	dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count,
				    DMA_TO_DEVICE);
    ...
}

The DMA API requires the exact same device pointer to be used for both
mapping and unmapping. On platforms where the DMA engine provides per-channel
devices, dmaengine_get_dma_device() will return a different device pointer
than the raw device pointer used during mapping.

Could this break DMA tracking or cause IOMMU faults during standard TX
operations? Should the map operation in pl011_dma_tx_refill() be updated to
use the new API as well?

>  				 dmatx->len, DMA_TO_DEVICE);
>  
>  	dmacr = uap->dmacr;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925200850.1678179-1-Frank.Li@oss.nxp.com?part=1

  parent reply	other threads:[~2026-09-25 20:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 20:08 [PATCH 1/2] serial: use dmaengine_get_dma_device() instead of chan->device->dev Frank.Li
2026-09-25 20:08 ` [PATCH 2/2] serial: amba-pl011: use dmaengine public API instead of raw ops Frank.Li
2026-09-25 20:16   ` sashiko-bot
2026-09-25 20:19 ` sashiko-bot [this message]
2026-09-28  8:51 ` [PATCH 1/2] serial: use dmaengine_get_dma_device() instead of chan->device->dev Andy Shevchenko

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=20260925201958.2FC1A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.Li@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.