pvscsi: cannot work on big-endian hosts
<!--
This is the upstream QEMU issue tracker.
If you are able to, it will greatly facilitate bug triage if you attempt
to reproduce the problem with the latest qemu.git master built from
source. See https://www.qemu.org/download/#source for instructions on
how to do this.
QEMU generally supports the last two releases advertised on
https://www.qemu.org/. Problems with distro-packaged versions of QEMU
older than this should be reported to the distribution instead.
See https://www.qemu.org/contribute/report-a-bug/ for additional
guidance.
If this is a security issue, please consult
https://www.qemu.org/contribute/security-process/
-->
## Host environment
- Operating system: Debian Sid <!-- Windows 10 21H1, Fedora 37, etc. -->
- OS/kernel version: 6.12.42 <!-- For POSIX hosts, use `uname -a` -->
- Architecture: s390x (emulated using qemu-s390x on arm64) <!-- x86, ARM, s390x, etc. -->
- QEMU flavor: qemu-system-x86_64 <!-- qemu-system-x86_64, qemu-aarch64, qemu-img, etc. -->
- QEMU version: 11.0.1 <!-- e.g. `qemu-system-x86_64 --version` -->
- QEMU command line:
<!--
Give the smallest, complete command line that exhibits the problem.
If you are using libvirt, virsh, or vmm, you can likely find the QEMU
command line arguments in /var/log/libvirt/qemu/$GUEST.log.
-->
```
qemu-system-x86_64 \
-machine q35,accel=tcg -no-user-config -nodefaults \
-m 256 -smp 1,sockets=1,cores=1,threads=1 \
-display none -serial stdio \
-chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 \
-drive file=/usr/share/OVMF/OVMF.legacy.fd,if=pflash,format=raw,unit=0,readonly=on \
-device pvscsi,id=scsi -drive file=/path/to/random.disk,if=none,format=raw,id=drive0 \
-device scsi-hd,drive=drive0,bus=scsi.0
```
Where `OVMF.legacy.fd` is an OVMF firmware with pvscsi driver enabled
## Emulated/Virtualized environment
- Operating system: N/A <!-- Windows 10 21H1, Fedora 37, etc. -->
- OS/kernel version: N/A <!-- For POSIX guests, use `uname -a`. -->
- Architecture: x86_64 <!-- x86, ARM, s390x, etc. -->
## Description of problem
<!-- Describe the problem, including any error/crash messages seen. -->
The virtual machine hangs in the early stage of the firmware without any
output when emulating x86 virtual machine on s390x with a pvscsi device.
## Steps to reproduce
1. Install `qemu-s390x` userland emulator if no s390x hardware is available
2. Execute `qemu-s390x qemu-system-x86_64 ....`
3. The startup hangs without any output
## Additional information
<!--
Attach logs, stack traces, screenshots, etc. Compress the files if necessary.
If using libvirt, libvirt logs and XML domain information may be relevant.
If attaching binary test cases you should describe where they were obtained
from, preferably linking to the original source. We greatly prefer test cases in
the form of source code that can be audited before compiling by the engineer.
-->
It can be easily seen in the driver code of pvscsi that the command data is
sent through a register in units of 32bits in the native endianness. In the
qemu emulated device code, however, although qemu has done the endianness
translation of the registers, the command data is received as a data stream
and filled into a buffer. When a field of a command data struct is 64bits long,
the upper 32 bits and the lower 32 bits will be flipped resulting the
mis-interpretation of the command data. I also doubt that similar problems also
happen to the code handling the ring buffer and descriptor.
<!--
The line below ensures that proper tags are added to the issue.
Please do not remove it.
-->
issue