]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: validate IOMMU interrupt remapping setting
authorJán Tomko <jtomko@redhat.com>
Wed, 23 Aug 2017 17:15:06 +0000 (19:15 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 11 Sep 2017 12:56:07 +0000 (14:56 +0200)
This option requires:
  <ioapic driver='qemu'/>

Report an error in case someone tries to combine
it with different ioapic setting.

Setting 'eim' on without enabling 'intremap' does not make sense.

https://bugzilla.redhat.com/show_bug.cgi?id=1457610

src/conf/domain_conf.c

index ae2e96e96432b4d8a3ec4788344d7314c6c55bb9..676fc0f34b6c4bd82f6cb09d8cedb65a87d1f5cb 100644 (file)
@@ -5575,6 +5575,24 @@ virDomainDefValidateInternal(const virDomainDef *def)
     if (virDomainDefGetVcpusTopology(def, NULL) < 0)
         return -1;
 
+    if (def->iommu &&
+        def->iommu->intremap == VIR_TRISTATE_SWITCH_ON &&
+        (def->features[VIR_DOMAIN_FEATURE_IOAPIC] != VIR_TRISTATE_SWITCH_ON ||
+         def->ioapic != VIR_DOMAIN_IOAPIC_QEMU)) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("IOMMU interrupt remapping requires split I/O APIC "
+                         "(ioapic driver='qemu')"));
+        return -1;
+    }
+
+    if (def->iommu &&
+        def->iommu->eim == VIR_TRISTATE_SWITCH_ON &&
+        def->iommu->intremap != VIR_TRISTATE_SWITCH_ON) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("IOMMU eim requires interrupt remapping to be enabled"));
+        return -1;
+    }
+
     return 0;
 }