render / rpms / libvirt

Forked from rpms/libvirt 7 months ago
Clone
7a3408
From eb34bc3c4d9a9db2785d56ff30f6d7ca86663cb9 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <eb34bc3c4d9a9db2785d56ff30f6d7ca86663cb9@dist-git>
7a3408
From: Martin Kletzander <mkletzan@redhat.com>
7a3408
Date: Thu, 3 Sep 2015 15:55:44 +0200
7a3408
Subject: [PATCH] qemu: Enable ioeventfd usage for virtio-scsi controllers
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1150484
7a3408
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
(cherry picked from commit cf0404455cecb47ddbfa3266eea6b66f8540facd)
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_command.c                                          | 7 +++++++
7a3408
 .../qemuxml2argv-disk-virtio-scsi-ioeventfd.args                 | 9 +++++++++
7a3408
 tests/qemuxml2argvtest.c                                         | 3 +++
7a3408
 3 files changed, 19 insertions(+)
7a3408
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ioeventfd.args
7a3408
7a3408
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
7a3408
index aebaf35..f3e45a5 100644
7a3408
--- a/src/qemu/qemu_command.c
7a3408
+++ b/src/qemu/qemu_command.c
7a3408
@@ -4509,6 +4509,11 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
7a3408
                            _("'max_sectors' is only supported by virtio-scsi controller"));
7a3408
             return NULL;
7a3408
         }
7a3408
+        if (def->ioeventfd) {
7a3408
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
7a3408
+                           _("'ioeventfd' is only supported by virtio-scsi controller"));
7a3408
+            return NULL;
7a3408
+        }
7a3408
     }
7a3408
 
7a3408
     switch (def->type) {
7a3408
@@ -4654,6 +4659,8 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
7a3408
     if (def->max_sectors)
7a3408
         virBufferAsprintf(&buf, ",max_sectors=%u", def->max_sectors);
7a3408
 
7a3408
+    qemuBuildIoEventFdStr(&buf, def->ioeventfd, qemuCaps);
7a3408
+
7a3408
     if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) < 0)
7a3408
         goto error;
7a3408
 
7a3408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ioeventfd.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ioeventfd.args
7a3408
new file mode 100644
7a3408
index 0000000..1c53189
7a3408
--- /dev/null
7a3408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-ioeventfd.args
7a3408
@@ -0,0 +1,9 @@
7a3408
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
7a3408
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
7a3408
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
7a3408
+-device virtio-scsi-pci,id=scsi0,ioeventfd=on,bus=pci.0,addr=0x3 \
7a3408
+-usb \
7a3408
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
7a3408
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
7a3408
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
7a3408
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
7a3408
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
7a3408
index c2657d7..0dd1b9a 100644
7a3408
--- a/tests/qemuxml2argvtest.c
7a3408
+++ b/tests/qemuxml2argvtest.c
7a3408
@@ -877,6 +877,9 @@ mymain(void)
7a3408
     DO_TEST("disk-virtio-scsi-max_sectors",
7a3408
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
7a3408
             QEMU_CAPS_VIRTIO_SCSI);
7a3408
+    DO_TEST("disk-virtio-scsi-ioeventfd",
7a3408
+            QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
7a3408
+            QEMU_CAPS_VIRTIO_IOEVENTFD, QEMU_CAPS_VIRTIO_SCSI);
7a3408
     DO_TEST("disk-scsi-megasas",
7a3408
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
7a3408
             QEMU_CAPS_SCSI_MEGASAS);
7a3408
-- 
7a3408
2.5.1
7a3408