summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-07-27 14:38:03 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-07-27 15:47:30 +0200
commit4c205d0cb1c8bde5a53f6acceda74dae1043a197 (patch)
tree523369fc3994b78a437c1e6389aabaeafdceaae1
parent3f910904ecce48bcfd6ee269e8ac84a571fbc1e3 (diff)
downloadfocaccia-qemu-4c205d0cb1c8bde5a53f6acceda74dae1043a197.tar.gz
focaccia-qemu-4c205d0cb1c8bde5a53f6acceda74dae1043a197.zip
virtio-scsi: enable MSI-X support
While virtio-scsi does support multiqueue, the default number of
interrupt vectors is not enough to actually enable usage of
multiple queues in the driver; this is because with only 2
vectors the driver will not be able to use a separate
interrupt for each request queue.  Derive the desired number
of vectors from the number of request queues.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/virtio-pci.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 82859a5724..1109467d19 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -1023,7 +1023,9 @@ static int virtio_scsi_init_pci(PCIDevice *pci_dev)
         return -EINVAL;
     }
 
-    vdev->nvectors = proxy->nvectors;
+    vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED
+                                        ? proxy->scsi.num_queues + 3
+                                        : proxy->nvectors;
     virtio_init_pci(proxy, vdev);
 
     /* make the actual value visible */
@@ -1041,7 +1043,7 @@ static int virtio_scsi_exit_pci(PCIDevice *pci_dev)
 
 static Property virtio_scsi_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true),
-    DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
+    DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, DEV_NVECTORS_UNSPECIFIED),
     DEFINE_VIRTIO_SCSI_PROPERTIES(VirtIOPCIProxy, host_features, scsi),
     DEFINE_PROP_END_OF_LIST(),
 };