]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Add test for virtio-iommu address
authorAndrea Bolognani <abologna@redhat.com>
Thu, 7 Oct 2021 17:44:26 +0000 (19:44 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 1 Apr 2022 17:31:00 +0000 (19:31 +0200)
virtio-iommu needs to be an integrated device, and our address
assignment code will make sure that is the case. If the user has
provided an explicit address, however, we should make sure any
addresses pointing to a different bus are rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvdata/virtio-iommu-invalid-address.x86_64-latest.err [new file with mode: 0644]
tests/qemuxml2argvdata/virtio-iommu-invalid-address.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

diff --git a/tests/qemuxml2argvdata/virtio-iommu-invalid-address.x86_64-latest.err b/tests/qemuxml2argvdata/virtio-iommu-invalid-address.x86_64-latest.err
new file mode 100644 (file)
index 0000000..997948e
--- /dev/null
@@ -0,0 +1 @@
+XML error: The device at PCI address 0000:01:00.0 needs to be an integrated device (bus=0)
diff --git a/tests/qemuxml2argvdata/virtio-iommu-invalid-address.xml b/tests/qemuxml2argvdata/virtio-iommu-invalid-address.xml
new file mode 100644 (file)
index 0000000..0daa58e
--- /dev/null
@@ -0,0 +1,20 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='q35'>hvm</type>
+  </os>
+  <features>
+    <acpi/>
+  </features>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+    <iommu model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+    </iommu>
+  </devices>
+</domain>
index f6ce8e0200ec82f5442b1c29c9318addce01d79d..44b71b48e45b6f1fee281226d5b49e328cd7fe06 100644 (file)
@@ -3253,6 +3253,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine");
     DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-no-acpi");
     DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address-type");
+    DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address");
 
     DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
     DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",