From: stephensportia@gmail.com
To: qemu-devel@nongnu.org
Cc: "Palmer Dabbelt" <palmer@dabbelt.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
qemu-ppc@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Troy Lee" <leetroy@gmail.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Strahinja Jankovic" <strahinja.p.jankovic@gmail.com>,
qemu-arm@nongnu.org, "Tyrone Ting" <kfting@nuvoton.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Aditya Gupta" <adityag@linux.ibm.com>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Francisco Iglesias" <francisco.iglesias@amd.com>,
"Joel Stanley" <joel@jms.id.au>, "Hao Wu" <wuhaotsh@google.com>,
"Glenn Miles" <milesg@linux.ibm.com>,
qemu-riscv@nongnu.org,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"Portia Stephens" <portias@oss.tenstorrent.com>
Subject: [PATCH 4/4] hw/ssi/pnv_spi: Fix dropped upper bytes of ssi transfer
Date: Tue, 25 Aug 2026 14:04:52 +1000 [thread overview]
Message-ID: <20260825040452.1322251-5-stephensportia@gmail.com> (raw)
In-Reply-To: <20260825040452.1322251-1-stephensportia@gmail.com>
From: Portia Stephens <portias@oss.tenstorrent.com>
The pnv_spi model supports transaction sizes of 4 bytes however there
are no in-tree SSI peripherals that support this. Update the model to
use a 8-bit transfer function.
Signed-off-by: Portia Stephens <portias@oss.tenstorrent.com>
---
hw/ssi/pnv_spi.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
index e2a8a710da..481798b1fa 100644
--- a/hw/ssi/pnv_spi.c
+++ b/hw/ssi/pnv_spi.c
@@ -194,32 +194,26 @@ static void spi_response(PnvSpi *s)
static void transfer(PnvSpi *s)
{
- uint32_t tx, rx, payload_len;
+ uint32_t payload_len;
uint8_t rx_byte;
payload_len = fifo8_num_used(&s->tx_fifo);
for (int offset = 0; offset < payload_len; offset += s->transfer_len) {
- tx = 0;
- for (int i = 0; i < s->transfer_len; i++) {
- if ((offset + i) >= payload_len) {
- tx <<= 8;
- } else if (!fifo8_is_empty(&s->tx_fifo)) {
- tx = (tx << 8) | fifo8_pop(&s->tx_fifo);
- } else {
- qemu_log_mask(LOG_GUEST_ERROR, "pnv_spi: TX_FIFO underflow\n");
- }
- }
- rx = ssi_transfer8(s->ssi_bus, tx);
for (int i = 0; i < s->transfer_len; i++) {
if ((offset + i) >= payload_len) {
break;
}
- rx_byte = (rx >> (8 * (s->transfer_len - 1) - i * 8)) & 0xFF;
- if (!fifo8_is_full(&s->rx_fifo)) {
- fifo8_push(&s->rx_fifo, rx_byte);
+
+ if (!fifo8_is_empty(&s->tx_fifo)) {
+ rx_byte = ssi_transfer8(s->ssi_bus, fifo8_pop(&s->tx_fifo));
+ if (!fifo8_is_full(&s->rx_fifo)) {
+ fifo8_push(&s->rx_fifo, rx_byte);
+ } else {
+ qemu_log_mask(LOG_GUEST_ERROR, "pnv_spi: RX_FIFO is full\n");
+ break;
+ }
} else {
- qemu_log_mask(LOG_GUEST_ERROR, "pnv_spi: RX_FIFO is full\n");
- break;
+ qemu_log_mask(LOG_GUEST_ERROR, "pnv_spi: TX_FIFO underflow\n");
}
}
}
--
2.43.0
next prev parent reply other threads:[~2026-08-25 11:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 4:04 [PATCH 0/4] Rename ssi_transfer to ssi_transfer8 stephensportia
2026-08-25 4:04 ` [PATCH 1/4] hw/ssi: " stephensportia
2026-08-27 5:25 ` Alistair
2026-08-25 4:04 ` [PATCH 2/4] hw/ssi/pl022: Fix dropped upper bytes of ssi transfer stephensportia
2026-08-27 5:27 ` Alistair
2026-08-25 4:04 ` [PATCH 3/4] hw/arm/strongarm: Fix dropped upper byte " stephensportia
2026-08-27 5:29 ` Alistair
2026-08-27 9:09 ` Peter Maydell
2026-08-27 10:53 ` Portia Stephens
2026-08-27 11:04 ` Peter Maydell
2026-08-25 4:04 ` stephensportia [this message]
2026-08-27 5:31 ` [PATCH 4/4] hw/ssi/pnv_spi: Fix dropped upper bytes " Alistair
2026-08-27 5:37 ` [PATCH 0/4] Rename ssi_transfer to ssi_transfer8 Alistair
2026-08-27 9:20 ` Peter Maydell
2026-08-27 11:06 ` Alistair
2026-08-27 10:31 ` Philippe Mathieu-Daudé
2026-08-27 9:19 ` Peter Maydell
2026-08-27 10:35 ` Philippe Mathieu-Daudé
2026-08-27 10:37 ` Portia Stephens
2026-08-27 10:53 ` Peter Maydell
2026-08-27 11:03 ` Alistair
2026-08-27 11:17 ` Peter Maydell
2026-08-28 0:07 ` Alistair
2026-08-31 13:00 ` Cédric Le Goater
2026-09-01 8:56 ` Bin Meng
2026-08-27 12:52 ` Portia Stephens
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=20260825040452.1322251-5-stephensportia@gmail.com \
--to=stephensportia@gmail.com \
--cc=adityag@linux.ibm.com \
--cc=alistair@alistair23.me \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=edgar.iglesias@gmail.com \
--cc=francisco.iglesias@amd.com \
--cc=harshpb@linux.ibm.com \
--cc=jamin_lin@aspeedtech.com \
--cc=jcd@tribudubois.net \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=kfting@nuvoton.com \
--cc=leetroy@gmail.com \
--cc=milesg@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@mailo.com \
--cc=portias@oss.tenstorrent.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=strahinja.p.jankovic@gmail.com \
--cc=sundeep.lkml@gmail.com \
--cc=wuhaotsh@google.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.