summaryrefslogtreecommitdiffstats
path: root/hw/virtio
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-08-18 16:33:45 +0200
committerMichael S. Tsirkin2020-08-27 14:29:13 +0200
commit4e5163bd844429711b4d60d51030ab83048d80cd (patch)
tree29820fc1a17a409f04402367a8cbcef2b78d595f /hw/virtio
parentvirtio-pci: add virtio_pci_optimal_num_queues() helper (diff)
downloadqemu-4e5163bd844429711b4d60d51030ab83048d80cd.tar.gz
qemu-4e5163bd844429711b4d60d51030ab83048d80cd.tar.xz
qemu-4e5163bd844429711b4d60d51030ab83048d80cd.zip
virtio-scsi: introduce a constant for fixed virtqueues
The event and control virtqueues are always present, regardless of the multi-queue configuration. Define a constant so that virtqueue number calculations are easier to read. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <20200818143348.310613-5-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-scsi-pci.c3
-rw-r--r--hw/virtio/vhost-user-scsi-pci.c3
-rw-r--r--hw/virtio/virtio-scsi-pci.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c
index 095af23f3f..06e814d30e 100644
--- a/hw/virtio/vhost-scsi-pci.c
+++ b/hw/virtio/vhost-scsi-pci.c
@@ -50,7 +50,8 @@ static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
- vpci_dev->nvectors = vs->conf.num_queues + 3;
+ vpci_dev->nvectors = vs->conf.num_queues +
+ VIRTIO_SCSI_VQ_NUM_FIXED + 1;
}
qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pci.c
index 4705cd54e8..ab6dfb71a9 100644
--- a/hw/virtio/vhost-user-scsi-pci.c
+++ b/hw/virtio/vhost-user-scsi-pci.c
@@ -56,7 +56,8 @@ static void vhost_user_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev);
if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
- vpci_dev->nvectors = vs->conf.num_queues + 3;
+ vpci_dev->nvectors = vs->conf.num_queues +
+ VIRTIO_SCSI_VQ_NUM_FIXED + 1;
}
qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c
index c23a134202..3ff9eb7ef6 100644
--- a/hw/virtio/virtio-scsi-pci.c
+++ b/hw/virtio/virtio-scsi-pci.c
@@ -51,7 +51,8 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
char *bus_name;
if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
- vpci_dev->nvectors = vs->conf.num_queues + 3;
+ vpci_dev->nvectors = vs->conf.num_queues +
+ VIRTIO_SCSI_VQ_NUM_FIXED + 1;
}
/*