|
|
c480ed |
From 2d8d4379690e55d8d9a0b194ddef33d073154c7b Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <2d8d4379690e55d8d9a0b194ddef33d073154c7b@dist-git>
|
|
|
c480ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Date: Fri, 21 Jun 2019 09:25:03 +0200
|
|
|
c480ed |
Subject: [PATCH] qemu_capabilities: Inroduce virQEMUCapsGetCPUModelX86Data
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
The code for transforming qemuMonitorCPUModelInfo data from QEMU into
|
|
|
c480ed |
virCPUDefPtr consumable by virCPU* APIs was hidden inside
|
|
|
c480ed |
virQEMUCapsInitCPUModelX86. This patch moves it into a new function to
|
|
|
c480ed |
make it usable in tests.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 30e4faac2f3e72aec29be9963d7a5394153e812f)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Message-Id: <e91c6c1e8de59a6cc151154f7c2a9eae79249fa5.1561068591.git.jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/qemu/qemu_capabilities.c | 50 ++++++++++++++++++++++++------------
|
|
|
c480ed |
src/qemu/qemu_capspriv.h | 4 +++
|
|
|
c480ed |
2 files changed, 38 insertions(+), 16 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
c480ed |
index 5539d168cd..5a7160d02e 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_capabilities.c
|
|
|
c480ed |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
c480ed |
@@ -2812,28 +2812,17 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
-/**
|
|
|
c480ed |
- * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps,
|
|
|
c480ed |
- * 1 when the caller should fall back to using virCapsPtr->host.cpu,
|
|
|
c480ed |
- * -1 on error.
|
|
|
c480ed |
- */
|
|
|
c480ed |
-static int
|
|
|
c480ed |
-virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
- virDomainVirtType type,
|
|
|
c480ed |
- qemuMonitorCPUModelInfoPtr model,
|
|
|
c480ed |
- virCPUDefPtr cpu,
|
|
|
c480ed |
- bool migratable)
|
|
|
c480ed |
+virCPUDataPtr
|
|
|
c480ed |
+virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelInfoPtr model,
|
|
|
c480ed |
+ bool migratable)
|
|
|
c480ed |
{
|
|
|
c480ed |
- virCPUDataPtr data = NULL;
|
|
|
c480ed |
unsigned long long sigFamily = 0;
|
|
|
c480ed |
unsigned long long sigModel = 0;
|
|
|
c480ed |
unsigned long long sigStepping = 0;
|
|
|
c480ed |
- int ret = -1;
|
|
|
c480ed |
+ virCPUDataPtr data = NULL;
|
|
|
c480ed |
+ virCPUDataPtr ret = NULL;
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
|
|
|
c480ed |
- if (!model)
|
|
|
c480ed |
- return 1;
|
|
|
c480ed |
-
|
|
|
c480ed |
if (!(data = virCPUDataNew(VIR_ARCH_X86_64)))
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
@@ -2874,6 +2863,35 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
if (virCPUx86DataSetSignature(data, sigFamily, sigModel, sigStepping) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
+ VIR_STEAL_PTR(ret, data);
|
|
|
c480ed |
+
|
|
|
c480ed |
+ cleanup:
|
|
|
c480ed |
+ virCPUDataFree(data);
|
|
|
c480ed |
+ return ret;
|
|
|
c480ed |
+}
|
|
|
c480ed |
+
|
|
|
c480ed |
+
|
|
|
c480ed |
+/**
|
|
|
c480ed |
+ * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps,
|
|
|
c480ed |
+ * 1 when the caller should fall back to using virCapsPtr->host.cpu,
|
|
|
c480ed |
+ * -1 on error.
|
|
|
c480ed |
+ */
|
|
|
c480ed |
+static int
|
|
|
c480ed |
+virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
+ virDomainVirtType type,
|
|
|
c480ed |
+ qemuMonitorCPUModelInfoPtr model,
|
|
|
c480ed |
+ virCPUDefPtr cpu,
|
|
|
c480ed |
+ bool migratable)
|
|
|
c480ed |
+{
|
|
|
c480ed |
+ virCPUDataPtr data = NULL;
|
|
|
c480ed |
+ int ret = -1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (!model)
|
|
|
c480ed |
+ return 1;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (!(data = virQEMUCapsGetCPUModelX86Data(model, migratable)))
|
|
|
c480ed |
+ goto cleanup;
|
|
|
c480ed |
+
|
|
|
c480ed |
if (cpuDecode(cpu, data, virQEMUCapsGetCPUDefinitions(qemuCaps, type)) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
|
|
|
c480ed |
index cb5e0dd9a9..70cdbbc504 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_capspriv.h
|
|
|
c480ed |
+++ b/src/qemu/qemu_capspriv.h
|
|
|
c480ed |
@@ -80,6 +80,10 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
virDomainVirtType type,
|
|
|
c480ed |
qemuMonitorCPUModelInfoPtr modelInfo);
|
|
|
c480ed |
|
|
|
c480ed |
+virCPUDataPtr
|
|
|
c480ed |
+virQEMUCapsGetCPUModelX86Data(qemuMonitorCPUModelInfoPtr model,
|
|
|
c480ed |
+ bool migratable);
|
|
|
c480ed |
+
|
|
|
c480ed |
virCPUDefPtr
|
|
|
c480ed |
virQEMUCapsProbeHostCPUForEmulator(virArch hostArch,
|
|
|
c480ed |
virQEMUCapsPtr qemuCaps,
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|