From: sashiko-bot@kernel.org
To: "Paul Cercueil" <paul.cercueil@bootlin.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 1/4] spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready()
Date: Thu, 03 Dec 2026 09:28:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-247461@kernel.org> (raw)
In-Reply-To: <20261203091112.9449-2-paul.cercueil@bootlin.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] spi: cadence-xspi: stale CDNS_XSPI_SDMA_ERROR aborts next
transfer mid-command
- [Low] spi: cadence-xspi: unconditional W1C clear in
cdns_xspi_is_sdma_ready() drops error
- [Low] spi: cadence-xspi: commit body misspells
cdns_xspi_is_sdma_ready() and lacks why
- [Low] spi: cadence-xspi: missing Fixes trailer for commit 931e389ded0f
--
commit 53c1565afeab2108b0a98116213822b6a6211069
Author: Tanmay Jagdale <tanmay@marvell.com>
> spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready()
>
> Handle SDMA transfer errors reported by the hardware in
> cdns_xspi_is_dma_ready(). When a transfer error is found, just print an
> error message and return false.
[Severity: Low]
The function name here is misspelled as cdns_xspi_is_dma_ready() instead
of cdns_xspi_is_sdma_ready(). It would also help to explain why this
change is needed (for example, that an SDMA error otherwise causes
cdns_xspi_is_sdma_ready() to stall until timeout without logging or
clearing the flag) rather than only restating what the patch does.
>
> Signed-off-by: Tanmay Jagdale <tanmay@marvell.com>
> Co-developed-by: Paul Cercueil <paul.cercueil@bootlin.com>
> Signed-off-by: Paul Cercueil <paul.cercueil@bootlin.com>
[Severity: Low]
This fixes missing SDMA error handling in cdns_xspi_is_sdma_ready().
Should this include:
Fixes: 931e389ded0f ("spi: cadence: Add Marvell xfer operation support")
> diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
> index a42fab719b7af..d041f90321f6c 100644
> --- a/drivers/spi/spi-cadence-xspi.c
> +++ b/drivers/spi/spi-cadence-xspi.c
> @@ -1236,16 +1236,21 @@ static bool cdns_xspi_is_sdma_ready(struct cdns_xspi_dev *cdns_xspi, bool sleep)
> if (readl_relaxed_poll_timeout
> (cdns_xspi->iobase + CDNS_XSPI_INTR_STATUS_REG,
> ctrl_stat,
> - (ctrl_stat & CDNS_XSPI_SDMA_TRIGGER),
> + ctrl_stat & (CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR),
> sleep ? MRVL_XSPI_POLL_DELAY_US : 0,
> sleep ? MRVL_XSPI_POLL_TIMEOUT_US : 0)) {
> return false;
> }
[Severity: Medium]
Can a stale CDNS_XSPI_SDMA_ERROR from a previous sdma_handler() abort the
next transfer mid-command?
In cdns_xspi_transfer_one_message_b0(), CDNS_XSPI_INTR_STATUS_REG is
never cleared before triggering commands, and CDNS_XSPI_SDMA_ERROR is not
checked after sdma_handler() returns (unlike cdns_xspi_send_stig_command(),
which checks sdma_error after sdma_handler() as well).
If hardware raises CDNS_XSPI_SDMA_ERROR during sdma_handler(), that
transfer returns 0 with the error bit latched. The next chunk or message
triggers a new GENERIC and DSEQ command pair, then cdns_xspi_is_sdma_ready()
fails on the stale error and leaves the new command unserviced in hardware.
Clearing stale status bits before triggering commands and checking
CDNS_XSPI_SDMA_ERROR after sdma_handler() would prevent this.
>
> /* Clear the flag */
> - writel(CDNS_XSPI_SDMA_TRIGGER,
> + writel(CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR,
> cdns_xspi->iobase + CDNS_XSPI_INTR_STATUS_REG);
>
> + if (ctrl_stat & CDNS_XSPI_SDMA_ERROR) {
> + dev_err(cdns_xspi->dev, "Slave DMA transaction error\n");
> + return false;
> + }
[Severity: Low]
Could this unconditional write-1-to-clear drop a concurrently asserted
CDNS_XSPI_SDMA_ERROR?
If hardware sets CDNS_XSPI_SDMA_ERROR between readl_relaxed_poll_timeout()
observing only CDNS_XSPI_SDMA_TRIGGER and this writel(), the error bit is
cleared without being seen in ctrl_stat and the function returns true.
Writing ctrl_stat & (CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR) would
clear only the observed bits, matching cdns_xspi_irq_handler().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203091112.9449-1-paul.cercueil@bootlin.com?part=1
next prev parent reply other threads:[~2026-12-03 9:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 9:11 [PATCH v6 0/4] spi: cadence-xspi: Add support for panic mem writes Paul Cercueil
2026-12-03 9:11 ` [PATCH v6 1/4] spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready() Paul Cercueil
2026-12-03 9:28 ` sashiko-bot [this message]
2026-12-03 9:11 ` [PATCH v6 2/4] spi: cadence-xspi: Add irq-less support Paul Cercueil
2026-12-03 9:11 ` [PATCH v6 3/4] spi: cadence-xspi: Add support for panic writes Paul Cercueil
2026-12-03 9:11 ` [PATCH v6 4/4] spi: dt-bindings: cadence: Make XSPI's IRQ line optional Paul Cercueil
2026-12-03 9:20 ` sashiko-bot
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-247461@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=paul.cercueil@bootlin.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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