The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Jelly Jia <Jelly.Jia@cixtech.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, robin.murphy@arm.com,
	devicetree@vger.kernel.org, cix-kernel-upstream@cixtech.com,
	dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 07/10] dmaengine: arm-dma350: Track descriptor byte lengths explicitly
Date: Fri, 4 Dec 2026 13:23:39 -0600	[thread overview]
Message-ID: <axMTOxEhAHESlVKu@SMW015318> (raw)
In-Reply-To: <20261117094335.1393735-8-Jelly.Jia@cixtech.com>

On Tue, Nov 17, 2026 at 05:43:32PM +0800, Jelly Jia wrote:
> Keep the total transfer length in the descriptor instead of deriving it
> from memcpy/memset-specific size fields. This allows the queued-status and
> start paths to report the total length for linked peripheral work.
>
> Use local size fields when constructing existing memcpy/memset commands.
> Keep these CPU-consumed command words and their MMIO loader in CPU byte
> order; little-endian pool storage is introduced with peripheral support.
>
> Signed-off-by: Jelly Jia <Jelly.Jia@cixtech.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/arm-dma350.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
> index bf87460c1c20..465a8b9b722a 100644
> --- a/drivers/dma/arm-dma350.c
> +++ b/drivers/dma/arm-dma350.c
> @@ -178,8 +178,7 @@ enum ch_cfg_memattr {
>  struct d350_desc {
>  	struct virt_dma_desc vd;
>  	u32 command[16];
> -	u16 xsize;
> -	u16 xsizehi;
> +	size_t bytes;
>  	u8 tsz;
>  };
>
> @@ -224,15 +223,18 @@ static struct dma_async_tx_descriptor *d350_prep_memcpy(struct dma_chan *chan,
>  {
>  	struct d350_chan *dch = to_d350_chan(chan);
>  	struct d350_desc *desc;
> +	u16 xsize;
> +	u16 xsizehi;
>  	u32 *cmd;
>
>  	desc = kzalloc_obj(*desc, GFP_NOWAIT);
>  	if (!desc)
>  		return NULL;
>
> +	desc->bytes = len;
>  	desc->tsz = __ffs(len | dest | src | (1 << dch->tsz));
> -	desc->xsize = lower_16_bits(len >> desc->tsz);
> -	desc->xsizehi = upper_16_bits(len >> desc->tsz);
> +	xsize = lower_16_bits(len >> desc->tsz);
> +	xsizehi = upper_16_bits(len >> desc->tsz);
>
>  	cmd = desc->command;
>  	cmd[0] = LINK_CTRL | LINK_SRCADDR | LINK_SRCADDRHI | LINK_DESADDR |
> @@ -247,8 +249,8 @@ static struct dma_async_tx_descriptor *d350_prep_memcpy(struct dma_chan *chan,
>  	cmd[3] = upper_32_bits(src);
>  	cmd[4] = lower_32_bits(dest);
>  	cmd[5] = upper_32_bits(dest);
> -	cmd[6] = FIELD_PREP(CH_XY_SRC, desc->xsize) | FIELD_PREP(CH_XY_DES, desc->xsize);
> -	cmd[7] = FIELD_PREP(CH_XY_SRC, desc->xsizehi) | FIELD_PREP(CH_XY_DES, desc->xsizehi);
> +	cmd[6] = FIELD_PREP(CH_XY_SRC, xsize) | FIELD_PREP(CH_XY_DES, xsize);
> +	cmd[7] = FIELD_PREP(CH_XY_SRC, xsizehi) | FIELD_PREP(CH_XY_DES, xsizehi);
>  	cmd[8] = dch->coherent ? TRANSCFG_WB : TRANSCFG_NC;
>  	cmd[9] = dch->coherent ? TRANSCFG_WB : TRANSCFG_NC;
>  	cmd[10] = FIELD_PREP(CH_XY_SRC, 1) | FIELD_PREP(CH_XY_DES, 1);
> @@ -262,15 +264,18 @@ static struct dma_async_tx_descriptor *d350_prep_memset(struct dma_chan *chan,
>  {
>  	struct d350_chan *dch = to_d350_chan(chan);
>  	struct d350_desc *desc;
> +	u16 xsize;
> +	u16 xsizehi;
>  	u32 *cmd;
>
>  	desc = kzalloc_obj(*desc, GFP_NOWAIT);
>  	if (!desc)
>  		return NULL;
>
> +	desc->bytes = len;
>  	desc->tsz = __ffs(len | dest | (1 << dch->tsz));
> -	desc->xsize = lower_16_bits(len >> desc->tsz);
> -	desc->xsizehi = upper_16_bits(len >> desc->tsz);
> +	xsize = lower_16_bits(len >> desc->tsz);
> +	xsizehi = upper_16_bits(len >> desc->tsz);
>
>  	cmd = desc->command;
>  	cmd[0] = LINK_CTRL | LINK_DESADDR | LINK_DESADDRHI |
> @@ -283,8 +288,8 @@ static struct dma_async_tx_descriptor *d350_prep_memset(struct dma_chan *chan,
>
>  	cmd[2] = lower_32_bits(dest);
>  	cmd[3] = upper_32_bits(dest);
> -	cmd[4] = FIELD_PREP(CH_XY_DES, desc->xsize);
> -	cmd[5] = FIELD_PREP(CH_XY_DES, desc->xsizehi);
> +	cmd[4] = FIELD_PREP(CH_XY_DES, xsize);
> +	cmd[5] = FIELD_PREP(CH_XY_DES, xsizehi);
>  	cmd[6] = dch->coherent ? TRANSCFG_WB : TRANSCFG_NC;
>  	cmd[7] = FIELD_PREP(CH_XY_DES, 1);
>  	cmd[8] = (u8)value * 0x01010101;
> @@ -387,7 +392,7 @@ static void d350_synchronize(struct dma_chan *chan)
>
>  static u32 d350_desc_bytes(struct d350_desc *desc)
>  {
> -	return ((u32)desc->xsizehi << 16 | desc->xsize) << desc->tsz;
> +	return desc->bytes;
>  }
>
>  static struct virt_dma_desc *d350_find_queued_desc(struct d350_chan *dch,
> --
> 2.54.0
>

  reply	other threads:[~2026-12-04 19:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:43 [PATCH v7 00/10] dmaengine: arm-dma350: Add slave support and Sky1 integration Jelly Jia
2026-11-17  9:43 ` [PATCH v7 01/10] dmaengine: arm-dma350: Fix source trigger bit Jelly Jia
2026-11-17  9:43 ` [PATCH v7 02/10] dmaengine: arm-dma350: Check DMA mask setup errors Jelly Jia
2026-11-20 17:29   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 03/10] dmaengine: arm-dma350: Initialize channel coherency Jelly Jia
2026-12-04 19:11   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 04/10] dmaengine: arm-dma350: Serialize IRQ and termination state Jelly Jia
2026-12-04 19:15   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 05/10] dmaengine: arm-dma350: Report submitted descriptor status Jelly Jia
2026-12-04 19:19   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 06/10] dmaengine: arm-dma350: Use managed device registration Jelly Jia
2026-12-04 19:20   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 07/10] dmaengine: arm-dma350: Track descriptor byte lengths explicitly Jelly Jia
2026-12-04 19:23   ` Frank Li [this message]
2026-11-17  9:43 ` [PATCH v7 08/10] dmaengine: arm-dma350: Add slave and cyclic transfer support Jelly Jia
2026-12-04 19:48   ` Frank Li
2026-11-17  9:43 ` [PATCH v7 09/10] dt-bindings: dma: arm,dma-350: Describe the CIX Sky1 integration Jelly Jia
2026-11-17  9:43 ` [PATCH v7 10/10] dmaengine: arm-dma350: Support integration clocks and resets Jelly Jia
2026-11-30  3:18 ` [PATCH v7 00/10] dmaengine: arm-dma350: Add slave support and Sky1 integration Jelly Jia

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=axMTOxEhAHESlVKu@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=Jelly.Jia@cixtech.com \
    --cc=cix-kernel-upstream@cixtech.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=vkoul@kernel.org \
    /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