libvirt/SOURCES/libvirt-qemu-Drop-MSR-featu...

66 lines
2.3 KiB
Diff

From 360c3ee173809822e9363ec210a8197b66511a03 Mon Sep 17 00:00:00 2001
Message-Id: <360c3ee173809822e9363ec210a8197b66511a03@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 21 Jun 2019 09:26:12 +0200
Subject: [PATCH] qemu: Drop MSR features from host-model with old QEMU
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit 2674d00ed484091faf2b6e6b1efe58ee9a72b96b)
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
Conflicts:
tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml
tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
- missing
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <b7d9dd2f26053edb58fb8c3079334c2a494d07f9.1561068591.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_capabilities.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4be0ec305f..fbfe74d45b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3114,6 +3114,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:
--
2.22.0