Hi Philippe Mathieu-Daudé According to my test result this change introduced a minor bug, qemu output error messages "qemu-system-x86_64: virtio-blk missing headers" reproduced command: /usr/local/bin/qemu-system-x86_64 -M q35 -m 8G -smp 8 -cpu host -enable-kvm -device VGA,bus=pcie.0,addr=0x2 -drive file=///home/fedora-40.qcow2,media=disk,if=virtio -device virtio-net-pci,mac=00:11:22:33:44:00,netdev=netdev1,id=net1,bus=pcie.0,addr=0x7 -netdev tap,id=netdev1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown -vnc :0 -monitor stdio QEMU 10.1.50 monitor - type 'help' for more information (qemu) qemu-system-x86_64: virtio-blk missing headers
Thanks Lei On Sat, Oct 11, 2025 at 3:25 AM Farhan Ali <[email protected]> wrote: > > > On 10/10/2025 6:42 AM, Philippe Mathieu-Daudé wrote: > > Replace compile-time #ifdef with a runtime check to ensure all code > > paths are built and tested. This reduces build-time configuration > > complexity and improves maintainability. > > > > No functional change intended. > > > > Signed-off-by: Philippe Mathieu-Daudé <[email protected]> > > --- > > include/hw/virtio/virtio-access.h | 6 +----- > > hw/virtio/vhost.c | 7 +++---- > > 2 files changed, 4 insertions(+), 9 deletions(-) > > > > diff --git a/include/hw/virtio/virtio-access.h > > b/include/hw/virtio/virtio-access.h > > index 07aae69042a..80328912ad3 100644 > > --- a/include/hw/virtio/virtio-access.h > > +++ b/include/hw/virtio/virtio-access.h > > @@ -149,11 +149,7 @@ static inline uint64_t virtio_ldq_p(VirtIODevice > > *vdev, const void *ptr) > > > > static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s) > > { > > -#if HOST_BIG_ENDIAN > > - return virtio_access_is_big_endian(vdev) ? s : bswap16(s); > > -#else > > - return virtio_access_is_big_endian(vdev) ? bswap16(s) : s; > > -#endif > > + return HOST_BIG_ENDIAN ^ virtio_access_is_big_endian(vdev) ? s : > > bswap16(s); > > This patch breaks virtio devices(at least input/net devices) on s390x. I > am not sure if ^ is the right check here? Changing the logic back to how > it was fixes it for me. > > Thanks > > Farhan > > > } > > > > static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev, > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > > index 266a11514a1..6343477b42f 100644 > > --- a/hw/virtio/vhost.c > > +++ b/hw/virtio/vhost.c > > @@ -1168,11 +1168,10 @@ static inline bool > > vhost_needs_vring_endian(VirtIODevice *vdev) > > if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { > > return false; > > } > > -#if HOST_BIG_ENDIAN > > - return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_LITTLE; > > -#else > > + if (HOST_BIG_ENDIAN) { > > + return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_LITTLE; > > + } > > return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG; > > -#endif > > } > > > > static int vhost_virtqueue_set_vring_endian_legacy(struct vhost_dev *dev, >
