virtio_is_big_endian already checks for VIRTIO_F_VERSION_1 feature, so this is redundant with big_endian_code. Also, clarify why we explicitly check for ppc64 and arm arch.
Signed-off-by: Pierrick Bouvier <[email protected]> --- include/hw/virtio/virtio-access.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index 1bea3445979..9aed3d1da4f 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -22,21 +22,16 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h" +static inline bool legacy_virtio_is_biendian(void) +{ + return target_ppc64() || target_base_arm(); +} + static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) { - if (target_ppc64() || target_base_arm()) { + if (target_big_endian() || legacy_virtio_is_biendian()) { return virtio_is_big_endian(vdev); } - - if (target_big_endian()) { - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { - /* Devices conforming to VIRTIO 1.0 or later are always LE. */ - return false; - } else { - return true; - } - } - return false; } -- 2.47.3
