From: Joerg Roedel Subject: [PATCH] qemu-kvm: Ask kernel about supported svm features Date: Thu, 22 Apr 2010 12:57:59 +0200 Message-ID: <1271933879-15849-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: kvm@vger.kernel.org, Joerg Roedel To: Avi Kivity , Anthony Liguori Return-path: Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12]:40119 "EHLO VA3EHSOBE002.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754172Ab0DVK6R (ORCPT ); Thu, 22 Apr 2010 06:58:17 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This patch adds code to ask the kernel about the svm features it supports for its guests and propagates them to the guest. The new capability is necessary because the old behavior of the kernel was to just return the host svm features but every svm-feature needs emulation in the nested svm kernel code. The new capability indicates that the kernel is aware of that when returning svm cpuid information. Signed-off-by: Joerg Roedel --- qemu-kvm-x86.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 748ff69..6eccd69 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -1327,8 +1327,18 @@ 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: + 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].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); -- 1.7.0.4