]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix hyperv features with QEMU 4.1
authorJiri Denemark <jdenemar@redhat.com>
Thu, 25 Jul 2019 11:50:57 +0000 (13:50 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 29 Jul 2019 13:41:50 +0000 (15:41 +0200)
Originally the names of the hyperv CPU features were only used
internally for looking up their CPUID bits. So we used "__kvm_hv_"
prefix for them to make sure the names do not collide with normal CPU
features stored in our CPU map.

But with QEMU 4.1 we check which features were enabled or disabled by a
freshly started QEMU process using their names rather than their CPUID
bits (mostly because of MSR features). Thus we need to change our made
up internal names into the actual names used by QEMU. Most of the names
are only used with QEMU 4.1 and newer and the reset was introduced with
QEMU recently enough to already support spelling with "-". Thus we don't
need to define them as "hv_*" with a translation to "hv-*" for new QEMU.

Without this patch libvirt would mistakenly report all hyperv features
as unavailable and refuse to start any domain using them with QEMU 4.1.

Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/cpu/cpu_x86_data.h
src/qemu/qemu_process.c

index f3f4d7ab9c7bc0bab29c43166150c5e3f9b04f27..bb781707aad71f1fc7873be3f670f9d3f3378643 100644 (file)
@@ -56,21 +56,21 @@ struct _virCPUx86MSR {
 /*
  * The following HyperV feature names suffixes must exactly match corresponding
  * ones defined for virDomainHyperv in domain_conf.c.
- * E.g "__kvm_runtime" -> "runtime", "__kvm_hv_spinlocks" -> "spinlocks" etc.
+ * E.g "hv-runtime" -> "runtime", "hv-spinlocks" -> "spinlocks" etc.
 */
-#define VIR_CPU_x86_KVM_HV_RUNTIME   "__kvm_hv_runtime"
-#define VIR_CPU_x86_KVM_HV_SYNIC     "__kvm_hv_synic"
-#define VIR_CPU_x86_KVM_HV_STIMER    "__kvm_hv_stimer"
-#define VIR_CPU_x86_KVM_HV_RELAXED   "__kvm_hv_relaxed"
-#define VIR_CPU_x86_KVM_HV_SPINLOCKS  "__kvm_hv_spinlocks"
-#define VIR_CPU_x86_KVM_HV_VAPIC     "__kvm_hv_vapic"
-#define VIR_CPU_x86_KVM_HV_VPINDEX   "__kvm_hv_vpindex"
-#define VIR_CPU_x86_KVM_HV_RESET     "__kvm_hv_reset"
-#define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
-#define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "__kvm_hv_reenlightenment"
-#define VIR_CPU_x86_KVM_HV_TLBFLUSH  "__kvm_hv_tlbflush"
-#define VIR_CPU_x86_KVM_HV_IPI       "__kvm_hv_ipi"
-#define VIR_CPU_x86_KVM_HV_EVMCS     "__kvm_hv_evmcs"
+#define VIR_CPU_x86_KVM_HV_RUNTIME   "hv-runtime"
+#define VIR_CPU_x86_KVM_HV_SYNIC     "hv-synic"
+#define VIR_CPU_x86_KVM_HV_STIMER    "hv-stimer"
+#define VIR_CPU_x86_KVM_HV_RELAXED   "hv-relaxed"
+#define VIR_CPU_x86_KVM_HV_SPINLOCKS "hv-spinlocks"
+#define VIR_CPU_x86_KVM_HV_VAPIC     "hv-vapic"
+#define VIR_CPU_x86_KVM_HV_VPINDEX   "hv-vpindex"
+#define VIR_CPU_x86_KVM_HV_RESET     "hv-reset"
+#define VIR_CPU_x86_KVM_HV_FREQUENCIES "hv-frequencies"
+#define VIR_CPU_x86_KVM_HV_REENLIGHTENMENT "hv-reenlightenment"
+#define VIR_CPU_x86_KVM_HV_TLBFLUSH  "hv-tlbflush"
+#define VIR_CPU_x86_KVM_HV_IPI       "hv-ipi"
+#define VIR_CPU_x86_KVM_HV_EVMCS     "hv-evmcs"
 
 
 #define VIR_CPU_X86_DATA_INIT { 0 }
index bbd3d9596a2ff5d5d5bf0963eefc5c2f70d1d753..0ee97e2296af09300811792055738154cc9a39df 100644 (file)
@@ -4104,7 +4104,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
         if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON)
             continue;
 
-        if (virAsprintf(&cpuFeature, "__kvm_hv_%s",
+        if (virAsprintf(&cpuFeature, "hv-%s",
                         virDomainHypervTypeToString(i)) < 0)
             return -1;