render / rpms / libvirt

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