[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/2] virtio: add virtqueue_rewind
From: |
Roman Kagan |
Subject: |
[Qemu-devel] [PATCH 1/2] virtio: add virtqueue_rewind |
Date: |
Thu, 1 Sep 2016 21:13:59 +0300 |
If the in-use elements aren't migrated (like is the case with
virtio-balloon stats vq), make virtqueue forget about them and pretend
they haven't been popped yet, to allow to start over on load.
Signed-off-by: Roman Kagan <address@hidden>
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Ladi Prosek <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
---
hw/virtio/virtio.c | 6 ++++++
include/hw/virtio/virtio.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 74c085c..844d2a1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -272,6 +272,12 @@ void virtqueue_discard(VirtQueue *vq, const
VirtQueueElement *elem,
virtqueue_unmap_sg(vq, elem, len);
}
+void virtqueue_rewind(VirtQueue *vq)
+{
+ vq->last_avail_idx -= vq->inuse;
+ vq->inuse = 0;
+}
+
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx)
{
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index d2490c1..9f49fa4 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -154,6 +154,7 @@ void virtqueue_push(VirtQueue *vq, const VirtQueueElement
*elem,
void virtqueue_flush(VirtQueue *vq, unsigned int count);
void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len);
+void virtqueue_rewind(VirtQueue *vq);
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx);
--
2.7.4
- [Qemu-devel] [PATCH 0/2] virtio-balloon: resume collecting stats on vmload, Roman Kagan, 2016/09/01
- [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Roman Kagan, 2016/09/01
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Michael S. Tsirkin, 2016/09/01
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Roman Kagan, 2016/09/02
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Michael S. Tsirkin, 2016/09/02
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Roman Kagan, 2016/09/05
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Michael S. Tsirkin, 2016/09/05
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Roman Kagan, 2016/09/06
- Re: [Qemu-devel] [PATCH 2/2] virtio-balloon: resume collecting stats on vmload, Michael S. Tsirkin, 2016/09/06
[Qemu-devel] [PATCH 1/2] virtio: add virtqueue_rewind,
Roman Kagan <=