All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Koichiro Den" <den@valinux.co.jp>
Cc: dmaengine@vger.kernel.org, Frank.Li@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH v3 2/3] dmaengine: dw-edma: Configure remote interrupt routing
Date: Thu, 03 Sep 2026 06:57:23 +0000	[thread overview]
Message-ID: <20260903065724.1C0121F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260903064533.2269557-3-den@valinux.co.jp>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Overly restrictive check in dw_edma_device_config_irq_mode unconditionally rejects valid repeated dmaengine_slave_config calls.
--

commit a84fcfcb09487df4c48ca1e301c604e49afc0e26
Author: Koichiro Den <den@valinux.co.jp>

dmaengine: dw-edma: Configure remote interrupt routing

An endpoint function can reserve an endpoint-local channel while the RC
programs it through an exposed register window. Such a channel must route
interrupts remotely and ignore them on the endpoint. Use dma_slave_config
to set per-channel interrupt routing on idle channels of a local
eDMA-compatible instance.

> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index a678c70a78fe6..e3786d960a431 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -177,48 +177,79 @@ dw_edma_get_default_irq_mode(struct dw_edma_chan *chan)
>  						  DW_EDMA_CH_IRQ_REMOTE;
>  }
>  
> +static int dw_edma_device_config_irq_mode(struct dw_edma_chan *chan,
> +					  enum dw_edma_ch_irq_mode mode)
> +{
> +	if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) ||
> +	    (mode != DW_EDMA_CH_IRQ_LOCAL && mode != DW_EDMA_CH_IRQ_REMOTE))
> +		return -EINVAL;
> +
> +	guard(spinlock_irqsave)(&chan->vc.lock);
> +
> +	if (chan->configured || chan->status != EDMA_ST_IDLE ||
> +	    chan->request != EDMA_REQ_NONE)
> +		return -EBUSY;

[Severity: High]
Does this unconditionally reject valid repeated dmaengine_slave_config() calls?

A caller that populates dma_slave_config.peripheral_config with
DW_EDMA_CH_CONFIG_IRQ_MODE and calls dmaengine_slave_config() multiple times
to update standard fields (like src_addr or dst_addr) will face an unexpected
-EBUSY error on all calls after the first.

This happens because chan->configured is set to true at the end of
dw_edma_device_config(), so subsequent calls fail here even if the requested
IRQ mode is identical and the channel is idle.

Should this gracefully allow the call if chan->irq_mode == mode?

> +
> +	WRITE_ONCE(chan->irq_mode, mode);
> +
> +	return 0;
> +}
> +
>  static int dw_edma_device_config(struct dma_chan *dchan,
>  				 struct dma_slave_config *config)
>  {

[ ... ]

> +	if (flags & DW_EDMA_CH_CONFIG_IRQ_MODE) {
> +		switch (chan->dw->chip->mf) {
> +		case EDMA_MF_EDMA_LEGACY:
> +		case EDMA_MF_EDMA_UNROLL:
> +		case EDMA_MF_HDMA_COMPAT:
> +			break;
> +		default:
> +			return -EINVAL;
>  		}
>  
> -		if (cfg_non_ll || non_ll)
> -			chan->non_ll = true;
> -	} else if (config->peripheral_config) {
> -		dev_err(dchan->device->dev,
> -			"peripheral config param applicable only for HDMA\n");
> -		return -EINVAL;
> +		ret = dw_edma_device_config_irq_mode(chan, dw_config->irq_mode);
> +		if (ret)
> +			return ret;
>  	}
>  
> +	chan->non_ll = non_ll;
>  	memcpy(&chan->config, config, sizeof(*config));
>  	chan->configured = true;

[Severity: High]
This is where chan->configured is set to true on the first call, triggering
the -EBUSY on all subsequent calls to dw_edma_device_config_irq_mode().

>  
>  	return 0;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260903064533.2269557-1-den@valinux.co.jp?part=2

  reply	other threads:[~2026-09-03  6:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  6:45 [PATCH v3 0/3] dmaengine: dw-edma: Prepare channels for remote use Koichiro Den
2026-09-03  6:45 ` [PATCH v3 1/3] dmaengine: Allow drivers to assign static channel IDs Koichiro Den
2026-09-03  6:45 ` [PATCH v3 2/3] dmaengine: dw-edma: Configure remote interrupt routing Koichiro Den
2026-09-03  6:57   ` sashiko-bot [this message]
2026-09-04 15:41   ` Frank Li
2026-09-04 17:15     ` Koichiro Den
2026-09-04 17:46       ` Koichiro Den
2026-09-03  6:45 ` [PATCH v3 3/3] dmaengine: dw-edma: Account for the MSI vector offset Koichiro Den

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=20260903065724.1C0121F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=den@valinux.co.jp \
    --cc=dmaengine@vger.kernel.org \
    --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.