On Thu, Jun 20, 2019 at 12:53:42AM +0200, Jiri Denemark wrote:
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 <jdene...@redhat.com>
---
src/qemu/qemu_capabilities.c                     | 16 ++++++++++++++++
tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml |  1 -
tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml |  1 -
3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4134f319ac..b7c20f3e3e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3193,6 +3193,22 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
            goto error;
    }

+    if (ARCH_IS_X86(qemuCaps->arch) &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) {
+        bool selecting = false;

void *invert = (void *)(intptr_t)0x1;
 or (if you don't like the pointer fun)
bool invert = true;


+        if (cpu &&
+            virCPUDefFilterFeatures(cpu, virCPUx86FeatureIsMSR, &selecting) < 
0)
+            goto error;
+
+        if (migCPU &&
+            virCPUDefFilterFeatures(migCPU, virCPUx86FeatureIsMSR, &selecting) 
< 0)
+            goto error;
+
+        if (fullCPU &&
+            virCPUDefFilterFeatures(fullCPU, virCPUx86FeatureIsMSR, &selecting) 
< 0)
+            goto error;
+    }
+
    virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU);


Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to