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=1796290616; b=EBZlPzwD1Ycnl7kAid0iCQO092rDhIW8ox5XyrGMcdZWIm/MBXozx8oUK0eLnHOc6mX0 2xmNUaSSwVzyz6a7DEq7ndMmpV+Ioy9BpALkbzgT6SH9QbMCF22niZeT9TRgEurrAb+Es XT+4xoXYQR3u9fxPGoUEvkBsGBbkh6m0crcmRhgmt6fSxVeJwsUKHl0U/BZEBwm1JsHxZ 9ivkF27r+ot5kNg0UVdDSNd02zmSZOk0lkJowB1Nvtwr9O0OezEPYuGs3Mr4sjOlrhVEv Wmwyknqn7TrtaEvjZWZy2xQghVmUQCgYrFZA36P7NUo1zapI9qHoMQZ/woi2BASt6tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290616; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5n29P/gLCeO2kY9urWMBG4GKSY+lHEte1/OBmxd8lfs=; b=RbUNyyKaOwyj43ytHPD+ZiD/Zjg1H0Lokb2/GgBIw+38Aev+6YUgzcEWCfpT9lJjp545 8bPU9GW0PWjOb+X/AMsuG6gya+imPcsQ4oWWTjwrmEgSJ8E/oHz9y7ZcYVThqo2yJ4Zu3 af7j1TtdHXgPJpmDgt8Pi3j6+Kh5967GviwuM3UbNBF9IHhpyQY0CmwPlFW3nT6rtRBtk onnLl7dbdg00UxlDkDI9KZ8ANq6eo/r3fex7xCpb8+lJYIsUkrTIA/D/Q9Xp3pGYfajGV OeRBr2Qg6XcIvrqtJ1IchfoG8ssfCQoFO1Hww3H+eSuuzSTfW6BUJp882z9IUjTPNOg== 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=TOzoA5GR; 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 3D4D5606A32C for ; Thu, 3 Dec 2026 09:36:56 +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=TOzoA5GR Received: by smtp.kernel.org (Postfix) with ESMTPSA id E577C1F0089B; Thu, 3 Dec 2026 09:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290616; bh=5n29P/gLCeO2kY9urWMBG4GKSY+lHEte1/OBmxd8lfs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=TOzoA5GRk8wB5OCU0E8gE6BsvWU3b2kcjsGYhmuBbmzecjmi8zMawon1NRENbzGtc YMq2Lg+BFyeaNyBvq8VJxbB13DjsCu5P/iT3IpFGOv+8Jpk1gdLbO9Nkj2NREeWHDT WwfFD0E4Un+7CTyS3PkTCly+ceCppw5+SqK61wv+UWWRG4WW8s1guuBz/3kjM+/KQX UZiTiBE6RKM6yIZSpetnaMvMNKuZz9JhfkZcIfVzAYbuj70wBPjPR/hexmdVihjiUL sZGasoqUAjKw4wlQQ3rphDazsexVbddQCfsLAKpRYYU268JDyTCxTMuJyTgjUWqfMY nHBim/q7ljt6g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 2/4] spi: cadence-xspi: Add irq-less support 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-3-paul.cercueil@bootlin.com> References: <20261203091112.9449-1-paul.cercueil@bootlin.com> <20261203091112.9449-3-paul.cercueil@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:36:55 +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 2 potential issues to consider: - [High] spi: cadence-xspi: stale SDMA status bits not cleared in IRQ-less mode - [Medium] spi: cadence-xspi: SDMA errors during sdma_handler() missed without IRQ -- commit 225aa14fe46b19e08b932b29be677c66a07c1404 Author: Tanmay Jagdale spi: cadence-xspi: Add irq-less support This commit makes the IRQ optional in the Cadence XSPI driver and falls back to polling for STIG and SDMA completion when no interrupt line is present. > diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xsp= i.c > index d041f90321f6c..1738a5983f054 100644 > --- a/drivers/spi/spi-cadence-xspi.c > +++ b/drivers/spi/spi-cadence-xspi.c [ ... ] > @@ -687,7 +690,8 @@ static int cdns_xspi_send_stig_command(struct cdns_xs= pi_dev *cdns_xspi, > =20 > reinit_completion(&cdns_xspi->cmd_complete); > reinit_completion(&cdns_xspi->sdma_complete); > - cdns_xspi->set_interrupts_handler(cdns_xspi, true); > + if (cdns_xspi->irq >=3D 0) > + cdns_xspi->set_interrupts_handler(cdns_xspi, true); > cdns_xspi->sdma_error =3D false; [Severity: High] Can stale CDNS_XSPI_SDMA_TRIGGER or CDNS_XSPI_SDMA_ERROR bits in CDNS_XSPI_INTR_STATUS_REG be left latched here when running without an IRQ? Skipping set_interrupts_handler() leaves CDNS_XSPI_INTR_STATUS_REG uncleared before triggering the command, so bits left over from firmware or a prior timed-out transfer remain set. cdns_xspi_is_sdma_ready() polls that register directly and clears the bits only after matching them. A stale CDNS_XSPI_SDMA_TRIGGER bit makes cdns_xspi_is_sdma_ready() return early and run sdma_handler() with stale hardware direction and size registers on the aliased in_buffer/out_buffer union, which can overwrite a caller's TX buffer during a write op. Clearing CDNS_XSPI_SDMA_TRIGGER | CDNS_XSPI_SDMA_ERROR in CDNS_XSPI_INTR_STATUS_REG before triggering the command would prevent stale status bits from being consumed. > @@ -716,20 +720,29 @@ static int cdns_xspi_send_stig_command(struct cdns_= xspi_dev *cdns_xspi, > =20 > cdns_xspi_trigger_command(cdns_xspi, cmd_regs); > =20 > - wait_for_completion(&cdns_xspi->sdma_complete); > - if (cdns_xspi->sdma_error) { > - cdns_xspi->set_interrupts_handler(cdns_xspi, false); > + if (cdns_xspi->irq >=3D 0) { > + wait_for_completion(&cdns_xspi->sdma_complete); > + if (cdns_xspi->sdma_error) { > + cdns_xspi->set_interrupts_handler(cdns_xspi, false); > + return -EIO; > + } > + } else if (!cdns_xspi_is_sdma_ready(cdns_xspi, true)) { > return -EIO; > } > ret =3D cdns_xspi->sdma_handler(cdns_xspi); > if (ret || cdns_xspi->sdma_error) { > - cdns_xspi->set_interrupts_handler(cdns_xspi, false); > + if (cdns_xspi->irq >=3D 0) > + cdns_xspi->set_interrupts_handler(cdns_xspi, false); > return ret ?: -EIO; > } [Severity: Medium] Will SDMA errors raised during sdma_handler() go undetected when cdns_xspi->irq < 0? cdns_xspi->sdma_error is only set by cdns_xspi_irq_handler(), which is not registered in IRQ-less mode. If hardware asserts CDNS_XSPI_SDMA_ERROR while sdma_handler() is transferring data, the check here misses it and the command can return success with partial data. The bit also stays latched in CDNS_XSPI_INTR_STATUS_REG because cdns_xspi_is_stig_ready() only polls CDNS_XSPI_CTRL_STATUS_REG, causing the next data-phase STIG command to fail with -EIO. Reading and clearing CDNS_XSPI_SDMA_ERROR from CDNS_XSPI_INTR_STATUS_REG after sdma_handler() when cdns_xspi->irq < 0 would catch these errors. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203091112.9449= -1-paul.cercueil@bootlin.com?part=3D2