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>
if (n->needs_vnet_hdr_swap) {
error_report("backend does not support %s vnet headers; "
"falling back on userspace virtio",
- virtio_is_big_endian(vdev) ? "BE" : "LE");
+ virtio_vdev_is_big_endian(vdev) ? "BE" : "LE");
return;
}
NetClientState *peer,
bool enable)
{
- if (virtio_is_big_endian(vdev)) {
+ if (virtio_vdev_is_big_endian(vdev)) {
return qemu_set_vnet_be(peer, enable);
} else {
return qemu_set_vnet_le(peer, enable);
if (vhost_needs_vring_endian(vdev)) {
r = vhost_virtqueue_set_vring_endian_legacy(dev,
- virtio_is_big_endian(vdev),
+ virtio_vdev_is_big_endian(vdev),
vhost_vq_index);
if (r) {
return r;
*/
if (vhost_needs_vring_endian(vdev)) {
vhost_virtqueue_set_vring_endian_legacy(dev,
- !virtio_is_big_endian(vdev),
+ !virtio_vdev_is_big_endian(vdev),
vhost_vq_index);
}
break;
case 2:
val = virtio_config_readw(vdev, addr);
- if (virtio_is_big_endian(vdev)) {
+ if (virtio_vdev_is_big_endian(vdev)) {
val = bswap16(val);
}
break;
case 4:
val = virtio_config_readl(vdev, addr);
- if (virtio_is_big_endian(vdev)) {
+ if (virtio_vdev_is_big_endian(vdev)) {
val = bswap32(val);
}
break;
virtio_config_writeb(vdev, addr, val);
break;
case 2:
- if (virtio_is_big_endian(vdev)) {
+ if (virtio_vdev_is_big_endian(vdev)) {
val = bswap16(val);
}
virtio_config_writew(vdev, addr, val);
break;
case 4:
- if (virtio_is_big_endian(vdev)) {
+ if (virtio_vdev_is_big_endian(vdev)) {
val = bswap32(val);
}
virtio_config_writel(vdev, addr, val);
static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
{
#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
- return virtio_is_big_endian(vdev);
+ return virtio_vdev_is_big_endian(vdev);
#elif 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 virtio_has_feature(vdev->host_features, fbit);
}
-static inline bool virtio_is_big_endian(const VirtIODevice *vdev)
+static inline bool virtio_vdev_is_big_endian(const VirtIODevice *vdev)
{
if (!virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN);