073345
From 3338d2ca3f36c9f9546cbcd436c344c8a3c97285 Mon Sep 17 00:00:00 2001
073345
Message-Id: <3338d2ca3f36c9f9546cbcd436c344c8a3c97285@dist-git>
073345
From: Jiri Denemark <jdenemar@redhat.com>
073345
Date: Fri, 7 Feb 2020 10:41:42 +0100
073345
Subject: [PATCH] qemu: Prefer dashes for hyperv features
073345
MIME-Version: 1.0
073345
Content-Type: text/plain; charset=UTF-8
073345
Content-Transfer-Encoding: 8bit
073345
073345
Starting with QEMU 4.1, we're using the canonical feature names on the
073345
command line and avoid aliases to prepare for possible deprecation of
073345
all aliases in QEMU. But we do so only for features from our CPU map,
073345
hyperv features defined in the code were unchanged and this patch fixes
073345
it. Some features use "hv-" prefix unconditionally because they were
073345
introduced recently enough to always support spelling with a dash.
073345
073345
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
073345
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
073345
Reviewed-by: Ján Tomko <jtomko@redhat.com>
073345
(cherry picked from commit d99e8f01c7f9b5a0f384ccaac40187091a4e6c6c)
073345
073345
https://bugzilla.redhat.com/show_bug.cgi?id=1794868
073345
073345
Conflicts:
073345
	tests/qemuxml2argvdata/hyperv.args
073345
            - a few extra hyperv features upstream
073345
073345
Since "unavailable-features" QOM property was backported to QEMU 2.12,
073345
we would effectively start using "hv-" prefix (instead of "hv_") for all
073345
hyperv features. This is fine because the downstream version of QEMU
073345
with "unavailable-features" backported defines all supported hyperv
073345
features with dashes.
073345
073345
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
073345
Message-Id: <57ee0267b028177420edeae0edcf479de3f52820.1581064395.git.jdenemar@redhat.com>
073345
Reviewed-by: Ján Tomko <jtomko@redhat.com>
073345
---
073345
 src/qemu/qemu_command.c                         | 17 ++++++++++++-----
073345
 .../clock-timer-hyperv-rtc.args                 |  2 +-
073345
 tests/qemuxml2argvdata/hyperv-panic.args        |  2 +-
073345
 tests/qemuxml2argvdata/hyperv.args              |  4 ++--
073345
 tests/qemuxml2argvdata/panic-double.args        |  2 +-
073345
 5 files changed, 17 insertions(+), 10 deletions(-)
073345
073345
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
073345
index 2b885e98dd..0289a907a1 100644
073345
--- a/src/qemu/qemu_command.c
073345
+++ b/src/qemu/qemu_command.c
073345
@@ -6995,7 +6995,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
073345
                                 !!timer->present);
073345
         } else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK &&
073345
                    timer->present == 1) {
073345
-            virBufferAddLit(&buf, ",hv_time");
073345
+            virBufferAddLit(&buf, ",hv-time");
073345
         } else if (timer->name == VIR_DOMAIN_TIMER_NAME_TSC &&
073345
                    timer->frequency > 0) {
073345
             virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
073345
@@ -7013,6 +7013,11 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
073345
     }
073345
 
073345
     if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
073345
+        const char *hvPrefix = "hv-";
073345
+
073345
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
073345
+            hvPrefix = "hv_";
073345
+
073345
         for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
