|
Pablo Greco |
40546a |
From 894b1e28647f0fd46da3ffc64afc358d438153f9 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <894b1e28647f0fd46da3ffc64afc358d438153f9@dist-git>
|
|
Pablo Greco |
40546a |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Fri, 21 Jun 2019 09:26:04 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] qemu_process: Prefer generic qemuMonitorGetGuestCPU
|
|
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 updating guest CPU definition according to the vCPU actually
|
|
Pablo Greco |
40546a |
created by QEMU, we want to use the generic qemuMonitorGetGuestCPU to
|
|
Pablo Greco |
40546a |
get both CPUID and MSR features.
|
|
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 63acb7bfd56f117309e4fcaf438639d4d7bc7dcb)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <711a363fde6df79fe9a26b6b4cb0a185cc5ad3cb.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_process.c | 24 ++++++++++++++++++++++--
|
|
Pablo Greco |
40546a |
1 file changed, 22 insertions(+), 2 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
index 59a739f262..d147e524ee 100644
|
|
Pablo Greco |
40546a |
--- a/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
+++ b/src/qemu/qemu_process.c
|
|
Pablo Greco |
40546a |
@@ -4013,6 +4013,16 @@ qemuProcessVerifyCPUFeatures(virDomainDefPtr def,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+static const char *
|
|
Pablo Greco |
40546a |
+qemuProcessTranslateCPUFeatures(const char *name,
|
|
Pablo Greco |
40546a |
+ void *opaque)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ virQEMUCapsPtr qemuCaps = opaque;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ return virQEMUCapsCPUFeatureFromQEMU(qemuCaps, name);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
static int
|
|
Pablo Greco |
40546a |
qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
|
|
Pablo Greco |
40546a |
virDomainObjPtr vm,
|
|
Pablo Greco |
40546a |
@@ -4023,18 +4033,28 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
|
|
Pablo Greco |
40546a |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
Pablo Greco |
40546a |
virCPUDataPtr dataEnabled = NULL;
|
|
Pablo Greco |
40546a |
virCPUDataPtr dataDisabled = NULL;
|
|
Pablo Greco |
40546a |
+ bool generic;
|
|
Pablo Greco |
40546a |
int rc;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
*enabled = NULL;
|
|
Pablo Greco |
40546a |
*disabled = NULL;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (!ARCH_IS_X86(vm->def->os.arch))
|
|
Pablo Greco |
40546a |
+ generic = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (!generic && !ARCH_IS_X86(vm->def->os.arch))
|
|
Pablo Greco |
40546a |
return 0;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
Pablo Greco |
40546a |
goto error;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled);
|
|
Pablo Greco |
40546a |
+ if (generic) {
|
|
Pablo Greco |
40546a |
+ rc = qemuMonitorGetGuestCPU(priv->mon,
|
|
Pablo Greco |
40546a |
+ vm->def->os.arch,
|
|
Pablo Greco |
40546a |
+ qemuProcessTranslateCPUFeatures, priv->qemuCaps,
|
|
Pablo Greco |
40546a |
+ &dataEnabled, &dataDisabled);
|
|
Pablo Greco |
40546a |
+ } else {
|
|
Pablo Greco |
40546a |
+ rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled);
|
|
Pablo Greco |
40546a |
+ }
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
Pablo Greco |
40546a |
goto error;
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|