From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev, vkoul@kernel.org,
dmaengine@vger.kernel.org
Subject: Re: [PATCH 3/3] dmaengine: imx-sdma: Use __assign_bit() for ownership configuration
Date: Thu, 03 Sep 2026 14:22:10 +0000 [thread overview]
Message-ID: <20260903142210.D31461F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903-dma-mask-v1-3-211ffd12c236@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unsynchronized read-modify-write on global SDMA hardware registers across multiple channels.
--
commit 4ddf0614a2ae2b19c08cb7e599c4ee441c688f95
Author: Peng Fan <peng.fan@nxp.com>
dmaengine: imx-sdma: Use __assign_bit() for ownership configuration
This commit refactors sdma_config_ownership() by replacing multiple
if/else blocks containing __set_bit() and __clear_bit() with single
calls to __assign_bit().
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index 63261ab6402b9..da565409beaaa 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -710,20 +710,9 @@ static int sdma_config_ownership(struct sdma_channel *sdmac,
> mcu = readl_relaxed(sdma->regs + SDMA_H_HOSTOVR);
> dsp = readl_relaxed(sdma->regs + SDMA_H_DSPOVR);
>
> - if (dsp_override)
> - __clear_bit(channel, &dsp);
> - else
> - __set_bit(channel, &dsp);
> -
> - if (event_override)
> - __clear_bit(channel, &evt);
> - else
> - __set_bit(channel, &evt);
> -
> - if (mcu_override)
> - __clear_bit(channel, &mcu);
> - else
> - __set_bit(channel, &mcu);
> + __assign_bit(channel, &dsp, !dsp_override);
> + __assign_bit(channel, &evt, !event_override);
> + __assign_bit(channel, &mcu, !mcu_override);
>
> writel_relaxed(evt, sdma->regs + SDMA_H_EVTOVR);
> writel_relaxed(mcu, sdma->regs + SDMA_H_HOSTOVR);
[Severity: High]
This isn't a bug introduced by this patch, but does this read-modify-write
sequence require an engine-wide lock?
If multiple DMA clients (such as serial or audio drivers) concurrently call
functions like dmaengine_slave_config() for different channels, could they
race while modifying the global SDMA_H_EVTOVR, SDMA_H_HOSTOVR, and
SDMA_H_DSPOVR hardware registers?
Since the registers are read into local variables, modified, and written back
without serialization, could concurrent calls to sdma_config_ownership() cause
one channel to inadvertently overwrite the configuration of another?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-dma-mask-v1-0-211ffd12c236@nxp.com?part=3
next prev parent reply other threads:[~2026-09-03 14:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 14:16 [PATCH 0/3] dmaengine: Use non-atomic bit ops where safe Peng Fan (OSS)
2026-09-03 14:16 ` [PATCH 1/3] dmaengine: Use non-atomic bit ops for cap_mask manipulation Peng Fan (OSS)
2026-09-03 14:20 ` sashiko-bot
2026-09-03 14:16 ` [PATCH 2/3] dmaengine: imx-sdma: Use non-atomic __set_bit() for event_mask setup Peng Fan (OSS)
2026-09-03 14:23 ` sashiko-bot
2026-09-03 14:16 ` [PATCH 3/3] dmaengine: imx-sdma: Use __assign_bit() for ownership configuration Peng Fan (OSS)
2026-09-03 14:22 ` sashiko-bot [this message]
2026-09-03 19:29 ` [PATCH 0/3] dmaengine: Use non-atomic bit ops where safe Frank Li
2026-09-04 2:08 ` Peng Fan
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=20260903142210.D31461F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=peng.fan@oss.nxp.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.