From: sashiko-bot@kernel.org
To: tumic@gpxsee.org
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v2 1/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume
Date: Fri, 20 Nov 2026 16:13:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-225547@kernel.org> (raw)
In-Reply-To: <20261120155924.5785-2-tumic@gpxsee.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dmaengine: xilinx: xdma: duplicated IRQ setup in
xdma_irq_reconfig()
--
commit 704030a92f0e7711c7f9e1160147269d5766e4f9
Author: Martin Tůma <martin.tuma@digiteqautomotive.com>
dmaengine: xilinx: xdma: Fix broken PM suspend/resume
This commit adds noireq PM suspend and resume callbacks to save user IRQ
settings, disable channel interrupts on suspend, and reconfigure DMA
channels and interrupts on resume.
> diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
> index 9d827c9a12674..fa006c9bae23c 100644
> --- a/drivers/dma/xilinx/xdma.c
> +++ b/drivers/dma/xilinx/xdma.c
[ ... ]
> @@ -398,6 +400,28 @@ static int xdma_xfer_stop(struct xdma_chan *xchan)
> CHAN_CTRL_RUN_STOP);
> }
>
> +/**
> + * xdma_reconfig_channels - Reconfigure DMA channels
> + * @xdev: DMA device pointer
> + * @chans: channels configuration
> + * @chan_num: number of channels
> + */
> +static int xdma_reconfig_channels(struct xdma_device *xdev,
> + struct xdma_chan *chans,
> + u32 chan_num)
> +{
> + int i, ret;
> +
> + for (i = 0; i < chan_num; i++) {
> + /* init channel hardware */
> + ret = xdma_channel_init(&(chans[i]));
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> /**
> * xdma_alloc_channels - Detect and allocate DMA channels
> * @xdev: DMA device pointer
> @@ -1018,6 +1042,53 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start,
> return 0;
> }
>
> +/**
> + * xdma_irq_reconfig - Reconfigure IRQs
> + * @xdev: DMA device pointer
> + */
> +static int xdma_irq_reconfig(struct xdma_device *xdev)
> +{
> + u32 user_irq_start;
> + int ret;
> +
> + /* reconfigure hardware IRQ registers */
> + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0,
> + XDMA_CHAN_NUM(xdev));
> + if (ret) {
> + xdma_err(xdev, "failed to reset channel vectors: %d", ret);
> + return ret;
> + }
> +
> + /* reconfigure user IRQ registers if needed */
> + user_irq_start = XDMA_CHAN_NUM(xdev);
> + if (xdev->irq_num > user_irq_start) {
> + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM,
> + user_irq_start,
> + xdev->irq_num - user_irq_start);
> + if (ret) {
> + xdma_err(xdev, "failed to reset user vectors: %d", ret);
> + return ret;
> + }
> + }
> +
> + /* reenable channels interrupts */
> + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0);
> + if (ret) {
> + xdma_err(xdev, "failed to reenable channel IRQs: %d", ret);
> + return ret;
> + }
> +
> + /* reenable user interrupts */
> + ret = regmap_write(xdev->rmap, XDMA_IRQ_USER_INT_EN_W1S,
> + xdev->pm_usr_irq);
> + if (ret) {
> + xdma_err(xdev, "failed to reenable user IRQs: %d", ret);
> + return ret;
> + }
> +
> + return 0;
> +}
[Severity: Low]
This isn't a bug, but xdma_irq_reconfig() duplicates the IRQ vector and
channel interrupt enable setup at the end of xdma_irq_init():
drivers/dma/xilinx/xdma.c:xdma_irq_init() {
...
/* config hardware IRQ registers */
ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0,
XDMA_CHAN_NUM(xdev));
if (ret) {
xdma_err(xdev, "failed to set channel vectors: %d", ret);
goto failed_init_c2h;
}
/* config user IRQ registers if needed */
user_irq_start = XDMA_CHAN_NUM(xdev);
if (xdev->irq_num > user_irq_start) {
ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM,
user_irq_start,
xdev->irq_num - user_irq_start);
if (ret) {
xdma_err(xdev, "failed to set user vectors: %d", ret);
goto failed_init_c2h;
}
}
/* enable interrupt */
ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0);
if (ret)
goto failed_init_c2h;
...
}
Since xdev->pm_usr_irq is 0 during probe and XDMA_IRQ_USER_INT_EN_W1S is
write-1-to-set, could xdma_irq_init() call xdma_irq_reconfig(xdev) instead
of repeating this sequence?
Also, the xdev argument to xdma_reconfig_channels() is unused.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120155924.5785-1-tumic@gpxsee.org?part=1
prev parent reply other threads:[~2026-11-20 16:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 15:59 [PATCH v2 0/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume tumic
2026-11-20 15:59 ` [PATCH v2 1/1] " tumic
2026-11-20 16:13 ` sashiko-bot [this message]
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=sashiko-outbox-225547@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tumic@gpxsee.org \
--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