[PATCH 1/4] kvm tools: Support VIRTIO_RING_F_EVENT_IDX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Support the event index feature in the virtio spec.

The results are less notifications between the guest and host, and in
result faster operation of the virt queues.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
 tools/kvm/include/kvm/virtio.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index c6c380d..cd24285 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -38,6 +38,8 @@ static inline bool virt_queue__available(struct virt_queue *vq)
 {
 	if (!vq->vring.avail)
 		return 0;
+
+	vring_avail_event(&vq->vring) = vq->last_avail_idx;
 	return vq->vring.avail->idx !=  vq->last_avail_idx;
 }
 
@@ -51,6 +53,11 @@ static inline void *guest_pfn_to_host(struct kvm *kvm, u32 pfn)
 	return guest_flat_to_host(kvm, (unsigned long)pfn << VIRTIO_PCI_QUEUE_ADDR_SHIFT);
 }
 
+static inline int virtio_queue__should_signal(struct virt_queue *vq)
+{
+	return vring_used_event(&vq->vring) <= vq->vring.used->idx;
+}
+
 struct vring_used_elem *virt_queue__set_used_elem(struct virt_queue *queue, u32 head, u32 len);
 
 u16 virt_queue__get_iov(struct virt_queue *queue, struct iovec iov[], u16 *out, u16 *in, struct kvm *kvm);
-- 
1.7.8.rc1

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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux