]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Parse and format SMMUv3 IOMMU
authorAndrea Bolognani <abologna@redhat.com>
Fri, 17 May 2019 11:23:16 +0000 (13:23 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 3 Jun 2019 15:40:48 +0000 (17:40 +0200)
SMMUv3 is an IOMMU implementation for ARM virt guests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/iommu-smmuv3.aarch64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/iommu-smmuv3.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/iommu-smmuv3.aarch64-latest.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index c843b1d6676b6c718470728f6b880cdbdd4175f4..22ddcb71d34579970df5b848ac1365992f7ea206 100644 (file)
@@ -8675,14 +8675,17 @@ qemu-kvm -net nic,model=? /dev/null
       <dt><code>model</code></dt>
       <dd>
         <p>
-          Currently only the <code>intel</code> model is supported.
+          Supported values are <code>intel</code> (for Q35 guests) and,
+          <span class="since">since 5.5.0</span>, <code>smmuv3</code> (for
+          ARM virt guests).
         </p>
       </dd>
       <dt><code>driver</code></dt>
       <dd>
         <p>
           The <code>driver</code> subelement can be used to configure
-          additional options:
+          additional options, some of which might only be available for
+          certain IOMMU models:
         </p>
         <dl>
           <dt><code>intremap</code></dt>
index 111b85c36fd37953c56b06c38b2f1141c945b43c..4bd75e3055274f2174d6e5c0063a39e8301268ba 100644 (file)
   <define name="iommu">
     <element name="iommu">
       <attribute name="model">
-        <value>intel</value>
+        <choice>
+          <value>intel</value>
+          <value>smmuv3</value>
+        </choice>
       </attribute>
       <optional>
         <element name="driver">
index 006920e95417c4fde60cf009627c378dcd9485fd..97ba8bd53a190ff7c8a6e14e8fe99af122900d30 100644 (file)
@@ -1122,6 +1122,7 @@ VIR_ENUM_IMPL(virDomainTPMVersion,
 VIR_ENUM_IMPL(virDomainIOMMUModel,
               VIR_DOMAIN_IOMMU_MODEL_LAST,
               "intel",
+              "smmuv3",
 );
 
 VIR_ENUM_IMPL(virDomainVsockModel,
index fa0756b6340b7d6674443e42ac3ca22b42cd14db..4c3ab07062f54de1b333b21b72044b1ddf40efaf 100644 (file)
@@ -2296,6 +2296,7 @@ struct _virDomainSEVDef {
 
 typedef enum {
     VIR_DOMAIN_IOMMU_MODEL_INTEL,
+    VIR_DOMAIN_IOMMU_MODEL_SMMUV3,
 
     VIR_DOMAIN_IOMMU_MODEL_LAST
 } virDomainIOMMUModel;
index b2b9bef772d571685c1ab03dc22205fa3859bfae..a11b6d40da071b9c7d875b46fe6b39175608045f 100644 (file)
@@ -6967,6 +6967,9 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
         break;
     }
 
+    case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
+        break;
+
     case VIR_DOMAIN_IOMMU_MODEL_LAST:
     default:
         virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
@@ -7612,6 +7615,10 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
             if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU))
                 virBufferAddLit(&buf, ",iommu=on");
             break;
+
+        case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
+            break;
+
         case VIR_DOMAIN_IOMMU_MODEL_LAST:
         default:
             virReportEnumRangeError(virDomainIOMMUModel, def->iommu->model);
index 366ebe1604c9859820d2e560d947e8f6d5203260..980295204604e47ce603223fc0d681970ac5c526 100644 (file)
@@ -6135,6 +6135,9 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
         }
         break;
 
+    case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
+        break;
+
     case VIR_DOMAIN_IOMMU_MODEL_LAST:
     default:
         virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
diff --git a/tests/qemuxml2argvdata/iommu-smmuv3.aarch64-latest.args b/tests/qemuxml2argvdata/iommu-smmuv3.aarch64-latest.args
new file mode 100644 (file)
index 0000000..a966690
--- /dev/null
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-guest/master-key.aes \
+-machine virt,accel=tcg,usb=off,dump-guest-core=off,gic-version=2 \
+-m 1024 \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/iommu-smmuv3.xml b/tests/qemuxml2argvdata/iommu-smmuv3.xml
new file mode 100644 (file)
index 0000000..2683ce6
--- /dev/null
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' model='none'/>
+    <memballoon model='none'/>
+    <iommu model='smmuv3'/>
+  </devices>
+</domain>
index ec5807479828e5d1233fcdf64eba8e468fc250c0..49220733aebaa481867cf885bb0d6566b1cb3082 100644 (file)
@@ -2813,6 +2813,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("intel-iommu-eim");
     DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
     DO_TEST_PARSE_ERROR("intel-iommu-wrong-machine", NONE);
+    DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
 
     DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
     DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
diff --git a/tests/qemuxml2xmloutdata/iommu-smmuv3.aarch64-latest.xml b/tests/qemuxml2xmloutdata/iommu-smmuv3.aarch64-latest.xml
new file mode 100644 (file)
index 0000000..93e8566
--- /dev/null
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+  <name>guest</name>
+  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='aarch64' machine='virt'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <gic version='2'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-aarch64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <memballoon model='none'/>
+    <iommu model='smmuv3'/>
+  </devices>
+</domain>
index d1e7fe101550ec4f7dc46342ef06093770c55cd6..06d1ad5ec01afb7d792f6c6c21c8a1688405d198 100644 (file)
@@ -1207,6 +1207,7 @@ mymain(void)
     DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
     DO_TEST_CAPS_LATEST("intel-iommu-eim");
     DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
+    DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
 
     DO_TEST("cpu-check-none", NONE);
     DO_TEST("cpu-check-partial", NONE);