@samitouri / QOSamiQemu / commits / 6325407f67

hw/virtio: rename virtio_is_big_endian to virtio_vdev_is_big_endian

Renaming this function removes the confusion with existing virtio_is_big_endian cpu ops. Indeed, virtio_vdev_is_big_endian is *not* calling cpu virtio_is_big_endian everytime. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260212234602.338131-3-pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Pierrick Bouvier committed Feb 12, 2026 at 15:46 UTC 6325407f67d279801b59bbde113fe6cfe6623b83
5 files changed +10 -10
hw/net/virtio-net.c
+2 -2
@@ -301,7 +301,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
301 if (n->needs_vnet_hdr_swap) {
302 error_report("backend does not support %s vnet headers; "
303 "falling back on userspace virtio",
304 - virtio_is_big_endian(vdev) ? "BE" : "LE");
304 + virtio_vdev_is_big_endian(vdev) ? "BE" : "LE");
305 return;
306 }
307
@@ -343,7 +343,7 @@ static int virtio_net_set_vnet_endian_one(VirtIODevice *vdev,
343 NetClientState *peer,
344 bool enable)
345 {
346 - if (virtio_is_big_endian(vdev)) {
346 + if (virtio_vdev_is_big_endian(vdev)) {
347 return qemu_set_vnet_be(peer, enable);
348 } else {
349 return qemu_set_vnet_le(peer, enable);
hw/virtio/vhost.c
+2 -2
@@ -1306,7 +1306,7 @@ int vhost_virtqueue_start(struct vhost_dev *dev,
1306
1307 if (vhost_needs_vring_endian(vdev)) {
1308 r = vhost_virtqueue_set_vring_endian_legacy(dev,
1309 - virtio_is_big_endian(vdev),
1309 + virtio_vdev_is_big_endian(vdev),
1310 vhost_vq_index);
1311 if (r) {
1312 return r;
@@ -1423,7 +1423,7 @@ static int do_vhost_virtqueue_stop(struct vhost_dev *dev,
1423 */
1424 if (vhost_needs_vring_endian(vdev)) {
1425 vhost_virtqueue_set_vring_endian_legacy(dev,
1426 - !virtio_is_big_endian(vdev),
1426 + !virtio_vdev_is_big_endian(vdev),
1427 vhost_vq_index);
1428 }
1429
hw/virtio/virtio-pci.c
+4 -4
@@ -586,13 +586,13 @@ static uint64_t virtio_pci_config_read(void *opaque, hwaddr addr,
586 break;
587 case 2:
588 val = virtio_config_readw(vdev, addr);
589 - if (virtio_is_big_endian(vdev)) {
589 + if (virtio_vdev_is_big_endian(vdev)) {
590 val = bswap16(val);
591 }
592 break;
593 case 4:
594 val = virtio_config_readl(vdev, addr);
595 - if (virtio_is_big_endian(vdev)) {
595 + if (virtio_vdev_is_big_endian(vdev)) {
596 val = bswap32(val);
597 }
598 break;
@@ -625,13 +625,13 @@ static void virtio_pci_config_write(void *opaque, hwaddr addr,
625 virtio_config_writeb(vdev, addr, val);
626 break;
627 case 2:
628 - if (virtio_is_big_endian(vdev)) {
628 + if (virtio_vdev_is_big_endian(vdev)) {
629 val = bswap16(val);
630 }
631 virtio_config_writew(vdev, addr, val);
632 break;
633 case 4:
634 - if (virtio_is_big_endian(vdev)) {
634 + if (virtio_vdev_is_big_endian(vdev)) {
635 val = bswap32(val);
636 }
637 virtio_config_writel(vdev, addr, val);
include/hw/virtio/virtio-access.h
+1 -1
@@ -28,7 +28,7 @@
28 static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
29 {
30 #if defined(LEGACY_VIRTIO_IS_BIENDIAN)
31 - return virtio_is_big_endian(vdev);
31 + return virtio_vdev_is_big_endian(vdev);
32 #elif TARGET_BIG_ENDIAN
33 if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
34 /* Devices conforming to VIRTIO 1.0 or later are always LE. */
include/hw/virtio/virtio.h
+1 -1
@@ -468,7 +468,7 @@ static inline bool virtio_host_has_feature(VirtIODevice *vdev,
468 return virtio_has_feature(vdev->host_features, fbit);
469 }
470
471 -static inline bool virtio_is_big_endian(const VirtIODevice *vdev)
471 +static inline bool virtio_vdev_is_big_endian(const VirtIODevice *vdev)
472 {
473 if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
474 assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);