For the newly supported AMD device. Signed-off-by: Ján Tomko <jto...@redhat.com> --- docs/formatdomain.rst | 8 ++++++++ src/conf/domain_conf.c | 30 +++++++++++++++++++++++++++++ src/conf/domain_conf.h | 2 ++ src/conf/schemas/domaincommon.rng | 10 ++++++++++ tests/qemuxmlconfdata/amd-iommu.xml | 2 +- 5 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 8c122f5dae..690da6d43e 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8948,6 +8948,14 @@ Example: example to efficiently enable more than 255 vCPUs. :since:`Since 10.7.0` (QEMU/KVM and ``intel`` model only) + ``passthrough`` + Enable passthrough. TODO: Explain what this is + :since:`Since 11.2.0` (QEMU/KVM and ``amd`` model only) + + ``xtsup`` + Enable x2APIC mode. + :since:`Since 11.2.0` (QEMU/KVM and ``amd`` model only) + The ``virtio`` IOMMU devices can further have ``address`` element as described in `Device addresses`_ (address has to by type of ``pci``). diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 961ef08ba1..ef31da9d3f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14091,6 +14091,14 @@ virDomainIOMMUDefParseXML(virDomainXMLOption *xmlopt, if (virXMLPropTristateSwitch(driver, "dma_translation", VIR_XML_PROP_NONE, &iommu->dma_translation) < 0) return NULL; + + if (virXMLPropTristateSwitch(driver, "xtsup", VIR_XML_PROP_NONE, + &iommu->xtsup) < 0) + return NULL; + + if (virXMLPropTristateSwitch(driver, "passthrough", VIR_XML_PROP_NONE, + &iommu->pt) < 0) + return NULL; } if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, @@ -21707,6 +21715,20 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDef *src, virTristateSwitchTypeToString(src->dma_translation)); return false; } + if (src->pt != dst->pt) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain IOMMU device dma translation '%1$s' does not match source '%2$s'"), + virTristateSwitchTypeToString(dst->pt), + virTristateSwitchTypeToString(src->pt)); + return false; + } + if (src->xtsup != dst->xtsup) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain IOMMU device dma translation '%1$s' does not match source '%2$s'"), + virTristateSwitchTypeToString(dst->xtsup), + virTristateSwitchTypeToString(src->xtsup)); + return false; + } return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info); } @@ -27734,6 +27756,14 @@ virDomainIOMMUDefFormat(virBuffer *buf, virBufferAsprintf(&driverAttrBuf, " dma_translation='%s'", virTristateSwitchTypeToString(iommu->dma_translation)); } + if (iommu->pt != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&driverAttrBuf, " passthrough='%s'", + virTristateSwitchTypeToString(iommu->pt)); + } + if (iommu->xtsup != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&driverAttrBuf, " xtsup='%s'", + virTristateSwitchTypeToString(iommu->xtsup)); + } virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1ec16d3824..9b00212fb9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3003,6 +3003,8 @@ struct _virDomainIOMMUDef { unsigned int aw_bits; virDomainDeviceInfo info; virTristateSwitch dma_translation; + virTristateSwitch xtsup; + virTristateSwitch pt; }; typedef enum { diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index 71b68d6687..7183b4090c 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -6214,6 +6214,16 @@ <ref name="virOnOff"/> </attribute> </optional> + <optional> + <attribute name="xtsup"> + <ref name="virOnOff"/> + </attribute> + </optional> + <optional> + <attribute name="passthrough"> + <ref name="virOnOff"/> + </attribute> + </optional> </element> </optional> <optional> diff --git a/tests/qemuxmlconfdata/amd-iommu.xml b/tests/qemuxmlconfdata/amd-iommu.xml index 0668ed4237..4ad79ce4ae 100644 --- a/tests/qemuxmlconfdata/amd-iommu.xml +++ b/tests/qemuxmlconfdata/amd-iommu.xml @@ -32,7 +32,7 @@ <watchdog model='itco' action='reset'/> <memballoon model='none'/> <iommu model='amd'> - <driver intremap='on' iotlb='on'/> + <driver intremap='on' iotlb='on' passthrough='on' xtsup='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </iommu> </devices> -- 2.48.1