Define a simple infrastructure to configure a virt_queue
depending on the guest endianness, as reported by the feature
flags. At this stage, the endianness is always the host's.

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

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 820b94a..d6b0f47 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -15,6 +15,10 @@
 #define VIRTIO_PCI_O_CONFIG    0
 #define VIRTIO_PCI_O_MSIX      1
 
+#define VIRTIO_ENDIAN_HOST     0
+#define VIRTIO_ENDIAN_LE       1
+#define VIRTIO_ENDIAN_BE       2
+
 struct virt_queue {
        struct vring    vring;
        u32             pfn;
@@ -22,8 +26,15 @@ struct virt_queue {
           It's where we assume the next request index is at.  */
        u16             last_avail_idx;
        u16             last_used_signalled;
+       u16             endian;
 };
 
+
+static inline void virt_queue__init(struct virt_queue *vq, u32 features)
+{
+       vq->endian = VIRTIO_ENDIAN_HOST;
+}
+
 static inline u16 virt_queue__pop(struct virt_queue *queue)
 {
        return queue->vring.avail->ring[queue->last_avail_idx++ % 
queue->vring.num];
-- 
1.8.2.3


--
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