From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 8/9] spi: dw: Use dma_slave_caps bus width helpers
Date: Thu, 30 Jul 2026 14:43:26 +0000 [thread overview]
Message-ID: <20260730144326.B70621F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260730-dmaengine-support-wider-dma-masks-v1-8-3732f1f9d9ca@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] `dw_spi_can_dma` relies on a stale `dws->n_bytes` value, which may cause incorrect DMA fallback or unsupported DMA configuration.
--
--- Patch [8]: [PATCH 8/9] spi: dw: Use dma_slave_caps bus width helpers ---
commit cd2773a5f68d147fd25b2ce32d4b2dd68d630ea4
Author: Nuno Sá <nuno.sa@analog.com>
spi: dw: Use dma_slave_caps bus width helpers
Store the common TX destination and RX source bus widths in a driver-owned
DMA bus width bitmap and populate it through the dma_slave_caps helper.
This avoids depending on the legacy addr_widths masks.
> diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c
> index fe726b9b1780d..2e23ead4a94f9 100644
> --- a/drivers/spi/spi-dw-dma.c
> +++ b/drivers/spi/spi-dw-dma.c
[ ... ]
> @@ -253,7 +253,7 @@ static bool dw_spi_can_dma(struct spi_controller *ctlr,
>
> dma_bus_width = dw_spi_dma_convert_width(dws->n_bytes);
>
[Severity: High]
This is a pre-existing issue, but does dw_spi_can_dma() rely on a stale
dws->n_bytes value here?
The dws->n_bytes field holds the word size of the previous transfer. Should
dw_spi_can_dma() compute the bus width directly from xfer->bits_per_word to
correctly evaluate the DMA capability for the current transfer?
If a device uses different bus widths for successive SPI transfers, an
earlier transfer might use a bus width supported by the DMA controller, but
a later transfer uses an unsupported width. This would cause
dw_spi_can_dma() to incorrectly allow the second transfer to be DMA mapped
because it checks the stale dws->n_bytes from the first transfer.
When the SPI core later executes dw_spi_transfer_one() for the second
transfer, dws->n_bytes is updated to the actual unsupported width, and
dw_spi_dma_setup() attempts to configure the DMA engine with it, causing
dmaengine_slave_config() to fail and aborting the transfer.
> - return dws->dma_addr_widths & BIT(dma_bus_width);
> + return test_bit(dma_bus_width, dws->dma_bus_widths);
> }
>
> static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-dmaengine-support-wider-dma-masks-v1-0-3732f1f9d9ca@analog.com?part=8
next prev parent reply other threads:[~2026-07-30 14:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 14:23 [PATCH 0/9] dmaengine: Support bus widths of 32 bytes and above Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:23 ` [PATCH 1/9] " Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:38 ` sashiko-bot
2026-07-30 19:16 ` Frank Li
2026-07-30 14:23 ` [PATCH 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:39 ` sashiko-bot
2026-07-30 19:23 ` Frank Li
2026-07-30 14:23 ` [PATCH 3/9] dmaengine: dw-axi-dmac: " Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:36 ` sashiko-bot
2026-07-30 19:24 ` Frank Li
2026-07-30 14:23 ` [PATCH 4/9] dmaengine: qcom: gpi: " Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:43 ` sashiko-bot
2026-07-30 19:25 ` Frank Li
2026-07-30 14:23 ` [PATCH 5/9] dmaengine: stm32-dma3: " Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:35 ` sashiko-bot
2026-07-30 19:26 ` Frank Li
2026-07-30 14:23 ` [PATCH 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 19:27 ` Frank Li
2026-07-30 14:23 ` [PATCH 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 19:30 ` Frank Li
2026-07-30 14:23 ` [PATCH 8/9] spi: dw: " Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 14:43 ` sashiko-bot [this message]
2026-07-30 19:31 ` Frank Li
2026-07-30 14:23 ` [PATCH 9/9] dmaengine: Drop legacy bus width fields from dma_slave_caps Nuno Sá via B4 Relay
2026-07-30 14:23 ` Nuno Sá
2026-07-30 19:34 ` Frank Li
2026-07-30 19:05 ` [PATCH 0/9] dmaengine: Support bus widths of 32 bytes and above 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=20260730144326.B70621F00A3D@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 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.