<pre>
...
<devices>
- <iommu model='intel'/>
+ <iommu model='intel'>
+ <driver intremap='on'/>
+ </iommu>
</devices>
...
</pre>
Currently only the <code>intel</code> model is supported.
</p>
</dd>
+ <dt><code>driver</code></dt>
+ <dd>
+ <p>
+ The <code>driver</code> subelement can be used to configure
+ additional options:
+ </p>
+ <dl>
+ <dt><code>intremap</code></dt>
+ <dd>
+ <p>
+ The <code>intremap</code> attribute with possible values
+ <code>on</code> and <code>off</code> can be used to
+ turn on interrupt remapping, a part of the VT-d functionality.
+ Currently this requires split I/O APIC
+ (<code><ioapic driver='qemu'/></code>).
+ <span class="since">Since 3.4.0</span> (QEMU/KVM only)
+ </p>
+ </dd>
+ </dl>
+ </dd>
</dl>
<h3><a name="seclabel">Security label</a></h3>
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;
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;
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:
}
if (n > 0) {
- if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0])))
+ if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0], ctxt)))
goto error;
}
VIR_FREE(nodes);
virDomainIOMMUDefFormat(virBufferPtr buf,
const virDomainIOMMUDef *iommu)
{
- virBufferAsprintf(buf, "<iommu model='%s'/>\n",
+ virBuffer childBuf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
+
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
+ virBufferAsprintf(&childBuf, "<driver intremap='%s'/>\n",
+ virTristateSwitchTypeToString(iommu->intremap));
+ }
+
+ virBufferAsprintf(buf, "<iommu model='%s'",
virDomainIOMMUModelTypeToString(iommu->model));
+ if (virBufferUse(&childBuf)) {
+ virBufferAddLit(buf, ">\n");
+ virBufferAddBuffer(buf, &childBuf);
+ virBufferAddLit(buf, "</iommu>\n");
+ } else {
+ virBufferAddLit(buf, "/>\n");
+ }
}