]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Drop MSR features from host-model with old QEMU
authorJiri Denemark <jdenemar@redhat.com>
Wed, 19 Jun 2019 20:22:09 +0000 (22:22 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 20 Jun 2019 12:02:36 +0000 (14:02 +0200)
With QEMU versions which lack "unavailable-features" we use CPUID based
detection of features which were enabled or disabled once QEMU starts.
Thus using MSR features with host-model would result in all of them
being marked as disabled in the active domain definition even though
QEMU did not actually disable them.

Let's make sure we add MSR features to host-model only when
"unavailable-features" property is supported by QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml
tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml

index 4134f319acd33ab1b3e8be983c3de37901b11ece..02e84edc15253c040090347e968b316843ed8ea1 100644 (file)
@@ -3193,6 +3193,21 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
             goto error;
     }
 
+    if (ARCH_IS_X86(qemuCaps->arch) &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) {
+        if (cpu &&
+            virCPUDefFilterFeatures(cpu, virCPUx86FeatureFilterDropMSR, NULL) < 0)
+            goto error;
+
+        if (migCPU &&
+            virCPUDefFilterFeatures(migCPU, virCPUx86FeatureFilterDropMSR, NULL) < 0)
+            goto error;
+
+        if (fullCPU &&
+            virCPUDefFilterFeatures(fullCPU, virCPUx86FeatureFilterDropMSR, NULL) < 0)
+            goto error;
+    }
+
     virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU);
 
  cleanup:
index dfd186afba5ea56c895bdb9720a30efda02f69dc..ca3baab88c607da471b092c8b2bb61d463731ef4 100644 (file)
@@ -42,7 +42,6 @@
       <feature policy='require' name='xsaves'/>
       <feature policy='require' name='pdpe1gb'/>
       <feature policy='require' name='invtsc'/>
-      <feature policy='require' name='skip-l1dfl-vmentry'/>
     </mode>
     <mode name='custom' supported='yes'>
       <model usable='yes'>qemu64</model>
index 36f6f1e94db6d35943afbc634313920489a8b514..cba841d84414c10e1c8a3ba806ac53e9fab34757 100644 (file)
@@ -42,7 +42,6 @@
       <feature policy='require' name='xsaves'/>
       <feature policy='require' name='pdpe1gb'/>
       <feature policy='require' name='invtsc'/>
-      <feature policy='require' name='skip-l1dfl-vmentry'/>
     </mode>
     <mode name='custom' supported='yes'>
       <model usable='yes'>qemu64</model>