On 9/7/26 08:39, Michael Tokarev wrote:
On 05.06.2026 16:27, Miao Wang via B4 Relay wrote:
From: Miao Wang <[email protected]>

This patch improves the implementation of the pvscsi device by
translating the endianness of the data sent or received from the guest.
This ensures pvscsi can work on big-endian hosts with little-endian
guests.

Hi!

Can we pick this one up for 11.1 please?
I know right to nothing about s390x internals so can't really review
the change.  But the fix seems to work, and it should be picked up for
the stable qemu series too, it loks like.

I tagged this for review and forgot. Basically we shouldn't using
tswap*() anywhere in system emulation except semihosting. Here it
seems reasonable to use cpu_to_le*()/le*_to_cpu().

Signed-off-by: Miao Wang <[email protected]>
---
  hw/scsi/vmw_pvscsi.c | 58 ++++++++++++++++++++++++++++++++++++++++++ +++++++++-
  1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 11ae6b9b7474b9bc87621137eb7911361b5fd721..883dfe9b6b5dc687737de356da02fe5f68aea7ad 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -35,6 +35,7 @@
  #include "hw/pci/msi.h"
  #include "hw/core/qdev-properties.h"
  #include "exec/cpu-common.h"
+#include "exec/tswap.h"
  #include "vmw_pvscsi.h"
  #include "trace.h"
  #include "qom/object.h"
@@ -392,9 +393,18 @@ static void
  pvscsi_cmp_ring_put(PVSCSIState *s, struct PVSCSIRingCmpDesc *cmp_desc)
  {
      hwaddr cmp_descr_pa;
+    struct PVSCSIRingCmpDesc cmp_desc_conv;
      cmp_descr_pa = pvscsi_ring_pop_cmp_descr(&s->rings);
      trace_pvscsi_cmp_ring_put(cmp_descr_pa);
+    cmp_desc_conv = (struct PVSCSIRingCmpDesc) {
+        .context = tswap64(cmp_desc->context),
+        .dataLen = tswap64(cmp_desc->dataLen),
+        .senseLen = tswap32(cmp_desc->senseLen),
+        .hostStatus = tswap16(cmp_desc->hostStatus),
+        .scsiStatus = tswap16(cmp_desc->scsiStatus),
+    };
+    cmp_desc = &cmp_desc_conv;
      cpu_physical_memory_write(cmp_descr_pa, cmp_desc,

Reply via email to