From patchwork Wed Feb 3 21:29:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 44427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7AD6FB7D39 for ; Thu, 4 Feb 2010 08:42:40 +1100 (EST) Received: from localhost ([127.0.0.1]:47922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ncmrf-0005Ej-No for incoming@patchwork.ozlabs.org; Wed, 03 Feb 2010 16:34:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcmnM-00045c-Jn for qemu-devel@nongnu.org; Wed, 03 Feb 2010 16:29:56 -0500 Received: from [199.232.76.173] (port=37646 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcmnL-000455-On for qemu-devel@nongnu.org; Wed, 03 Feb 2010 16:29:55 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcmnI-00032g-Oy for qemu-devel@nongnu.org; Wed, 03 Feb 2010 16:29:55 -0500 Received: from goliath.siemens.de ([192.35.17.28]:21871) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NcmnG-000320-Ew for qemu-devel@nongnu.org; Wed, 03 Feb 2010 16:29:51 -0500 Received: from mail2.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o13LTkXD013379; Wed, 3 Feb 2010 22:29:46 +0100 Received: from localhost.localdomain ([139.25.173.3]) by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o13LTjGt031176; Wed, 3 Feb 2010 22:29:46 +0100 From: Jan Kiszka To: Anthony Liguori Date: Wed, 3 Feb 2010 22:29:42 +0100 Message-Id: <02a899fb369da18934728821b07a27c0cca97f6f.1265232579.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Subject: [Qemu-devel] [PATCH 1/4] KVM: x86: Fix up misreported CPU features X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 5b093ce..f690b2e 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; }