]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Enable I/O APIC if needed
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 12 Dec 2024 09:02:43 +0000 (10:02 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 16 Dec 2024 14:43:16 +0000 (15:43 +0100)
This is a follow up of my previous commits. If the number of
vCPUs exceeds some arbitrary value (255) then QEMU requires IOMMU
with EIM and intremap enabled. But in turn, intremap IOMMU
requires split I/O APIC (per virDomainDefIOMMUValidate()). Since
after my previous commits (e.g. v10.10.0-rc1~183) IOMMU is added
automagically, the I/O APIC can be also enabled automagically.

Relates to: https://issues.redhat.com/browse/RHEL-65844
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_postparse.c
tests/qemuxmlconfdata/intel-iommu-eim-autoadd.xml

index 03b5ef825a11fb0f2e3468ee932213f9a59224ac..f48f172c3732e854bf357106e2aa3a095846efd9 100644 (file)
@@ -1547,6 +1547,13 @@ qemuDomainDefEnableDefaultFeatures(virDomainDef *def,
          * capabilities, we still want to enable this */
         def->features[VIR_DOMAIN_FEATURE_GIC] = VIR_TRISTATE_SWITCH_ON;
     }
+
+    /* IOMMU with intremap requires split I/O APIC */
+    if (def->iommu &&
+        def->iommu->intremap == VIR_TRISTATE_SWITCH_ON &&
+        def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_DOMAIN_IOAPIC_NONE) {
+        def->features[VIR_DOMAIN_FEATURE_IOAPIC] = VIR_DOMAIN_IOAPIC_QEMU;
+    }
 }
 
 
index fa3aaf0d4449593ff217a30370b949ab14d2dfa2..5abc40e5663485066e6d95f944c31f730e1b8333 100644 (file)
@@ -8,9 +8,6 @@
     <type arch='x86_64' machine='q35'>hvm</type>
     <boot dev='hd'/>
   </os>
-  <features>
-    <ioapic driver='qemu'/>
-  </features>
   <cpu mode='custom' match='exact' check='none'>
     <model fallback='forbid'>qemu64</model>
   </cpu>