From patchwork Wed Mar 3 19:15:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 83453 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 o23JHRwv009190 for ; Wed, 3 Mar 2010 19:17:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756275Ab0CCTQY (ORCPT ); Wed, 3 Mar 2010 14:16:24 -0500 Received: from va3ehsobe005.messaging.microsoft.com ([216.32.180.15]:22472 "EHLO VA3EHSOBE005.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756263Ab0CCTQS (ORCPT ); Wed, 3 Mar 2010 14:16:18 -0500 Received: from mail77-va3-R.bigfish.com (10.7.14.249) by VA3EHSOBE005.bigfish.com (10.7.40.25) with Microsoft SMTP Server id 8.1.340.0; Wed, 3 Mar 2010 19:16:17 +0000 Received: from mail77-va3 (localhost [127.0.0.1]) by mail77-va3-R.bigfish.com (Postfix) with ESMTP id BCED53302DF; Wed, 3 Mar 2010 19:16:17 +0000 (UTC) X-SpamScore: -4 X-BigFish: VPS-4(zz936eMab9bhzz1202hzzz32i6bh2a8h87h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail77-va3 (localhost.localdomain [127.0.0.1]) by mail77-va3 (MessageSwitch) id 1267643774871616_25120; Wed, 3 Mar 2010 19:16:14 +0000 (UTC) Received: from VA3EHSMHS005.bigfish.com (unknown [10.7.14.253]) by mail77-va3.bigfish.com (Postfix) with ESMTP id 64EF6F01A8; Wed, 3 Mar 2010 19:15:57 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS005.bigfish.com (10.7.99.15) with Microsoft SMTP Server (TLS) id 14.0.482.39; Wed, 3 Mar 2010 19:15:54 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o23JJEuA004631; Wed, 3 Mar 2010 13:19:17 -0600 X-WSS-ID: 0KYQ068-02-HBY-02 X-M-MSG: Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2227FC863F; Wed, 3 Mar 2010 13:15:44 -0600 (CST) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Mar 2010 13:15:49 -0600 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Mar 2010 13:15:48 -0600 Received: from lemmy.osrc.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Mar 2010 20:15:43 +0100 Received: by lemmy.osrc.amd.com (Postfix, from userid 41430) id DDED0C9AF6; Wed, 3 Mar 2010 20:15:43 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: Alexander Graf , kvm@vger.kernel.org, Joerg Roedel Subject: [PATCH 2/2] QEMU-KVM: Ask kernel about supported svm features Date: Wed, 3 Mar 2010 20:15:42 +0100 Message-ID: <1267643742-616-3-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267643742-616-1-git-send-email-joerg.roedel@amd.com> References: <1267643742-616-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 03 Mar 2010 19:15:43.0960 (UTC) FILETIME=[EBD95580:01CABB05] MIME-Version: 1.0 X-Reverse-DNS: ausb3extmailp02.amd.com 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 Mar 2010 19:17:29 +0000 (UTC) diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h index 6485981..aeb2c9b 100644 --- a/kvm/include/linux/kvm.h +++ b/kvm/include/linux/kvm.h @@ -500,6 +500,8 @@ struct kvm_ioeventfd { #define KVM_CAP_PCI_SEGMENT 47 +#define KVM_CAP_SVM_CPUID_FIXED 52 + #ifdef KVM_CAP_IRQ_ROUTING struct kvm_irq_routing_irqchip { diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 7a5925a..60e6d26 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -1291,8 +1291,19 @@ int kvm_arch_init_vcpu(CPUState *cenv) qemu_kvm_cpuid_on_env(©); limit = copy.regs[R_EAX]; - for (i = 0x80000000; i <= limit; ++i) - do_cpuid_ent(&cpuid_ent[cpuid_nent++], i, 0, ©); + for (i = 0x80000000; i <= limit; ++i) { + do_cpuid_ent(&cpuid_ent[cpuid_nent], i, 0, ©); + switch (i) { + case 0x8000000a: + if (!kvm_check_extension(kvm_state, KVM_CAP_SVM_CPUID_FIXED)) + break; + cpuid_ent[cpuid_nent].eax = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EAX); + cpuid_ent[cpuid_nent].ebx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EBX); + cpuid_ent[cpuid_nent].edx = kvm_arch_get_supported_cpuid(cenv, 0x8000000a, R_EDX); + break; + } + cpuid_nent += 1; + } kvm_setup_cpuid2(cenv, cpuid_nent, cpuid_ent); diff --git a/target-i386/cpu.h b/target-i386/cpu.h index b64bd02..adcc19f 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -421,6 +421,8 @@ #define CPUID_EXT3_IBS (1 << 10) #define CPUID_EXT3_SKINIT (1 << 12) +#define CPUID_SVM_NPT (1 << 0) + #define CPUID_VENDOR_INTEL_1 0x756e6547 /* "Genu" */ #define CPUID_VENDOR_INTEL_2 0x49656e69 /* "ineI" */ #define CPUID_VENDOR_INTEL_3 0x6c65746e /* "ntel" */ diff --git a/target-i386/helper.c b/target-i386/helper.c index 73d8389..109f656 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -2220,7 +2220,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *eax = 0x00000001; /* SVM Revision */ *ebx = 0x00000010; /* nr of ASIDs */ *ecx = 0; - *edx = 0; /* optional features */ + *edx = 0; break; default: /* reserved values: zero */