[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 6/6] preserve the hypervisor bit while KVM trims the
From: |
Andre Przywara |
Subject: |
[Qemu-devel] [PATCH 6/6] preserve the hypervisor bit while KVM trims the CPUID bits |
Date: |
Thu, 25 Jun 2009 00:08:04 +0200 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH 0/6] Add -cpu host CPU type, Andre Przywara, 2009/06/24
- [Qemu-devel] [PATCH 1/6] allow hypervisor CPUID bit to be overriden, Andre Przywara, 2009/06/24
- [Qemu-devel] [PATCH 5/6] remove CPUID host hacks, Andre Przywara, 2009/06/24
- [Qemu-devel] [PATCH 4/6] fix KVMs GET_SUPPORTED_CPUID feature usage, Andre Przywara, 2009/06/24
- [Qemu-devel] [PATCH 3/6] CPUID Fn8000_0001.EAX is family/model/stepping, not features, Andre Przywara, 2009/06/24
- [Qemu-devel] [PATCH 6/6] preserve the hypervisor bit while KVM trims the CPUID bits,
Andre Przywara <=
- [Qemu-devel] [PATCH 2/6] introduce -cpu host target, Andre Przywara, 2009/06/24