[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/16] virtio: add virtio_queue_get_id
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 03/16] virtio: add virtio_queue_get_id |
Date: |
Thu, 19 Apr 2012 16:29:23 +0200 |
Serializing virtio-scsi requests needs a simple way to get from a
VirtQueue to the number of the queue. The virtio_queue_get_id
provides this.
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/virtio.c | 7 +++++++
hw/virtio.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/hw/virtio.c b/hw/virtio.c
index 064aecf..314abf8 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -624,6 +624,13 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n)
return vdev->vq[n].vring.num;
}
+int virtio_queue_get_id(VirtQueue *vq)
+{
+ VirtIODevice *vdev = vq->vdev;
+ assert(vq >= &vdev->vq[0] && vq < &vdev->vq[VIRTIO_PCI_QUEUE_MAX]);
+ return vq - &vdev->vq[0];
+}
+
void virtio_queue_notify_vq(VirtQueue *vq)
{
if (vq->vring.desc) {
diff --git a/hw/virtio.h b/hw/virtio.h
index 400c092..0aef7d1 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -229,6 +229,7 @@ target_phys_addr_t virtio_queue_get_ring_size(VirtIODevice
*vdev, int n);
uint16_t virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n);
void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx);
VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n);
+int virtio_queue_get_id(VirtQueue *vq);
EventNotifier *virtio_queue_get_guest_notifier(VirtQueue *vq);
EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq);
void virtio_queue_notify_vq(VirtQueue *vq);
--
1.7.9.3
- [Qemu-devel] [PULL 00/16] Pending SCSI patches for 1.1, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 01/16] scsi: fix memory leak, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 03/16] virtio: add virtio_queue_get_id,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 05/16] scsi: add missing test for cancelled request, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 02/16] virtio-scsi: prepare migration format for multiqueue, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 04/16] virtio-scsi: add multiqueue capability, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 06/16] scsi: make code more homogeneous in AIO callback functions, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 10/16] scsi: add a started field to SCSIDiskReq, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 07/16] scsi: move scsi_flush_complete around, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 11/16] scsi: support FUA on reads, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 08/16] scsi: add support for FUA on writes, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 09/16] scsi: force unit access on VERIFY, Paolo Bonzini, 2012/04/19
- [Qemu-devel] [PATCH 13/16] scsi: advertise DPOFUA, Paolo Bonzini, 2012/04/19