[PATCH v2 03/10] hw/virtio: Introduce VirtIODevice::access_is_big_endian boolean field

Philippe Mathieu-Daudé posted 10 patches 1 week ago
There is a newer version of this series
[PATCH v2 03/10] hw/virtio: Introduce VirtIODevice::access_is_big_endian boolean field
Posted by Philippe Mathieu-Daudé 1 week ago
VirtIODevice::access_is_big_endian boolean field, initialized on
device reset, represents whether load/store accesses are ordered
using big endianness.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/virtio/virtio.h | 5 +++++
 hw/virtio/virtio.c         | 1 +
 2 files changed, 6 insertions(+)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 17b105c146d..7a4f7de7475 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -154,6 +154,11 @@ struct VirtIODevice
     VMChangeStateEntry *vmstate;
     char *bus_name;
     uint8_t device_endian;
+    /**
+     * @access_is_big_endian: whether load/store memory accesses are ordered
+     * using big endianness. Might change during device resets.
+     */
+    bool access_is_big_endian;
     /**
      * @user_guest_notifier_mask: gate usage of ->guest_notifier_mask() callback.
      * This is used to suppress the masking of guest updates for
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 86fc0e262f7..242c207a591 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3247,6 +3247,7 @@ void virtio_reset(VirtIODevice *vdev)
         /* System reset */
         vdev->device_endian = virtio_default_endian();
     }
+    vdev->access_is_big_endian = virtio_access_is_big_endian(vdev);
 
     if (k->get_vhost) {
         struct vhost_dev *hdev = k->get_vhost(vdev);
-- 
2.52.0