qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC v2 01/12] virtio: Add support for guest setting of que


From: Evgeny Voevodin
Subject: [Qemu-devel] [RFC v2 01/12] virtio: Add support for guest setting of queue size
Date: Mon, 17 Sep 2012 14:00:31 +0400

From: Peter Maydell <address@hidden>

The MMIO virtio transport spec allows the guest to tell the host how
large the queue size is. Add virtio_queue_set_num() function which
implements this in the QEMU common virtio support code.

Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Evgeny Voevodin <address@hidden>
---
 hw/virtio.c |    6 ++++++
 hw/virtio.h |    1 +
 2 files changed, 7 insertions(+)

diff --git a/hw/virtio.c b/hw/virtio.c
index 209c763..5334326 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -628,6 +628,12 @@ target_phys_addr_t virtio_queue_get_addr(VirtIODevice 
*vdev, int n)
     return vdev->vq[n].pa;
 }
 
+void virtio_queue_set_num(VirtIODevice *vdev, int n, int num)
+{
+    vdev->vq[n].vring.num = num;
+    virtqueue_init(&vdev->vq[n]);
+}
+
 int virtio_queue_get_num(VirtIODevice *vdev, int n)
 {
     return vdev->vq[n].vring.num;
diff --git a/hw/virtio.h b/hw/virtio.h
index 7a4f564..eb9953f 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -177,6 +177,7 @@ void virtio_config_writew(VirtIODevice *vdev, uint32_t 
addr, uint32_t data);
 void virtio_config_writel(VirtIODevice *vdev, uint32_t addr, uint32_t data);
 void virtio_queue_set_addr(VirtIODevice *vdev, int n, target_phys_addr_t addr);
 target_phys_addr_t virtio_queue_get_addr(VirtIODevice *vdev, int n);
+void virtio_queue_set_num(VirtIODevice *vdev, int n, int num);
 int virtio_queue_get_num(VirtIODevice *vdev, int n);
 void virtio_queue_notify(VirtIODevice *vdev, int n);
 uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]