From patchwork Wed Feb 3 23:55:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 76863 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o13NvVuR014450 for ; Wed, 3 Feb 2010 23:57:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757973Ab0BCX5a (ORCPT ); Wed, 3 Feb 2010 18:57:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50957 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757948Ab0BCX51 (ORCPT ); Wed, 3 Feb 2010 18:57:27 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o13NvNoo016599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Feb 2010 18:57:23 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o13NvKKB023094; Wed, 3 Feb 2010 18:57:21 -0500 Received: from amt.cnet (vpn-9-161.rdu.redhat.com [10.11.9.161]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o13NvJRr026854; Wed, 3 Feb 2010 18:57:19 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 77E2A68A8F0; Wed, 3 Feb 2010 21:56:26 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o13NuIAv013147; Wed, 3 Feb 2010 21:56:18 -0200 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Jan Kiszka Subject: [PATCH 3/6] KVM: x86: Fix up misreported CPU features Date: Wed, 3 Feb 2010 21:55:48 -0200 Message-Id: <19ccb8ea1799f6f29ba5bc37d5f18dc8050d4029.1265241351.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 23:57:32 +0000 (UTC) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index b457b96..0d08cd5 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -99,12 +99,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; }