[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 33/60] virtio: introduce virtio_get_num_queues()
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 33/60] virtio: introduce virtio_get_num_queues() |
Date: |
Mon, 1 Jun 2015 14:24:09 +0200 |
From: Jason Wang <address@hidden>
This patch introduces virtio_get_num_queues() which iterates the vqs
array and return the number of virtqueues used by device.
Signed-off-by: Jason Wang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/virtio/virtio.h | 1 +
hw/virtio/virtio.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 5244a3e..dd92fe4 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -176,6 +176,7 @@ void virtio_queue_set_addr(VirtIODevice *vdev, int n,
hwaddr addr);
hwaddr 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);
+int virtio_get_num_queues(VirtIODevice *vdev);
void virtio_queue_set_align(VirtIODevice *vdev, int n, int align);
void virtio_queue_notify(VirtIODevice *vdev, int n);
uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index b50cbef..5602285 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -746,6 +746,19 @@ int virtio_queue_get_num(VirtIODevice *vdev, int n)
return vdev->vq[n].vring.num;
}
+int virtio_get_num_queues(VirtIODevice *vdev)
+{
+ int i;
+
+ for (i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
+ if (!virtio_queue_get_num(vdev, i)) {
+ break;
+ }
+ }
+
+ return i;
+}
+
int virtio_queue_get_id(VirtQueue *vq)
{
VirtIODevice *vdev = vq->vdev;
--
MST
- [Qemu-devel] [PULL v2 22/60] pc: Remove qemu_register_pc_machine() function, (continued)
- [Qemu-devel] [PULL v2 22/60] pc: Remove qemu_register_pc_machine() function, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 23/60] machine: Remove unused fields from QEMUMachine, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 24/60] piix: Add kvmclock_enabled, pci_enabled globals, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 25/60] piix: Eliminate pc_init_pci(), Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 27/60] pc: acpi: fix pvpanic for buggy guests, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 26/60] pc: Generate init functions with a macro, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 28/60] virtio: move host_features, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 29/60] virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 30/60] virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 31/60] virtio-net: adding all queues in .realize(), Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 33/60] virtio: introduce virtio_get_num_queues(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 32/60] virtio: device_plugged() can fail, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 34/60] virtio-ccw: introduce ccw specific queue limit, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 35/60] virtio-ccw: validate the number of queues against bus limitation, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 36/60] virtio-s390: introduce virito s390 queue limit, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 37/60] virtio-s390: introduce virtio_s390_device_plugged(), Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 38/60] virtio: rename VIRTIO_PCI_QUEUE_MAX to VIRTIO_QUEUE_MAX, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 39/60] virtio: increase the queue limit to 1024, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 40/60] i386/pc: pc_basic_device_init(): delegate FDC creation request, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 41/60] i386/pc: '-drive if=floppy' should imply a board-default FDC, Michael S. Tsirkin, 2015/06/01
- [Qemu-devel] [PULL v2 43/60] i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted, Michael S. Tsirkin, 2015/06/01