]> git.proxmox.com Git - qemu.git/commitdiff
preserve the hypervisor bit while KVM trims the CPUID bits
authorAndre Przywara <andre.przywara@amd.com>
Wed, 24 Jun 2009 22:08:04 +0000 (00:08 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 29 Jun 2009 18:52:12 +0000 (13:52 -0500)
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 <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-i386/cpu.h
target-i386/kvm.c

index a50f0594b0444891bc95b2e631b6622bfd07ed25..4a8608e0ce909afd636ca205bda230f70f498e65 100644 (file)
 #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)
index 70a9b45588706f06699340322f7c7c0f8e321aeb..4a3f598e4faddff0847a3d943cc5bc8945e27762 100644 (file)
@@ -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,