faf5df2081
Fix spice GL qemu:///system rendernode permissions (bz #1460804) Fix on_reboot=destroy setting (bz #1476866) Fix disk images in /dev/shm (bz #1482146)
120 lines
5.1 KiB
Diff
120 lines
5.1 KiB
Diff
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Tue, 11 Apr 2017 11:14:30 +0200
|
|
Subject: [PATCH] qemu: Prepare qemuCaps for multiple host CPU defs
|
|
|
|
Soon we will need to store multiple host CPU definitions in
|
|
virQEMUCapsHostCPUData and qemuCaps users will want to request the one
|
|
they need. This patch introduces virQEMUCapsHostCPUType enum which will
|
|
be used for specifying the requested CPU definition.
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
(cherry picked from commit 1fe517c68df92eb7f379fa87cb0d29d566aad6f4)
|
|
---
|
|
src/qemu/qemu_capabilities.c | 16 ++++++++++++----
|
|
src/qemu/qemu_capabilities.h | 10 +++++++++-
|
|
src/qemu/qemu_command.c | 3 ++-
|
|
src/qemu/qemu_process.c | 6 ++++--
|
|
4 files changed, 27 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
index bbb234538..a6324a398 100644
|
|
--- a/src/qemu/qemu_capabilities.c
|
|
+++ b/src/qemu/qemu_capabilities.c
|
|
@@ -2439,11 +2439,17 @@ virQEMUCapsGetHostCPUData(virQEMUCapsPtr qemuCaps,
|
|
|
|
virCPUDefPtr
|
|
virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
|
- virDomainVirtType type)
|
|
+ virDomainVirtType type,
|
|
+ virQEMUCapsHostCPUType cpuType)
|
|
{
|
|
virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type);
|
|
|
|
- return cpuData->reported;
|
|
+ switch (cpuType) {
|
|
+ case VIR_QEMU_CAPS_HOST_CPU_REPORTED:
|
|
+ return cpuData->reported;
|
|
+ }
|
|
+
|
|
+ return NULL;
|
|
}
|
|
|
|
|
|
@@ -2472,7 +2478,8 @@ virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
|
virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch);
|
|
|
|
case VIR_CPU_MODE_HOST_MODEL:
|
|
- return !!virQEMUCapsGetHostModel(qemuCaps, type);
|
|
+ return !!virQEMUCapsGetHostModel(qemuCaps, type,
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED);
|
|
|
|
case VIR_CPU_MODE_CUSTOM:
|
|
if (type == VIR_DOMAIN_VIRT_KVM)
|
|
@@ -5456,7 +5463,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
|
|
|
|
if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype,
|
|
VIR_CPU_MODE_HOST_MODEL)) {
|
|
- virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype);
|
|
+ virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype,
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED);
|
|
domCaps->cpu.hostModel = virCPUDefCopy(cpu);
|
|
}
|
|
|
|
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
index d44682f2a..88e27855b 100644
|
|
--- a/src/qemu/qemu_capabilities.h
|
|
+++ b/src/qemu/qemu_capabilities.h
|
|
@@ -449,8 +449,16 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
|
|
virDomainVirtType type,
|
|
char ***names,
|
|
size_t *count);
|
|
+
|
|
+typedef enum {
|
|
+ /* Host CPU definition reported in domain capabilities. */
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED,
|
|
+} virQEMUCapsHostCPUType;
|
|
+
|
|
virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
|
|
- virDomainVirtType type);
|
|
+ virDomainVirtType type,
|
|
+ virQEMUCapsHostCPUType cpuType);
|
|
+
|
|
bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
|
|
virCapsPtr caps,
|
|
virDomainVirtType type,
|
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
index 3abfe7b55..311edd13e 100644
|
|
--- a/src/qemu/qemu_command.c
|
|
+++ b/src/qemu/qemu_command.c
|
|
@@ -6879,7 +6879,8 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
if (def->cpu->mode == VIR_CPU_MODE_CUSTOM)
|
|
cpuDef = def->cpu;
|
|
else if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
|
|
- cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType);
|
|
+ cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType,
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED);
|
|
|
|
if (cpuDef) {
|
|
int svm = virCPUCheckFeature(def->os.arch, cpuDef, "svm");
|
|
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
index 26a668d27..07a88a3a7 100644
|
|
--- a/src/qemu/qemu_process.c
|
|
+++ b/src/qemu/qemu_process.c
|
|
@@ -5299,12 +5299,14 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
|
|
|
|
if (def->cpu->check == VIR_CPU_CHECK_PARTIAL &&
|
|
virCPUCompare(caps->host.arch,
|
|
- virQEMUCapsGetHostModel(qemuCaps, def->virtType),
|
|
+ virQEMUCapsGetHostModel(qemuCaps, def->virtType,
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED),
|
|
def->cpu, true) < 0)
|
|
return -1;
|
|
|
|
if (virCPUUpdate(def->os.arch, def->cpu,
|
|
- virQEMUCapsGetHostModel(qemuCaps, def->virtType)) < 0)
|
|
+ virQEMUCapsGetHostModel(qemuCaps, def->virtType,
|
|
+ VIR_QEMU_CAPS_HOST_CPU_REPORTED)) < 0)
|
|
goto cleanup;
|
|
|
|
if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType,
|