Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- docs/formatdomain.html.in | 7 +++-- docs/schemas/domaincommon.rng | 5 ++- src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 7 +++++ src/qemu/qemu_domain.c | 3 ++ .../iommu-smmuv3.aarch64-latest.args | 31 +++++++++++++++++++ tests/qemuxml2argvdata/iommu-smmuv3.xml | 15 +++++++++ tests/qemuxml2argvtest.c | 1 + .../iommu-smmuv3.aarch64-latest.xml | 25 +++++++++++++++ tests/qemuxml2xmltest.c | 1 + 11 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/iommu-smmuv3.aarch64-latest.args create mode 100644 tests/qemuxml2argvdata/iommu-smmuv3.xml create mode 100644 tests/qemuxml2xmloutdata/iommu-smmuv3.aarch64-latest.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index c843b1d667..22ddcb71d3 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -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> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 111b85c36f..4bd75e3055 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4375,7 +4375,10 @@ <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"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 006920e954..97ba8bd53a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1122,6 +1122,7 @@ VIR_ENUM_IMPL(virDomainTPMVersion, VIR_ENUM_IMPL(virDomainIOMMUModel, VIR_DOMAIN_IOMMU_MODEL_LAST, "intel", + "smmuv3", ); VIR_ENUM_IMPL(virDomainVsockModel, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fa0756b634..4c3ab07062 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2296,6 +2296,7 @@ struct _virDomainSEVDef { typedef enum { VIR_DOMAIN_IOMMU_MODEL_INTEL, + VIR_DOMAIN_IOMMU_MODEL_SMMUV3, VIR_DOMAIN_IOMMU_MODEL_LAST } virDomainIOMMUModel; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b2b9bef772..a11b6d40da 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 366ebe1604..9802952046 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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 index 0000000000..a96669078b --- /dev/null +++ b/tests/qemuxml2argvdata/iommu-smmuv3.aarch64-latest.args @@ -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 index 0000000000..2683ce6459 --- /dev/null +++ b/tests/qemuxml2argvdata/iommu-smmuv3.xml @@ -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> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ec58074798..49220733ae 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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 index 0000000000..93e8566dea --- /dev/null +++ b/tests/qemuxml2xmloutdata/iommu-smmuv3.aarch64-latest.xml @@ -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> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index d1e7fe1015..06d1ad5ec0 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -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); -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list