From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290094; b=B93mpf5HelS7ND4Dk6ypUMjce6B7rPOsdrI2c3x+4yvkQCMxOQSenv7L3fRKfNSpyC8y yP+RHGBLrH4uLK2ue3bnT5i8Rqt3jdpKv31gGc/Zv+rwmVvHPLWkkziN7GekgT1AJbhz3 u8r8c+J5mGO1XqpWjkZ2TTk6LOJs5+I51WP7MywAyKnK3pF4s+YsV2wKEYs9Qii1JmG4j P2Taj5NjKLDsQaZUHkKIqSblDMKknIfaPfL8C837vtu8C9ryeB1aFvsY8pVszBUMNsqZq Xyq8oajIT8vfhytqBN2UI0iZwFlvefEM6hyd4b9MBlZRbp3CxNgRi6szVgtr4jUu6lQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290094; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5+fdFGzxcsOOnZuf0Z347UNr8alb/YkHc26E2f0JKDE=; b=Xd2FuI1EArBkeqbZXb6Xzr7zvjfPlt3/vHHx/qJwtkkb4OlZwL5EZ1djtXp7ZhJd8lhZ pz1iNvNk5Q9ic6GqlCRI2+b/GVCELzRfUqrvo+SJ1e2Y2CfhJe1l23EqgMZp/OGYTtYXE Dt/eYK/QNBZ4NvFnkjAYLe1IUHT01Kcu7Irz2HO7RcJJfYqISG1JdILvpD8B9OXncuFxJ /dBjEbQzB1cqQmWVf7MjOLDxP5Y7VHcUudZQ4Hh0Q8PKoX0hDWSUNSdhzzJltjTdBZbty jHDSEGn38YB/IV+3rtRW0Z7uAgIgnDPh4Qw1xiMuqiz+biWTC/4Dgr1QreHIo0IWq1w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="AfUzqm/b"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E2E1606A339 for ; Thu, 3 Dec 2026 09:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AfUzqm/b Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED5AA1F000C1; Thu, 3 Dec 2026 09:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290094; bh=5+fdFGzxcsOOnZuf0Z347UNr8alb/YkHc26E2f0JKDE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=AfUzqm/bqzMdwVLgLi7JkZTi7sRUi4NvK1wey2MfZFpEn98ixJ2TEA3qQyBO/jJYv KFocVWuBaacQpYDJSVZSMny+Jdmem9iwz16mXmJLZ//+aEBv0KsaFlDZIwrdXYE575 ekn9WqyUTideBMJS1uA26IWO0ZVnzWWPBM0NWhHIiN2F1MiZRoTf8GBFY9gLcB/k26 mn4HyGZ+7iJRKgLHg72OcDKkM5ur6zigP9CjZjoCh3g1uLnKdEOaiL/AlUAcdktctH smRZvY1sWf3G2iqwM6R48aKZcNVyLhf+obG4U4Le3yqUQxSdgBJKjZUD57f6mwIuft S02TnCx3uiIBw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 1/4] spi: cadence-xspi: Handle SDMA errors in cdns_xspi_is_sdma_ready() Reply-To: sashiko-reviews@lists.linux.dev To: "Paul Cercueil" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203091112.9449-2-paul.cercueil@bootlin.com> References: <20261203091112.9449-1-paul.cercueil@bootlin.com> <20261203091112.9449-2-paul.cercueil@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:28:13 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 > 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 > Co-developed-by: Paul Cercueil > Signed-off-by: Paul Cercueil [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-xsp= i.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_x= spi_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. > =20 > /* 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); > =20 > + 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(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203091112.9449= -1-paul.cercueil@bootlin.com?part=3D1