[PATCH 3/3] tests: add test for intel-iommu dma-translation attribute

Sandesh Patel posted 3 patches 3 months, 2 weeks ago
[PATCH 3/3] tests: add test for intel-iommu dma-translation attribute
Posted by Sandesh Patel 3 months, 2 weeks ago
Test data for the intel-iommu dma-translation attribute added previously

Signed-off-by: Sandesh Patel <sandesh.patel@nutanix.com>
---
 .../caps_7.1.0_x86_64.xml                     |  1 +
 .../caps_7.2.0_x86_64+hvf.xml                 |  1 +
 .../caps_7.2.0_x86_64.xml                     |  1 +
 .../caps_8.0.0_x86_64.xml                     |  1 +
 .../caps_8.1.0_x86_64.xml                     |  1 +
 .../caps_8.2.0_x86_64.xml                     |  1 +
 .../caps_9.0.0_x86_64.xml                     |  1 +
 .../caps_9.1.0_x86_64.xml                     |  1 +
 .../migration-out-nbd-bitmaps-in.xml          |  1 +
 ...l-iommu-dma-translation.x86_64-latest.args | 34 +++++++++++++++++
 ...el-iommu-dma-translation.x86_64-latest.xml |  1 +
 .../intel-iommu-dma-translation.xml           | 37 +++++++++++++++++++
 tests/qemuxmlconftest.c                       |  1 +
 13 files changed, 82 insertions(+)
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.args
 create mode 120000 tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-dma-translation.xml

diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
index 555120e958..9737e3d083 100644
--- a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml
@@ -192,6 +192,7 @@
   <flag name='usb-mtp'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>7001000</version>
   <microcodeVersion>43100244</microcodeVersion>
   <package>v7.1.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
index ca25a5549e..55dcbf203e 100644
--- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
+++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml
@@ -196,6 +196,7 @@
   <flag name='usb-mtp'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>7002000</version>
   <microcodeVersion>43100245</microcodeVersion>
   <package>v7.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
index 8b835e6187..1253c860ee 100644
--- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml
@@ -196,6 +196,7 @@
   <flag name='usb-mtp'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>7002000</version>
   <microcodeVersion>43100245</microcodeVersion>
   <package>v7.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
index 3ac9e96066..d3901fef05 100644
--- a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml
@@ -200,6 +200,7 @@
   <flag name='usb-mtp'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>8000000</version>
   <microcodeVersion>43100244</microcodeVersion>
   <package>v8.0.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
index 476195d147..f8a9993ede 100644
--- a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml
@@ -202,6 +202,7 @@
   <flag name='usb-mtp'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>8001000</version>
   <microcodeVersion>43100245</microcodeVersion>
   <package>v8.1.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
index 25cb22aafc..43d7105c2d 100644
--- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml
@@ -205,6 +205,7 @@
   <flag name='virtio-sound'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>8002000</version>
   <microcodeVersion>43100246</microcodeVersion>
   <package>v8.2.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
index b646377dec..e96af86a92 100644
--- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml
@@ -207,6 +207,7 @@
   <flag name='virtio-sound'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>9000000</version>
   <microcodeVersion>43100245</microcodeVersion>
   <package>v9.0.0</package>
diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml
index dc548583a5..e17c22d776 100644
--- a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml
@@ -205,6 +205,7 @@
   <flag name='virtio-sound'/>
   <flag name='netdev.user'/>
   <flag name='acpi-erst'/>
+  <flag name='intel-iommu.dma-translation'/>
   <version>9000050</version>
   <microcodeVersion>43100246</microcodeVersion>
   <package>v9.0.0-1388-g80e8f06021-dirty</package>
diff --git a/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml b/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml
index 4ee44ffbd4..15fa35620d 100644
--- a/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml
+++ b/tests/qemustatusxml2xmldata/migration-out-nbd-bitmaps-in.xml
@@ -261,6 +261,7 @@
     <flag name='vhost-user-blk'/>
     <flag name='cpu-max'/>
     <flag name='migration-param.block-bitmap-mapping'/>
+    <flag name='intel-iommu.dma-translation'/>
   </qemuCaps>
   <job type='none' async='migration out' phase='perform3' flags='0x42' asyncStarted='0'>
     <disk dev='hda' migrating='no'/>
diff --git a/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.args b/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.args
new file mode 100644
index 0000000000..cc7f819f5c
--- /dev/null
+++ b/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine q35,usb=off,kernel_irqchip=split,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
+-accel kvm \
+-cpu qemu64 \
+-m size=219136k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device '{"driver":"intel-iommu","id":"iommu0","intremap":"on","dma-translation":false}' \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-global ICH9-LPC.noreboot=off \
+-watchdog-action reset \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.xml b/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.xml
new file mode 120000
index 0000000000..a35a254f7a
--- /dev/null
+++ b/tests/qemuxmlconfdata/intel-iommu-dma-translation.x86_64-latest.xml
@@ -0,0 +1 @@
+intel-iommu-dma-translation.xml
\ No newline at end of file
diff --git a/tests/qemuxmlconfdata/intel-iommu-dma-translation.xml b/tests/qemuxmlconfdata/intel-iommu-dma-translation.xml
new file mode 100644
index 0000000000..9b4debca0a
--- /dev/null
+++ b/tests/qemuxmlconfdata/intel-iommu-dma-translation.xml
@@ -0,0 +1,37 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='q35'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <ioapic driver='qemu'/>
+  </features>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
+  <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='pcie-root'/>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <audio id='1' type='none'/>
+    <watchdog model='itco' action='reset'/>
+    <memballoon model='none'/>
+    <iommu model='intel'>
+      <driver intremap='on' dma_translation='off'/>
+    </iommu>
+  </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 4fccc06fcd..41453480a9 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -2713,6 +2713,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("intel-iommu-eim");
     DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
     DO_TEST_CAPS_LATEST("intel-iommu-aw-bits");
+    DO_TEST_CAPS_LATEST("intel-iommu-dma-translation");
     DO_TEST_CAPS_LATEST_PARSE_ERROR("intel-iommu-wrong-machine");
     DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
     DO_TEST_CAPS_LATEST("virtio-iommu-x86_64");
-- 
2.22.3