DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v2 1/9] dmaengine: Support bus widths of 32 bytes and above
Date: Mon, 10 Aug 2026 15:17:25 +0000	[thread overview]
Message-ID: <20260810151725.8F7891F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260810-dmaengine-support-wider-dma-masks-v2-1-1f7b798d035f@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Inconsistent state between legacy `u32` capabilities and new bus width bitmaps due to legacy `device_caps()` modifications.
--

--- Patch [1]: [PATCH v2 1/9] dmaengine: Support bus widths of 32 bytes and above ---
commit cae7966e8491d2d3566b285f48d250a84ed67596
Author: Nuno Sá <nuno.sa@analog.com>

dmaengine: Support bus widths of 32 bytes and above

This commit introduces bitmap-based bus width capabilities to support
bus widths of 32 bytes and above, which exceed the capacity of the
legacy u32 masks. Legacy u32 fields are kept alongside the new bitmaps
to allow incremental conversion of drivers.

> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -593,7 +593,25 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
>  		return -ENXIO;
>  
>  	caps->src_addr_widths = device->src_addr_widths;
> +	if (bitmap_empty(device->src_bus_widths, DMA_SLAVE_BUSWIDTH_MAX)) {
> +		bitmap_zero(caps->src_bus_widths, DMA_SLAVE_BUSWIDTH_MAX);
> +		bitmap_from_arr32(caps->src_bus_widths,
> +				  &device->src_addr_widths, 32);
> +	} else {
> +		bitmap_copy(caps->src_bus_widths, device->src_bus_widths,
> +			    DMA_SLAVE_BUSWIDTH_MAX);
> +	}
> +
>  	caps->dst_addr_widths = device->dst_addr_widths;
> +	if (bitmap_empty(device->dst_bus_widths, DMA_SLAVE_BUSWIDTH_MAX)) {
> +		bitmap_zero(caps->dst_bus_widths, DMA_SLAVE_BUSWIDTH_MAX);
> +		bitmap_from_arr32(caps->dst_bus_widths,
> +				  &device->dst_addr_widths, 32);
> +	} else {
> +		bitmap_copy(caps->dst_bus_widths, device->dst_bus_widths,
> +			    DMA_SLAVE_BUSWIDTH_MAX);
> +	}
> +

[Severity: Medium]
Does this sequence leave the new bitmaps out of sync if a legacy driver
modifies the capabilities dynamically?

Later in dma_get_slave_caps(), the device_caps callback is invoked:

    if (device->device_caps)
        device->device_caps(chan, caps);

Some legacy drivers restrict bus widths dynamically in this callback by
modifying the legacy u32 fields directly. For example, in stm32-dma3.c:

stm32_dma3_caps() {
    ...
    caps->src_addr_widths &= ~BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
}

Because the new bitmaps are populated from the static device capabilities
before the callback is executed, won't these dynamic restrictions be missed
in the new bitmap fields?

When consumers migrate to the new API, could they see unsupported bus widths
as available, potentially leading to invalid configurations?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260810-dmaengine-support-wider-dma-masks-v2-0-1f7b798d035f@analog.com?part=1

  reply	other threads:[~2026-08-10 15:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 15:06 [PATCH v2 0/9] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-08-10 15:06 ` [PATCH v2 1/9] " Nuno Sá
2026-08-10 15:17   ` sashiko-bot [this message]
2026-08-10 17:15   ` Andy Shevchenko
2026-08-10 15:06 ` [PATCH v2 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá
2026-08-10 15:06 ` [PATCH v2 3/9] dmaengine: dw-axi-dmac: " Nuno Sá
2026-08-10 15:18   ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 4/9] dmaengine: qcom: gpi: " Nuno Sá
2026-08-10 15:15   ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 5/9] dmaengine: stm32-dma3: " Nuno Sá
2026-08-10 15:06 ` [PATCH v2 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá
2026-08-10 15:32   ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá
2026-08-10 15:06 ` [PATCH v2 8/9] spi: dw: " Nuno Sá
2026-08-10 15:28   ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 9/9] dmaengine: Drop legacy bus width fields from dma_slave_caps Nuno Sá
2026-08-10 16:56   ` Frank Li

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=20260810151725.8F7891F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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