From patchwork Wed Feb 3 08:53:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2,04/21] KVM: x86: Fix up misreported CPU features Date: Tue, 02 Feb 2010 22:53:29 -0000 From: Jan Kiszka X-Patchwork-Id: 44355 Message-Id: <622ce19224ff61c733c6a71a787c9e8848343b1b.1265187223.git.jan.kiszka@siemens.com> To: Avi Kivity , Marcelo Tosatti Cc: Anthony Liguori , Glauber Costa , Alexander Graf , kvm@vger.kernel.org, qemu-devel@nongnu.org >From qemu-kvm: Kernels before 2.6.30 misreported some essential CPU features via KVM_GET_SUPPORTED_CPUID. Fix them up. Signed-off-by: Jan Kiszka --- target-i386/kvm.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 504f501..9fb96b5 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -101,12 +101,18 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg) break; case R_EDX: ret = cpuid->entries[i].edx; - if (function == 0x80000001) { + switch (function) { + case 1: + /* KVM before 2.6.30 misreports the following features */ + ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA; + break; + case 0x80000001: /* On Intel, kvm returns cpuid according to the Intel spec, * so add missing bits according to the AMD spec: */ cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, R_EDX); ret |= cpuid_1_edx & 0xdfeff7ff; + break; } break; }