render / rpms / libvirt

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