[PATCH v2 3/3] qemu: Add support for virtio device option page-per-vq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1925363

Signed-off-by: Han Han <hhan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c                       |  4 ++
 src/qemu/qemu_hotplug.c                       |  3 +-
 src/qemu/qemu_validate.c                      |  7 ++++
 .../virtio-options-controller-page_per_vq.err |  1 +
 .../virtio-options-controller-page_per_vq.xml | 38 +++++++++++++++++++
 .../virtio-options-disk-page_per_vq.err       |  1 +
 .../virtio-options-disk-page_per_vq.xml       | 34 +++++++++++++++++
 .../virtio-options-fs-page_per_vq.err         |  1 +
 .../virtio-options-fs-page_per_vq.xml         | 34 +++++++++++++++++
 .../virtio-options-input-page_per_vq.err      |  1 +
 .../virtio-options-input-page_per_vq.xml      | 30 +++++++++++++++
 .../virtio-options-memballoon-page_per_vq.err |  1 +
 .../virtio-options-memballoon-page_per_vq.xml | 23 +++++++++++
 .../virtio-options-net-page_per_vq.err        |  1 +
 .../virtio-options-net-page_per_vq.xml        | 34 +++++++++++++++++
 .../virtio-options-rng-page_per_vq.err        |  1 +
 .../virtio-options-rng-page_per_vq.xml        | 32 ++++++++++++++++
 .../virtio-options-video-page_per_vq.err      |  1 +
 .../virtio-options-video-page_per_vq.xml      | 36 ++++++++++++++++++
 .../virtio-options.x86_64-latest.args         | 26 ++++++-------
 tests/qemuxml2argvdata/virtio-options.xml     | 26 ++++++-------
 tests/qemuxml2argvtest.c                      | 14 +++++++
 22 files changed, 322 insertions(+), 27 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml
 create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err
 create mode 100644 tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 28bca1519c..36159971fa 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -636,6 +636,10 @@ qemuBuildVirtioOptionsStr(virBuffer *buf,
         virBufferAsprintf(buf, ",packed=%s",
                           virTristateSwitchTypeToString(virtio->packed));
     }
+    if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) {
+        virBufferAsprintf(buf, ",page-per-vq=%s",
+                          virTristateSwitchTypeToString(virtio->page_per_vq));
+    }
 }
 
 static int
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 22239b2689..9bbbab47e3 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3675,7 +3675,8 @@ qemuDomainChangeNet(virQEMUDriver *driver,
         (olddev->virtio && newdev->virtio &&
          (olddev->virtio->iommu != newdev->virtio->iommu ||
           olddev->virtio->ats != newdev->virtio->ats ||
-          olddev->virtio->packed != newdev->virtio->packed))) {
+          olddev->virtio->packed != newdev->virtio->packed ||
+          olddev->virtio->page_per_vq != newdev->virtio->page_per_vq))) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("cannot modify virtio network device driver options"));
            goto cleanup;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index c84508cb64..233544e944 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1430,6 +1430,13 @@ qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio,
                              "QEMU binary"));
             return -1;
         }
+
+    if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PAGE_PER_VQ)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("the page_per_vq setting is not supported with this QEMU binary"));
+            return -1;
+        }
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml
new file mode 100644
index 0000000000..395142ba8a
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-controller-page_per_vq.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver page_per_vq='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </controller>
+    <controller type='scsi' index='1' model='virtio-scsi'>
+      <driver page_per_vq='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <driver page_per_vq='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <controller type='virtio-serial' index='1'>
+      <driver page_per_vq='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </controller>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml
new file mode 100644
index 0000000000..8040685f7a
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-disk-page_per_vq.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' page_per_vq='on'/>
+      <source file='/var/lib/libvirt/images/img1'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' page_per_vq='off'/>
+      <source file='/var/lib/libvirt/images/img2'/>
+      <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </disk>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml
new file mode 100644
index 0000000000..abf89ab53b
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-fs-page_per_vq.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <filesystem type='mount' accessmode='passthrough'>
+      <driver page_per_vq='on'/>
+      <source dir='/export/fs1'/>
+      <target dir='fs1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </filesystem>
+    <filesystem type='mount' accessmode='passthrough'>
+      <driver page_per_vq='off'/>
+      <source dir='/export/fs2'/>
+      <target dir='fs2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </filesystem>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml
new file mode 100644
index 0000000000..e08234786b
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-input-page_per_vq.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='virtio'>
+      <driver page_per_vq='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </input>
+    <input type='keyboard' bus='virtio'>
+      <driver page_per_vq='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </input>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml
new file mode 100644
index 0000000000..cf7c3da971
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-memballoon-page_per_vq.xml
@@ -0,0 +1,23 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <driver page_per_vq='on'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml
new file mode 100644
index 0000000000..2c38daa0d5
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-net-page_per_vq.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <interface type='user'>
+      <mac address='52:54:56:58:5a:5c'/>
+      <model type='virtio'/>
+      <driver page_per_vq='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='62:64:66:68:6a:6c'/>
+      <model type='virtio'/>
+      <driver page_per_vq='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml
new file mode 100644
index 0000000000..c93d70156c
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-rng-page_per_vq.xml
@@ -0,0 +1,32 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+      <driver page_per_vq='on'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </rng>
+    <rng model='virtio'>
+      <backend model='random'>/dev/random</backend>
+      <driver page_per_vq='off'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </rng>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err
new file mode 100644
index 0000000000..475aa8be43
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.err
@@ -0,0 +1 @@
+unsupported configuration: the page_per_vq setting is not supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml
new file mode 100644
index 0000000000..2d79932135
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-options-video-page_per_vq.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pci-root'/>
+    <video>
+      <driver page_per_vq='on' name='vhostuser'/>
+      <model type='virtio' heads='1' primary='yes'>
+        <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
+      </model>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <video>
+      <driver page_per_vq='off' name='vhostuser'/>
+      <model type='virtio' heads='1' primary='no'>
+        <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
+      </model>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args
index 06a4520036..4b69080502 100644
--- a/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args
@@ -27,26 +27,26 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-acpi \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
--device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,addr=0x8 \
--device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x9 \
+-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,id=scsi0,bus=pci.0,addr=0x8 \
+-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x9 \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/img1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \
+-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
--device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x3 \
+-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x3 \
 -fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,path=/export/fs2 \
