Add a utility function that transfers the endianness sampled
at device reset time to a queue being set up.

Signed-off-by: Marc Zyngier <[email protected]>
---
 tools/kvm/include/kvm/virtio.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 1180a3e..8a9eab5 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -28,6 +28,7 @@ struct virt_queue {
           It's where we assume the next request index is at.  */
        u16             last_avail_idx;
        u16             last_used_signalled;
+       u16             endian;
 };
 
 /*
@@ -165,4 +166,10 @@ static inline void *virtio_get_vq(struct kvm *kvm, u32 
pfn, u32 page_size)
        return guest_flat_to_host(kvm, (u64)pfn * page_size);
 }
 
+static inline void virtio_init_device_vq(struct virtio_device *vdev,
+                                        struct virt_queue *vq)
+{
+       vq->endian = vdev->endian;
+}
+
 #endif /* KVM__VIRTIO_H */
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to