Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJaad-0001DQ-43 for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJaaX-00017d-74 for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:09 -0400 Received: from [199.232.76.173] (port=34220 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJaaX-00017R-30 for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:05 -0400 Received: from sg2ehsobe004.messaging.microsoft.com ([207.46.51.78]:28389 helo=SG2EHSOBE004.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1MJaaW-0001zU-CZ for qemu-devel@nongnu.org; Wed, 24 Jun 2009 18:05:04 -0400 From: Andre Przywara Date: Thu, 25 Jun 2009 00:08:04 +0200 Message-ID: <1245881284-3656-7-git-send-email-andre.przywara@amd.com> In-Reply-To: <1245881284-3656-1-git-send-email-andre.przywara@amd.com> References: <1245881284-3656-1-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 6/6] preserve the hypervisor bit while KVM trims the CPUID bits List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: avi@redhat.com, aliguori@us.ibm.com Cc: Andre Przywara , qemu-devel@nongnu.org The KVM kernel will disable all bits in CPUID which are not present in the host. As this is mostly true for the hypervisor bit (1.ecx), preserve its value before the trim and restore it afterwards. Signed-off-by: Andre Przywara --- target-i386/cpu.h | 1 + target-i386/kvm.c | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index a50f059..4a8608e 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -362,6 +362,7 @@ #define CPUID_EXT_POPCNT (1 << 23) #define CPUID_EXT_XSAVE (1 << 26) #define CPUID_EXT_OSXSAVE (1 << 27) +#define CPUID_EXT_HYPERVISOR (1 << 31) #define CPUID_EXT2_SYSCALL (1 << 11) #define CPUID_EXT2_MP (1 << 19) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 70a9b45..4a3f598 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -143,8 +143,12 @@ int kvm_arch_init_vcpu(CPUState *env) kvm_trim_features(&env->cpuid_features, kvm_arch_get_supported_cpuid(env, 1, R_EDX)); + + i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR; kvm_trim_features(&env->cpuid_ext_features, kvm_arch_get_supported_cpuid(env, 1, R_ECX)); + env->cpuid_ext_features |= i; + kvm_trim_features(&env->cpuid_ext2_features, kvm_arch_get_supported_cpuid(env, 0x80000001, R_EDX)); kvm_trim_features(&env->cpuid_ext3_features, -- 1.6.1.3