|
Pablo Greco |
40546a |
From 6227a5d2d70dd396c428af4864ab38b1a32ef0f5 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <6227a5d2d70dd396c428af4864ab38b1a32ef0f5@dist-git>
|
|
Pablo Greco |
40546a |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Fri, 15 Nov 2019 17:52:34 +0100
|
|
Pablo Greco |
40546a |
Subject: [PATCH] qemu: Drop disabled CPU features unknown to 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 |
When a CPU definition wants to explicitly disable some features that are
|
|
Pablo Greco |
40546a |
unknown to QEMU, we can safely drop them from the definition before
|
|
Pablo Greco |
40546a |
starting QEMU. Naturally QEMU won't enable such features implicitly.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit ac34e141596fab70fbe91a396311f80db6cb57c5)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1749672
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1756156
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1721608
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Conflicts:
|
|
Pablo Greco |
40546a |
src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
- downstream still uses cleanup label
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <92f146f8754300266d688dd92dfe95e737dda7da.1573836581.git.jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/qemu/qemu_process.c | 32 +++++++++++++++++++
|
|
Pablo Greco |
40546a |
...-Icelake-Server-pconfig.x86_64-latest.args | 2 +-
|
|
Pablo Greco |
40546a |
2 files changed, 33 insertions(+), 1 deletion(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
index 0cd61f02bb..0700b054f3 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
@@ -5730,6 +5730,26 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static bool
|
|
Pablo Greco |
40546a |
+qemuProcessDropUnknownCPUFeatures(const char *name,
|
|
Pablo Greco |
40546a |
+ virCPUFeaturePolicy policy,
|
|
Pablo Greco |
40546a |
+ void *opaque)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ const char **features = opaque;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (policy != VIR_CPU_FEATURE_DISABLE &&
|
|
Pablo Greco |
40546a |
+ policy != VIR_CPU_FEATURE_FORBID)
|
|
Pablo Greco |
40546a |
+ return true;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (virStringListHasString(features, name))
|
|
Pablo Greco |
40546a |
+ return true;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ /* Features unknown to QEMU are implicitly disabled, we can just drop them
|
|
Pablo Greco |
40546a |
+ * from the definition. */
|
|
Pablo Greco |
40546a |
+ return false;
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
static int
|
|
Pablo Greco |
40546a |
qemuProcessUpdateGuestCPU(virDomainDefPtr def,
|
|
Pablo Greco |
40546a |
virQEMUCapsPtr qemuCaps,
|
|
Pablo Greco |
40546a |
@@ -5792,6 +5812,18 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
|
|
Pablo Greco |
40546a |
virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType)) < 0)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+ if (ARCH_IS_X86(def->os.arch)) {
|
|
Pablo Greco |
40546a |
+ VIR_AUTOSTRINGLIST features = NULL;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (virQEMUCapsGetCPUFeatures(qemuCaps, def->virtType, false, &features) < 0)
|
|
Pablo Greco |
40546a |
+ goto cleanup;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (features &&
|
|
Pablo Greco |
40546a |
+ virCPUDefFilterFeatures(def->cpu, qemuProcessDropUnknownCPUFeatures,
|
|
Pablo Greco |
40546a |
+ features) < 0)
|
|
Pablo Greco |
40546a |
+ goto cleanup;
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
def->cpu->fallback = VIR_CPU_FALLBACK_FORBID;
|
|
Pablo Greco |
40546a |
ret = 0;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-latest.args b/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-latest.args
|
|
Pablo Greco |
40546a |
index 664db44e7b..de737bfed7 100644
|
|
Pablo Greco |
40546a |
--- a/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-latest.args
|
|
Pablo Greco |
40546a |
+++ b/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-latest.args
|
|
Pablo Greco |
40546a |
@@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \
|
|
Pablo Greco |
40546a |
-object secret,id=masterKey0,format=raw,\
|
|
Pablo Greco |
40546a |
file=/tmp/lib/domain--1-test/master-key.aes \
|
|
Pablo Greco |
40546a |
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
|
|
Pablo Greco |
40546a |
--cpu Icelake-Server,pconfig=off \
|
|
Pablo Greco |
40546a |
+-cpu Icelake-Server \
|
|
Pablo Greco |
40546a |
-m 214 \
|
|
Pablo Greco |
40546a |
-realtime mlock=off \
|
|
Pablo Greco |
40546a |
-smp 1,sockets=1,cores=1,threads=1 \
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.24.0
|
|
Pablo Greco |
40546a |
|