--device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0x4 \
+-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0x4 \
 -netdev user,id=hostnet0 \
--device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6,iommu_platform=on,ats=on,packed=on \
--device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,packed=on \
--device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,ats=on,packed=on \
--device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,ats=on,packed=on \
--device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12,iommu_platform=on,ats=on,packed=on \
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,addr=0x6,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
+-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
+-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
+-device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
+-device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,addr=0x12,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
 -audiodev id=audio1,driver=none \
 -chardev socket,id=chr-vu-video0,fd=1729 \
--device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,ats=on,packed=on \
+-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,ats=on,packed=on,page-per-vq=on \
 -object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/random"}' \
--device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xd \
+-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,page-per-vq=on,bus=pci.0,addr=0xd \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml
index 9c9b80d5c4..59e293d8e9 100644
--- a/tests/qemuxml2argvdata/virtio-options.xml
+++ b/tests/qemuxml2argvdata/virtio-options.xml
@@ -18,7 +18,7 @@
   <devices>
     <emulator>/usr/bin/qemu-system-x86_64</emulator>
     <disk type='file' device='disk'>
-      <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/>
+      <driver name='qemu' type='raw' iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <source file='/var/lib/libvirt/images/img1'/>
       <target dev='vda' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
@@ -30,22 +30,22 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='scsi' index='0' model='virtio-scsi'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='virtio-serial' index='0'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <source dir='/export/fs1'/>
       <target dir='fs1'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </filesystem>
     <filesystem type='mount' accessmode='mapped'>
-      <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/>
+      <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <source dir='/export/fs2'/>
       <target dir='fs2'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
@@ -53,23 +53,23 @@
     <interface type='user'>
       <mac address='52:54:56:58:5a:5c'/>
       <model type='virtio'/>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </interface>
     <input type='mouse' bus='virtio'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
     </input>
     <input type='keyboard' bus='virtio'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
     </input>
     <input type='tablet' bus='virtio'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
     </input>
     <input type='passthrough' bus='virtio'>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <source evdev='/dev/input/event1234'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
     </input>
@@ -77,7 +77,7 @@
     <input type='keyboard' bus='ps2'/>
     <audio id='1' type='none'/>
     <video>
-      <driver iommu='on' ats='on' packed='on' name='vhostuser'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on' name='vhostuser'/>
       <model type='virtio' heads='1' primary='yes'>
         <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
       </model>
@@ -85,11 +85,11 @@
     </video>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
     </memballoon>
     <rng model='virtio'>
       <backend model='random'>/dev/random</backend>
-      <driver iommu='on' ats='on' packed='on'/>
+      <driver iommu='on' ats='on' packed='on' page_per_vq='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
     </rng>
   </devices>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7df3946751..eff86eccf5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3309,6 +3309,20 @@ mymain(void)
                         QEMU_CAPS_DEVICE_VIRTIO_GPU,
                         QEMU_CAPS_VIRTIO_GPU_VIRGL,
                         QEMU_CAPS_DEVICE_VHOST_USER_GPU);
+    DO_TEST_PARSE_ERROR("virtio-options-controller-page_per_vq", QEMU_CAPS_VIRTIO_SCSI);
+    DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-disk-page_per_vq");
+    DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-fs-page_per_vq");
+    DO_TEST_PARSE_ERROR("virtio-options-input-page_per_vq", QEMU_CAPS_VIRTIO_MOUSE,
+                        QEMU_CAPS_VIRTIO_KEYBOARD);
+    DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-page_per_vq");
+    DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-memballoon-freepage-reporting");
+    DO_TEST_PARSE_ERROR_NOCAPS("virtio-options-net-page_per_vq");
+    DO_TEST_PARSE_ERROR("virtio-options-rng-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_RNG,
+                        QEMU_CAPS_OBJECT_RNG_RANDOM);
+    DO_TEST_PARSE_ERROR("virtio-options-video-page_per_vq", QEMU_CAPS_DEVICE_VIRTIO_GPU,
+                        QEMU_CAPS_DEVICE_VIRTIO_GPU,
+                        QEMU_CAPS_VIRTIO_GPU_VIRGL,
+                        QEMU_CAPS_DEVICE_VHOST_USER_GPU);
 
     DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE,
             QEMU_CAPS_KVM);
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux