diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bfc1df3909..95ec7126bc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7396,7 +7396,9 @@ qemu-kvm -net nic,model=? /dev/null
...
<devices>
- <iommu model='intel'/>
+ <iommu model='intel'>
+ <driver intremap='on'/>
+ </iommu>
</devices>
...
@@ -7407,6 +7409,26 @@ qemu-kvm -net nic,model=? /dev/null
Currently only the intel
model is supported.
+ driver
+
+
+ The driver
subelement can be used to configure
+ additional options:
+
+
+ intremap
+
+
+ The intremap
attribute with possible values
+ on
and off
can be used to
+ turn on interrupt remapping, a part of the VT-d functionality.
+ Currently this requires split I/O APIC
+ (<ioapic driver='qemu'/>
).
+ Since 3.4.0 (QEMU/KVM only)
+
+
+
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 64f718b70d..00d9290eba 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3947,6 +3947,15 @@
intel
+
+
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 29b04d3622..4eefd92d16 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14141,12 +14141,16 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode,
static virDomainIOMMUDefPtr
-virDomainIOMMUDefParseXML(xmlNodePtr node)
+virDomainIOMMUDefParseXML(xmlNodePtr node,
+ xmlXPathContextPtr ctxt)
{
virDomainIOMMUDefPtr iommu = NULL, ret = NULL;
+ xmlNodePtr save = ctxt->node;
char *tmp = NULL;
int val;
+ ctxt->node = node;
+
if (VIR_ALLOC(iommu) < 0)
goto cleanup;
@@ -14163,10 +14167,20 @@ virDomainIOMMUDefParseXML(xmlNodePtr node)
iommu->model = val;
+ VIR_FREE(tmp);
+ if ((tmp = virXPathString("string(./driver/@intremap)", ctxt))) {
+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %s"), tmp);
+ goto cleanup;
+ }
+ iommu->intremap = val;
+ }
+
ret = iommu;
iommu = NULL;
cleanup:
+ ctxt->node = save;
VIR_FREE(iommu);
VIR_FREE(tmp);
return ret;
@@ -14319,7 +14333,7 @@ virDomainDeviceDefParse(const char *xmlStr,
goto error;
break;
case VIR_DOMAIN_DEVICE_IOMMU:
- if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node)))
+ if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node, ctxt)))
goto error;
break;
case VIR_DOMAIN_DEVICE_NONE:
@@ -18449,7 +18463,7 @@ virDomainDefParseXML(xmlDocPtr xml,
}
if (n > 0) {
- if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0])))
+ if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0], ctxt)))
goto error;
}
VIR_FREE(nodes);
@@ -24125,8 +24139,24 @@ static void
virDomainIOMMUDefFormat(virBufferPtr buf,
const virDomainIOMMUDef *iommu)
{
- virBufferAsprintf(buf, " \n",
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
+
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, " \n",
+ virTristateSwitchTypeToString(iommu->intremap));
+ }
+
+ virBufferAsprintf(buf, "model));
+ if (virBufferUse(&childBuf)) {
+ virBufferAddLit(buf, ">\n");
+ virBufferAddBuffer(buf, &childBuf);
+ virBufferAddLit(buf, " \n");
+ } else {
+ virBufferAddLit(buf, "/>\n");
+ }
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 82b4785a62..8eda516257 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2209,6 +2209,7 @@ typedef enum {
struct _virDomainIOMMUDef {
virDomainIOMMUModel model;
+ virTristateSwitch intremap;
};
/*
* Guest VM main configuration
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml
index 284d63a300..bfe714ad86 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml
@@ -24,6 +24,8 @@
-
+
+
+