073345
             switch ((virDomainHyperv) i) {
073345
             case VIR_DOMAIN_HYPERV_RELAXED:
073345
@@ -7026,19 +7031,21 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
073345
             case VIR_DOMAIN_HYPERV_REENLIGHTENMENT:
073345
             case VIR_DOMAIN_HYPERV_TLBFLUSH:
073345
                 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
073345
-                    virBufferAsprintf(&buf, ",hv_%s",
073345
+                    virBufferAsprintf(&buf, ",%s%s",
073345
+                                      hvPrefix,
073345
                                       virDomainHypervTypeToString(i));
073345
                 break;
073345
 
073345
             case VIR_DOMAIN_HYPERV_SPINLOCKS:
073345
                 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
073345
-                    virBufferAsprintf(&buf, ",hv_spinlocks=0x%x",
073345
+                    virBufferAsprintf(&buf, ",%s=0x%x",
073345
+                                      VIR_CPU_x86_KVM_HV_SPINLOCKS,
073345
                                       def->hyperv_spinlocks);
073345
                 break;
073345
 
073345
             case VIR_DOMAIN_HYPERV_VENDOR_ID:
073345
                 if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
073345
-                    virBufferAsprintf(&buf, ",hv_vendor_id=%s",
073345
+                    virBufferAsprintf(&buf, ",hv-vendor-id=%s",
073345
                                       def->hyperv_vendor_id);
073345
                 break;
073345
 
073345
@@ -7051,7 +7058,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
073345
 
073345
     for (i = 0; i < def->npanics; i++) {
073345
         if (def->panics[i]->model == VIR_DOMAIN_PANIC_MODEL_HYPERV) {
073345
-            virBufferAddLit(&buf, ",hv_crash");
073345
+            virBufferAddLit(&buf, ",hv-crash");
073345
             break;
073345
         }
073345
     }
073345
diff --git a/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args b/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args
073345
index 6045fbdbf2..1e36d139f9 100644
073345
--- a/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args
073345
+++ b/tests/qemuxml2argvdata/clock-timer-hyperv-rtc.args
073345
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
073345
 -name QEMUGuest1 \
073345
 -S \
073345
 -machine pc,accel=kvm,usb=off,dump-guest-core=off \
073345
--cpu qemu32,hv_time \
073345
+-cpu qemu32,hv-time \
073345
 -m 214 \
073345
 -smp 6,sockets=6,cores=1,threads=1 \
073345
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
073345
diff --git a/tests/qemuxml2argvdata/hyperv-panic.args b/tests/qemuxml2argvdata/hyperv-panic.args
073345
index fca46d7371..627fb09502 100644
073345
--- a/tests/qemuxml2argvdata/hyperv-panic.args
073345
+++ b/tests/qemuxml2argvdata/hyperv-panic.args
073345
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
073345
 -name QEMUGuest1 \
073345
 -S \
073345
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
073345
--cpu qemu32,hv_crash \
073345
+-cpu qemu32,hv-crash \
073345
 -m 214 \
073345
 -smp 6,sockets=6,cores=1,threads=1 \
073345
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
073345
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
073345
index 6ee6198fb0..a5fc6a1121 100644
073345
--- a/tests/qemuxml2argvdata/hyperv.args
073345
+++ b/tests/qemuxml2argvdata/hyperv.args
073345
@@ -8,8 +8,8 @@ QEMU_AUDIO_DRV=none \
073345
 -name QEMUGuest1 \
073345
 -S \
073345
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
073345
--cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
073345
-hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\
073345
+-cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=0x2fff,hv_vpindex,hv_runtime,\
073345
+hv_synic,hv_stimer,hv_reset,hv-vendor-id=KVM Hv,hv_frequencies,\
073345
 hv_reenlightenment,hv_tlbflush' \
073345
 -m 214 \
073345
 -smp 6,sockets=6,cores=1,threads=1 \
073345
diff --git a/tests/qemuxml2argvdata/panic-double.args b/tests/qemuxml2argvdata/panic-double.args
073345
index 7acee1ae29..8a632477b1 100644
073345
--- a/tests/qemuxml2argvdata/panic-double.args
073345
+++ b/tests/qemuxml2argvdata/panic-double.args
073345
@@ -8,7 +8,7 @@ QEMU_AUDIO_DRV=none \
073345
 -name QEMUGuest1 \
073345
 -S \
073345
 -machine pc,accel=tcg,usb=off,dump-guest-core=off \
073345
--cpu qemu32,hv_crash \
073345
+-cpu qemu32,hv-crash \
073345
 -m 214 \
073345
 -smp 6,sockets=6,cores=1,threads=1 \
073345
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
073345
-- 
073345
2.25.0
073345