[PATCH 1/7] kvmtool: virt_queue configuration based on endianness
Marc Zyngier
marc.zyngier at arm.com
Fri Oct 11 10:36:29 EDT 2013
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 <penberg at kernel.org>
Cc: Will Deacon <will.deacon at arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier at arm.com>
---
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
More information about the linux-arm-kernel
mailing list