aboutsummaryrefslogtreecommitdiff
path: root/lib/libvirtio/virtio-blk.c
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2016-02-01 11:17:56 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-02-08 16:40:38 +1100
commitbcdf942b91c3630764e2b8935ffb4c18484053cb (patch)
treee6ff9ef54e95b28ecf3b0562afe41ac202d5323f /lib/libvirtio/virtio-blk.c
parent805cc24afacb799a814327bd91005a5f21fd55fa (diff)
downloadSLOF-bcdf942b91c3630764e2b8935ffb4c18484053cb.zip
SLOF-bcdf942b91c3630764e2b8935ffb4c18484053cb.tar.gz
SLOF-bcdf942b91c3630764e2b8935ffb4c18484053cb.tar.bz2
virtio: introduce helper for initializing virt queue
The routine takes care to allocate and set the queue address in the device. Add these calls in virtio-net, virtio-blk and virtio-9p. With the lack of this routine, devices like virtio-blk and virtio-9p did not do a device reset in the driver initialization code. This helper will fix that problem Change the signature of virtio_set_qaddr, accepting queue address as unsigned long argument. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libvirtio/virtio-blk.c')
-rw-r--r--lib/libvirtio/virtio-blk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libvirtio/virtio-blk.c b/lib/libvirtio/virtio-blk.c
index 6eb4a64..b78ada5 100644
--- a/lib/libvirtio/virtio-blk.c
+++ b/lib/libvirtio/virtio-blk.c
@@ -18,6 +18,8 @@
#define DEFAULT_SECTOR_SIZE 512
+static struct vqs vq;
+
/**
* Initialize virtio-block device.
* @param dev pointer to virtio device information
@@ -44,6 +46,12 @@ virtioblk_init(struct virtio_device *dev)
/* Device specific setup - we support F_BLK_SIZE */
virtio_set_guest_features(dev, VIRTIO_BLK_F_BLK_SIZE);
+ if (virtio_queue_init_vq(dev, &vq, 0)) {
+ virtio_set_status(dev, VIRTIO_STAT_ACKNOWLEDGE|VIRTIO_STAT_DRIVER
+ |VIRTIO_STAT_FAILED);
+ return 0;
+ }
+
vq_avail = virtio_get_vring_avail(dev, 0);
vq_avail->flags = VRING_AVAIL_F_NO_INTERRUPT;
vq_avail->idx = 0;