conf: Parse and format SMMUv3 IOMMU

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>
This commit is contained in:
Andrea Bolognani 2019-05-17 13:23:16 +02:00
parent 124eb803fc
commit 60f4c41377
11 changed files with 94 additions and 3 deletions

View File

@ -8675,14 +8675,17 @@ qemu-kvm -net nic,model=? /dev/null
<dt><code>model</code></dt> <dt><code>model</code></dt>
<dd> <dd>
<p> <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> </p>
</dd> </dd>
<dt><code>driver</code></dt> <dt><code>driver</code></dt>
<dd> <dd>
<p> <p>
The <code>driver</code> subelement can be used to configure 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> </p>
<dl> <dl>
<dt><code>intremap</code></dt> <dt><code>intremap</code></dt>

View File

@ -4375,7 +4375,10 @@
<define name="iommu"> <define name="iommu">
<element name="iommu"> <element name="iommu">
<attribute name="model"> <attribute name="model">
<value>intel</value> <choice>
<value>intel</value>
<value>smmuv3</value>
</choice>
</attribute> </attribute>
<optional> <optional>
<element name="driver"> <element name="driver">

View File

@ -1122,6 +1122,7 @@ VIR_ENUM_IMPL(virDomainTPMVersion,
VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_ENUM_IMPL(virDomainIOMMUModel,
VIR_DOMAIN_IOMMU_MODEL_LAST, VIR_DOMAIN_IOMMU_MODEL_LAST,
"intel", "intel",
"smmuv3",
); );
VIR_ENUM_IMPL(virDomainVsockModel, VIR_ENUM_IMPL(virDomainVsockModel,

View File

@ -2296,6 +2296,7 @@ struct _virDomainSEVDef {
typedef enum { typedef enum {
VIR_DOMAIN_IOMMU_MODEL_INTEL, VIR_DOMAIN_IOMMU_MODEL_INTEL,
VIR_DOMAIN_IOMMU_MODEL_SMMUV3,
VIR_DOMAIN_IOMMU_MODEL_LAST VIR_DOMAIN_IOMMU_MODEL_LAST
} virDomainIOMMUModel; } virDomainIOMMUModel;

View File

@ -6967,6 +6967,9 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
break; break;
} }
case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
break;
case VIR_DOMAIN_IOMMU_MODEL_LAST: case VIR_DOMAIN_IOMMU_MODEL_LAST:
default: default:
virReportEnumRangeError(virDomainIOMMUModel, iommu->model); virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
@ -7612,6 +7615,10 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU))
virBufferAddLit(&buf, ",iommu=on"); virBufferAddLit(&buf, ",iommu=on");
break; break;
case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
break;
case VIR_DOMAIN_IOMMU_MODEL_LAST: case VIR_DOMAIN_IOMMU_MODEL_LAST:
default: default:
virReportEnumRangeError(virDomainIOMMUModel, def->iommu->model); virReportEnumRangeError(virDomainIOMMUModel, def->iommu->model);

View File

@ -6135,6 +6135,9 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
} }
break; break;
case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
break;
case VIR_DOMAIN_IOMMU_MODEL_LAST: case VIR_DOMAIN_IOMMU_MODEL_LAST:
default: default:
virReportEnumRangeError(virDomainIOMMUModel, iommu->model); virReportEnumRangeError(virDomainIOMMUModel, iommu->model);

View File

@ -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

View File

@ -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>

View File

@ -2813,6 +2813,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-eim");
DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb");
DO_TEST_PARSE_ERROR("intel-iommu-wrong-machine", NONE); 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("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",

View File

@ -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>

View File

@ -1207,6 +1207,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-caching-mode");
DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-eim");
DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); 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-none", NONE);
DO_TEST("cpu-check-partial", NONE); DO_TEST("cpu-check-partial", NONE);