From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Mark Brown <broonie@kernel.org>,
Jisheng Zhang <jszhang@kernel.org>,
Konrad Kociolek <konrad@cadence.com>,
Jayshri Pawar <jpawar@cadence.com>,
Parshuram Thombare <pthombar@cadence.com>,
Witold Sadowski <wsadowski@marvell.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH v2 10/10] spi: cadence-xspi: Skip tail read for qword-aligned Marvell b0 receives
Date: Fri, 27 Nov 2026 15:31:13 +0000 [thread overview]
Message-ID: <20261127153158.2969573-11-lee@kernel.org> (raw)
In-Reply-To: <20261127153158.2969573-1-lee@kernel.org>
In cdns_xspi_transfer_one_message_b0() the receive path reads len / 8
full qwords and then always calls cdns_xspi_finish_read() to collect
the remaining bytes. cdns_xspi_finish_read() unconditionally advances
current_xfer_qword, even when there are no remaining bytes to read.
The TX-only path only accounts for an extra qword when the length is
not a multiple of 8, so for qword-aligned receives the read index runs
one qword ahead and later chunks and transfers in the same message read
the wrong READ_DATA registers.
Only call cdns_xspi_finish_read() when there is a partial qword left to
read, matching the accounting used by the TX-only path.
Fixes: 931e389ded0f ("spi: cadence: Add Marvell xfer operation support")
Closes: https://sashiko.dev/#/bug/linux-13cf6f1e-c300-4fa1-9cd4-08a48ec4f4b9
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
v1 => v2:
- Rebase onto spi/for-next; no functional changes.
drivers/spi/spi-cadence-xspi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
index aac941aecd47..159b18f2f728 100644
--- a/drivers/spi/spi-cadence-xspi.c
+++ b/drivers/spi/spi-cadence-xspi.c
@@ -1333,7 +1333,9 @@ static int cdns_xspi_transfer_one_message_b0(struct spi_controller *controller,
for (j = 0; j < current_transfer_len / 8; j++)
marvell_xspi_read_single_qword(cdns_xspi, &rxd);
- cdns_xspi_finish_read(cdns_xspi, &rxd, current_transfer_len);
+ if (current_transfer_len % MRVL_XFER_QWORD_BYTECOUNT)
+ cdns_xspi_finish_read(cdns_xspi, &rxd,
+ current_transfer_len);
} else {
cdns_xspi->current_xfer_qword += current_transfer_len /
MRVL_XFER_QWORD_BYTECOUNT;
--
2.56.1.839.g22a8290db9-goog
prev parent reply other threads:[~2026-11-27 15:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:31 [PATCH v2 00/10] spi: Fix DMA, bounds, clock, and chip-select bugs Lee Jones
2026-11-27 15:31 ` [PATCH v2 01/10] spi: fsl-cpm: Map the zero page's address, not its struct page Lee Jones
2026-11-27 15:31 ` [PATCH v2 02/10] spi: bcm2835: Store native chip-select GPIO descriptor per device Lee Jones
2026-11-27 15:31 ` [PATCH v2 03/10] spi: ch341: Limit transfers to the hardware packet size Lee Jones
2026-11-27 15:31 ` [PATCH v2 04/10] spi: sprd-adi: Do not copy uninitialised data to rx_buf on read failure Lee Jones
2026-11-27 15:31 ` [PATCH v2 05/10] spi: topcliff-pch: Advance tx_buf between DMA chunks Lee Jones
2026-11-27 15:31 ` [PATCH v2 06/10] spi: cadence-quadspi: Validate num-cs against CQSPI_MAX_CHIPSELECT Lee Jones
2026-11-27 17:22 ` Théo Lebrun
2026-11-27 15:31 ` [PATCH v2 07/10] spi: cadence-xspi: Zero the tail word in m_iowriteq() Lee Jones
2026-11-27 15:31 ` [PATCH v2 08/10] spi: fsl-qspi: Propagate clock errors from fsl_qspi_select_mem() Lee Jones
2026-11-30 3:32 ` Bough Chen
2026-12-01 9:05 ` Frieder Schrempf
2026-11-27 15:31 ` [PATCH v2 09/10] spi: cadence-xspi: Advance tx pointer between Marvell b0 chunks Lee Jones
2026-11-27 15:31 ` Lee Jones [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=20261127153158.2969573-11-lee@kernel.org \
--to=lee@kernel.org \
--cc=broonie@kernel.org \
--cc=jpawar@cadence.com \
--cc=jszhang@kernel.org \
--cc=konrad@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=pthombar@cadence.com \
--cc=stable@vger.kernel.org \
--cc=wsadowski@marvell.com \
/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.