Received: from eggs.gnu.org ([208.118.235.92]:46428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Togbg-0000lw-FG for qemu-devel@nongnu.org; Fri, 28 Dec 2012 15:32:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TogbX-00043t-DB for qemu-devel@nongnu.org; Fri, 28 Dec 2012 15:32:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TogbX-00043a-5u for qemu-devel@nongnu.org; Fri, 28 Dec 2012 15:32:31 -0500 From: Eduardo Habkost Date: Fri, 28 Dec 2012 18:34:02 -0200 Message-Id: <1356726846-10637-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1356726846-10637-1-git-send-email-ehabkost@redhat.com> References: <1356726846-10637-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 5/9] target-i386: Move kvm_features/hypervisor initialization to cpu_x86_find_by_name() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Move the initialization to the cpu_x86_find_by_name(), inside the block for predefined CPU models. That code is not necessary for -cpu "host", because: - kvm_features doesn't need to be set because kvm_cpu_fill_host() already sets all bits supported by the host. - the CPUID_EXT_HYPERVISOR flag doesn't need to be manually set because kvm_arch_get_supported_cpuid() already sets it. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index aa96535..b3bd2f5 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1244,6 +1244,15 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *name) host_cpuid(0, 0, NULL, &ebx, &ecx, &edx); x86cpu_vendor_words2str(x86_cpu_def->vendor, ebx, edx, ecx); } + + x86_cpu_def->kvm_features |= kvm_default_features; + add_flagname_to_bitmaps("hypervisor", &x86_cpu_def->features, + &x86_cpu_def->ext_features, + &x86_cpu_def->ext2_features, + &x86_cpu_def->ext3_features, + &x86_cpu_def->kvm_features, + &x86_cpu_def->svm_features, + &x86_cpu_def->cpuid_7_0_ebx_features); } return 0; @@ -1518,12 +1527,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, Error **errp) env = &cpu->env; env->cpu_model_str = cpu_model; - def->kvm_features |= kvm_default_features; - add_flagname_to_bitmaps("hypervisor", &def->features, - &def->ext_features, &def->ext2_features, - &def->ext3_features, &def->kvm_features, - &def->svm_features, &def->cpuid_7_0_ebx_features); - cpudef_2_x86_cpu(cpu, def, &error); if (cpu_x86_parse_featurestr(cpu, features, &props) < 0) { -- 1.7.11.7