render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
073345
From bc74a9da7d6b5c747655468022fdcdd9f9f5f25d Mon Sep 17 00:00:00 2001
073345
Message-Id: <bc74a9da7d6b5c747655468022fdcdd9f9f5f25d@dist-git>
073345
From: Jiri Denemark <jdenemar@redhat.com>
073345
Date: Fri, 7 Feb 2020 10:41:41 +0100
073345
Subject: [PATCH] qemu: Fix hyperv features with QEMU 4.1
073345
MIME-Version: 1.0
073345
Content-Type: text/plain; charset=UTF-8
073345
Content-Transfer-Encoding: 8bit
073345
073345
Originally the names of the hyperv CPU features were only used
073345
internally for looking up their CPUID bits. So we used "__kvm_hv_"
073345
prefix for them to make sure the names do not collide with normal CPU
073345
features stored in our CPU map.
073345
073345
But with QEMU 4.1 we check which features were enabled or disabled by a
073345
freshly started QEMU process using their names rather than their CPUID
073345
bits (mostly because of MSR features). Thus we need to change our made
073345
up internal names into the actual names used by QEMU. Most of the names
073345
are only used with QEMU 4.1 and newer and the reset was introduced with
073345
QEMU recently enough to already support spelling with "-". Thus we don't
073345
need to define them as "hv_*" with a translation to "hv-*" for new QEMU.
073345
073345
Without this patch libvirt would mistakenly report all hyperv features
073345
as unavailable and refuse to start any domain using them with QEMU 4.1.
073345
073345
Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
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 0ccdd476bb329f1486438b896255e5c44a91ff4a)
073345
073345
https://bugzilla.redhat.com/show_bug.cgi?id=1794868
073345
073345
Conflicts:
073345
	src/cpu/cpu_x86_data.h
073345
            - a few extra features were added upstream between 4.5.0 and
073345
              5.5.0
073345
            - downstream lacks #pragma once and thus all defines have to
073345
              be indented
073345
073345
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
073345
Message-Id: <8e882b79ff88eccdb68ede1c5afd4550fcd554b6.1581064395.git.jdenemar@redhat.com>
073345
Reviewed-by: Ján Tomko <jtomko@redhat.com>
073345
---
073345
 src/cpu/cpu_x86_data.h  | 24 ++++++++++++------------
073345
 src/qemu/qemu_process.c |  2 +-
073345
 2 files changed, 13 insertions(+), 13 deletions(-)
073345
073345
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
073345
index 454345b688..77797f633c 100644
073345
--- a/src/cpu/cpu_x86_data.h
073345
+++ b/src/cpu/cpu_x86_data.h
073345
@@ -62,19 +62,19 @@ struct _virCPUx86MSR {
073345
 /*
073345
  * The following HyperV feature names suffixes must exactly match corresponding
073345
  * ones defined for virDomainHyperv in domain_conf.c.
073345
- * E.g "__kvm_runtime" -> "runtime", "__kvm_hv_spinlocks" -> "spinlocks" etc.
073345
+ * E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc.
073345
 */
073345
-# define VIR_CPU_x86_KVM_HV_RUNTIME   "__kvm_hv_runtime"
073345
-# define VIR_CPU_x86_KVM_HV_SYNIC     "__kvm_hv_synic"
073345
-# define VIR_CPU_x86_KVM_HV_STIMER    "__kvm_hv_stimer"
073345
-# define VIR_CPU_x86_KVM_HV_RELAXED   "__kvm_hv_relaxed"
073345
-# define VIR_CPU_x86_KVM_HV_SPINLOCKS  "__kvm_hv_spinlocks"
073345
-# define VIR_CPU_x86_KVM_HV_VAPIC     "__kvm_hv_vapic"
073345
-# define VIR_CPU_x86_KVM_HV_VPINDEX   "__kvm_hv_vpindex"
073345
-# define VIR_CPU_x86_KVM_HV_RESET     "__kvm_hv_reset"
073345
-# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
073345
-# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
073345
-# define VIR_CPU_x86_KVM_HV_TLBFLUSH  "__kvm_hv_tlbflush"
073345
+# define VIR_CPU_x86_KVM_HV_RUNTIME   "hv-runtime"
073345
+# define VIR_CPU_x86_KVM_HV_SYNIC     "hv-synic"
073345
+# define VIR_CPU_x86_KVM_HV_STIMER    "hv-stimer"
073345
+# define VIR_CPU_x86_KVM_HV_RELAXED   "hv-relaxed"
073345
+# define VIR_CPU_x86_KVM_HV_SPINLOCKS "hv-spinlocks"
073345
+# define VIR_CPU_x86_KVM_HV_VAPIC     "hv-vapic"
073345
+# define VIR_CPU_x86_KVM_HV_VPINDEX   "hv-vpindex"
073345
+# define VIR_CPU_x86_KVM_HV_RESET     "hv-reset"
073345
+# define VIR_CPU_x86_KVM_HV_FREQUENCIES "hv-frequencies"
073345
+# define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "hv-reenlightenment"
073345
+# define VIR_CPU_x86_KVM_HV_TLBFLUSH  "hv-tlbflush"
073345
 
073345
 
073345
 # define VIR_CPU_X86_DATA_INIT { 0 }
073345
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
073345
index 0700b054f3..312ce69ba5 100644
073345
--- a/src/qemu/qemu_process.c
073345
+++ b/src/qemu/qemu_process.c
073345
@@ -3923,7 +3923,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
073345
         if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON)
073345
             continue;
073345
 
073345
-        if (virAsprintf(&cpuFeature, "__kvm_hv_%s",
073345
+        if (virAsprintf(&cpuFeature, "hv-%s",
073345
                         virDomainHypervTypeToString(i)) < 0)
073345
             return -1;
073345
 
073345
-- 
073345
2.25.0
073345