Blob Blame History Raw
From b77f7c1c1424a758295105b92c5f95ff82d54904 Mon Sep 17 00:00:00 2001
Message-Id: <b77f7c1c1424a758295105b92c5f95ff82d54904@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 7 Feb 2020 10:41:45 +0100
Subject: [PATCH] qemu: Fix KVM features with QEMU 4.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Originally the names of the KVM CPU features were only used internally
for looking up their CPUID bits. So we used "__kvm_" 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.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 4c62ed606895018aaf9f9f1d2137fcea3918756a)

https://bugzilla.redhat.com/show_bug.cgi?id=1794868

Conflicts:
	src/cpu/cpu_x86_data.h
            - all defines are indented as downstream lacks #pragma once

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <c565def49ee0f02b19d58717383661a277b770f0.1581064395.git.jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/cpu/cpu_x86_data.h  | 2 +-
 src/qemu/qemu_command.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
index 8a189f854e..0087fd2f85 100644
--- a/src/cpu/cpu_x86_data.h
+++ b/src/cpu/cpu_x86_data.h
@@ -49,7 +49,7 @@ struct _virCPUx86MSR {
 # define CPUX86_KVM      0x40000000
 # define CPUX86_EXTENDED 0x80000000
 
-# define VIR_CPU_x86_KVM_PV_UNHALT    "__kvm_pv_unhalt"
+# define VIR_CPU_x86_KVM_PV_UNHALT  "kvm_pv_unhalt"
 
 /*
  * The following HyperV feature names suffixes must exactly match corresponding
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 71e102747c..a411d214df 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7008,7 +7008,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
     }
 
     if (def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK]) {
-        qemuBuildCpuFeature(qemuCaps, &buf, "kvm_pv_unhalt",
+        qemuBuildCpuFeature(qemuCaps, &buf, VIR_CPU_x86_KVM_PV_UNHALT,
                             def->features[VIR_DOMAIN_FEATURE_PVSPINLOCK] == VIR_TRISTATE_SWITCH_ON);
     }
 
-- 
2.25.0