Commit 6c0d7ee8951a330c0885b0ebcd4c9596661900a9
Committed by
Anthony Liguori
1 parent
671e4676
preserve the hypervisor bit while KVM trims the CPUID bits
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>
Showing
2 changed files
with
5 additions
and
0 deletions
target-i386/cpu.h
... | ... | @@ -362,6 +362,7 @@ |
362 | 362 | #define CPUID_EXT_POPCNT (1 << 23) |
363 | 363 | #define CPUID_EXT_XSAVE (1 << 26) |
364 | 364 | #define CPUID_EXT_OSXSAVE (1 << 27) |
365 | +#define CPUID_EXT_HYPERVISOR (1 << 31) | |
365 | 366 | |
366 | 367 | #define CPUID_EXT2_SYSCALL (1 << 11) |
367 | 368 | #define CPUID_EXT2_MP (1 << 19) | ... | ... |
target-i386/kvm.c
... | ... | @@ -143,8 +143,12 @@ int kvm_arch_init_vcpu(CPUState *env) |
143 | 143 | |
144 | 144 | kvm_trim_features(&env->cpuid_features, |
145 | 145 | kvm_arch_get_supported_cpuid(env, 1, R_EDX)); |
146 | + | |
147 | + i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR; | |
146 | 148 | kvm_trim_features(&env->cpuid_ext_features, |
147 | 149 | kvm_arch_get_supported_cpuid(env, 1, R_ECX)); |
150 | + env->cpuid_ext_features |= i; | |
151 | + | |
148 | 152 | kvm_trim_features(&env->cpuid_ext2_features, |
149 | 153 | kvm_arch_get_supported_cpuid(env, 0x80000001, R_EDX)); |
150 | 154 | kvm_trim_features(&env->cpuid_ext3_features, | ... | ... |