|
|
c313de |
From b3f714b0907ff1a906d8725efb26733caa913b01 Mon Sep 17 00:00:00 2001
|
|
|
c313de |
Message-Id: <b3f714b0907ff1a906d8725efb26733caa913b01@dist-git>
|
|
|
c313de |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c313de |
Date: Fri, 21 Jun 2019 09:25:47 +0200
|
|
|
c313de |
Subject: [PATCH] qemu_command: Use consistent syntax for CPU features
|
|
|
c313de |
MIME-Version: 1.0
|
|
|
c313de |
Content-Type: text/plain; charset=UTF-8
|
|
|
c313de |
Content-Transfer-Encoding: 8bit
|
|
|
c313de |
|
|
|
c313de |
Normal CPU features use modern -cpu ...,feature=on|off syntax when
|
|
|
c313de |
available, but kvm features kept using the old +feature or -feature.
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c313de |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c313de |
(cherry picked from commit e1ba4073961091522b1560472c5559124bd3c034)
|
|
|
c313de |
|
|
|
c313de |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
|
c313de |
|
|
|
c313de |
Conflicts:
|
|
|
c313de |
tests/qemuxml2argvdata/eoi-disabled.x86_64-latest.args
|
|
|
c313de |
tests/qemuxml2argvdata/eoi-enabled.x86_64-latest.args
|
|
|
c313de |
tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-latest.args
|
|
|
c313de |
tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-latest.args
|
|
|
c313de |
tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-latest.args
|
|
|
c313de |
- not backported
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c313de |
Message-Id: <da608f8dcef1eeb3e62d4c1d921c8182c1b4d533.1561068591.git.jdenemar@redhat.com>
|
|
|
c313de |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c313de |
---
|
|
|
c313de |
src/qemu/qemu_command.c | 46 +++++++++++++++++++----------------------
|
|
|
c313de |
1 file changed, 21 insertions(+), 25 deletions(-)
|
|
|
c313de |
|
|
|
c313de |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
c313de |
index 7ffc4358e3..bea9a208e5 100644
|
|
|
c313de |
--- a/src/qemu/qemu_command.c
|
|
|
c313de |
+++ b/src/qemu/qemu_command.c
|
|
|
c313de |
@@ -6813,6 +6813,19 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
|
|
|
c313de |
+static void
|
|
|
c313de |
+qemuBuildCpuFeature(virQEMUCapsPtr qemuCaps,
|
|
|
c313de |
+ virBufferPtr buf,
|
|
|
c313de |
+ const char *name,
|
|
|
c313de |
+ bool state)
|
|
|
c313de |
+{
|
|
|
c313de |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
|
c313de |
+ virBufferAsprintf(buf, ",%s=%s", name, state ? "on" : "off");
|
|
|
c313de |
+ else
|
|
|
c313de |
+ virBufferAsprintf(buf, ",%c%s", state ? '+' : '-', name);
|
|
|
c313de |
+}
|
|
|
c313de |
+
|
|
|
c313de |
+
|
|
|
c313de |
static int
|
|
|
c313de |
qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
c313de |
const virDomainDef *def,
|
|
|
c313de |
@@ -6890,18 +6903,12 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
|
|
c313de |
switch ((virCPUFeaturePolicy) cpu->features[i].policy) {
|
|
|
c313de |
case VIR_CPU_FEATURE_FORCE:
|
|
|
c313de |
case VIR_CPU_FEATURE_REQUIRE:
|
|
|
c313de |
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
|
c313de |
- virBufferAsprintf(buf, ",%s=on", cpu->features[i].name);
|
|
|
c313de |
- else
|
|
|
c313de |
- virBufferAsprintf(buf, ",+%s", cpu->features[i].name);
|
|
|
c313de |
+ qemuBuildCpuFeature(qemuCaps, buf, cpu->features[i].name, true);
|
|
|
c313de |
break;
|
|
|
c313de |
|
|
|
c313de |
case VIR_CPU_FEATURE_DISABLE:
|
|
|
c313de |
case VIR_CPU_FEATURE_FORBID:
|
|
|
c313de |
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
|
|
|
c313de |
- virBufferAsprintf(buf, ",%s=off", cpu->features[i].name);
|
|
|
c313de |
- else
|
|
|
c313de |
- virBufferAsprintf(buf, ",-%s", cpu->features[i].name);
|
|
|
c313de |
+ qemuBuildCpuFeature(qemuCaps, buf, cpu->features[i].name, false);
|
|
|
c313de |
break;
|
|
|
c313de |
|
|
|
c313de |
case VIR_CPU_FEATURE_OPTIONAL:
|
|
|
c313de |
@@ -6982,8 +6989,8 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
|
c313de |
|
|
|
c313de |
if (timer->name == VIR_DOMAIN_TIMER_NAME_KVMCLOCK &&
|
|
|
c313de |
timer->present != -1) {
|
|
|
c313de |
- virBufferAsprintf(&buf, ",%ckvmclock",
|
|
|
c313de |
- timer->present ? '+' : '-');
|
|
|
c313de |
+ qemuBuildCpuFeature(qemuCaps, &buf, "kvmclock",
|
|
|
c313de |
+ !!timer->present);
|
|
|
c313de |
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK &&
|
|
|
c313de |
timer->present == 1) {
|
|
|
c313de |
virBufferAddLit(&buf, ",hv_time");
|
|
|
c313de |
@@ -6994,24 +7001,13 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
if (def->apic_eoi) {
|
|
|
c313de |
- char sign;
|
|
|
c313de |
- if (def->apic_eoi == VIR_TRISTATE_SWITCH_ON)
|
|
|
c313de |
- sign = '+';
|
|
|
c313de |
- else
|
|
|
c313de |
- sign = '-';
|
|
|
c313de |
-
|
|
|
c313de |
- virBufferAsprintf(&buf, ",%ckvm_pv_eoi", sign);
|
|
|
c313de |
+ qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_eoi",
|
|
|
c313de |
+ def->apic_eoi == VIR_TRISTATE_SWITCH_ON);
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK]) {
|
|
|
c313de |
- char sign;
|
|
|
c313de |
- if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] ==
|
|
|
c313de |
- VIR_TRISTATE_SWITCH_ON)
|
|
|
c313de |
- sign = '+';
|
|
|
c313de |
- else
|
|
|
c313de |
- sign = '-';
|
|
|
c313de |
-
|
|
|
c313de |
- virBufferAsprintf(&buf, ",%ckvm_pv_unhalt", sign);
|
|
|
c313de |
+ qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_unhalt",
|
|
|
c313de |
+ def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON);
|
|
|
c313de |
}
|
|
|
c313de |
|
|
|
c313de |
if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
|
|
|
c313de |
--
|
|
|
c313de |
2.22.0
|
|
|
c313de |
|