render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From 360c3ee173809822e9363ec210a8197b66511a03 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <360c3ee173809822e9363ec210a8197b66511a03@dist-git>
Pablo Greco 40546a
From: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Date: Fri, 21 Jun 2019 09:26:12 +0200
Pablo Greco 40546a
Subject: [PATCH] qemu: Drop MSR features from host-model with old QEMU
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
With QEMU versions which lack "unavailable-features" we use CPUID based
Pablo Greco 40546a
detection of features which were enabled or disabled once QEMU starts.
Pablo Greco 40546a
Thus using MSR features with host-model would result in all of them
Pablo Greco 40546a
being marked as disabled in the active domain definition even though
Pablo Greco 40546a
QEMU did not actually disable them.
Pablo Greco 40546a
Pablo Greco 40546a
Let's make sure we add MSR features to host-model only when
Pablo Greco 40546a
"unavailable-features" property is supported by QEMU.
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 2674d00ed484091faf2b6e6b1efe58ee9a72b96b)
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
Pablo Greco 40546a
Pablo Greco 40546a
Conflicts:
Pablo Greco 40546a
	tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml
Pablo Greco 40546a
	tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
Pablo Greco 40546a
            - missing
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
Message-Id: <b7d9dd2f26053edb58fb8c3079334c2a494d07f9.1561068591.git.jdenemar@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/qemu/qemu_capabilities.c | 15 +++++++++++++++
Pablo Greco 40546a
 1 file changed, 15 insertions(+)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
index 4be0ec305f..fbfe74d45b 100644
Pablo Greco 40546a
--- a/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
+++ b/src/qemu/qemu_capabilities.c
Pablo Greco 40546a
@@ -3114,6 +3114,21 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
Pablo Greco 40546a
             goto error;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
+    if (ARCH_IS_X86(qemuCaps->arch) &&
Pablo Greco 40546a
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) {
Pablo Greco 40546a
+        if (cpu &&
Pablo Greco 40546a
+            virCPUDefFilterFeatures(cpu, virCPUx86FeatureFilterDropMSR, NULL) < 0)
Pablo Greco 40546a
+            goto error;
Pablo Greco 40546a
+
Pablo Greco 40546a
+        if (migCPU &&
Pablo Greco 40546a
+            virCPUDefFilterFeatures(migCPU, virCPUx86FeatureFilterDropMSR, NULL) < 0)
Pablo Greco 40546a
+            goto error;
Pablo Greco 40546a
+
Pablo Greco 40546a
+        if (fullCPU &&
Pablo Greco 40546a
+            virCPUDefFilterFeatures(fullCPU, virCPUx86FeatureFilterDropMSR, NULL) < 0)
Pablo Greco 40546a
+            goto error;
Pablo Greco 40546a
+    }
Pablo Greco 40546a
+
Pablo Greco 40546a
     virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU);
Pablo Greco 40546a
 
Pablo Greco 40546a
  cleanup:
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a