From patchwork Wed Feb 3 08:53:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 44355 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 52A19B7D17 for ; Wed, 3 Feb 2010 20:13:27 +1100 (EST) Received: from localhost ([127.0.0.1]:54679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcbIa-0006Yb-4M for incoming@patchwork.ozlabs.org; Wed, 03 Feb 2010 04:13:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ncazw-0001yM-5c for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:08 -0500 Received: from [199.232.76.173] (port=56383 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ncazv-0001xZ-72 for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:07 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ncazk-00077p-1G for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:54:06 -0500 Received: from david.siemens.de ([192.35.17.14]:21426) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ncazg-00076G-Gb for qemu-devel@nongnu.org; Wed, 03 Feb 2010 03:53:52 -0500 Received: from mail3.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rn3r031075; Wed, 3 Feb 2010 09:53:49 +0100 Received: from localhost.localdomain ([139.25.173.28]) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rkC5012112; Wed, 3 Feb 2010 09:53:49 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Wed, 3 Feb 2010 09:53:29 +0100 Message-Id: <622ce19224ff61c733c6a71a787c9e8848343b1b.1265187223.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: Anthony Liguori , Glauber Costa , Alexander Graf , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v2 04/21] 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 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; }