From aab4f055c481d3b0c4ee06154eeb5d9d25e71977 Mon Sep 17 00:00:00 2001 From: Maciek Molerus Date: Wed, 31 Aug 2011 16:39:55 +0200 Subject: Restricting processor features in KVM mode Some processors don't have full features set as in 'qemu32', eg. AMD doesn't have SSSE3 extensions yet. Added code which restricts CPU features set in KVM mode to those it actually has. Change-Id: I37c2d44a03e4445a607b723b0f63c91989c251dc --- target-i386/helper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'target-i386') diff --git a/target-i386/helper.c b/target-i386/helper.c index 550b348..6d0f18c 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1590,8 +1590,15 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, break; case 1: *eax = env->cpuid_version; + if (kvm_enabled() && !env->cpuid_vendor_override) { + /* take only subset of ext features which processor can handle */ + uint32_t unused; + host_cpuid(1, 0, NULL, &unused, ecx, &unused); + } else { + *ecx = UINT32_MAX; + } *ebx = (env->cpuid_apic_id << 24) | 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */ - *ecx = env->cpuid_ext_features; + *ecx &= env->cpuid_ext_features; *edx = env->cpuid_features; /* "Hypervisor present" bit required for Microsoft SVVP */ -- cgit v1.1