From patchwork Fri Sep 18 17:28:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 48578 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8IHSxhx020841 for ; Fri, 18 Sep 2009 17:28:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757010AbZIRR2t (ORCPT ); Fri, 18 Sep 2009 13:28:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757121AbZIRR2t (ORCPT ); Fri, 18 Sep 2009 13:28:49 -0400 Received: from goliath.siemens.de ([192.35.17.28]:19835 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756986AbZIRR2s (ORCPT ); Fri, 18 Sep 2009 13:28:48 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id n8IHSb77018792; Fri, 18 Sep 2009 19:28:37 +0200 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail1.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id n8IHSbGr022366; Fri, 18 Sep 2009 19:28:37 +0200 Message-ID: <4AB3C344.9000809@siemens.com> Date: Fri, 18 Sep 2009 19:28:36 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Marcelo Tosatti CC: kvm-devel , Avi Kivity Subject: [PATCH] qemu-kvm: Reindent pc_new_cpu Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org ...for better match with upstream. Signed-off-by: Jan Kiszka --- PS: regs_modified = 1 is another sign that the initialization order in qemu-kvm needs a rework. hw/pc.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/hw/pc.c b/hw/pc.c index 5f892c7..d407c47 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1097,19 +1097,21 @@ int cpu_is_bsp(CPUState *env) CPUState *pc_new_cpu(const char *cpu_model) { - CPUState *env = cpu_init(cpu_model); - if (!env) { - fprintf(stderr, "Unable to find x86 CPU definition\n"); - exit(1); - } - env->kvm_cpu_state.regs_modified = 1; - if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { - env->cpuid_apic_id = env->cpu_index; - /* APIC reset callback resets cpu */ - apic_init(env); - } else { - qemu_register_reset((QEMUResetHandler*)cpu_reset, env); - } + CPUState *env; + + env = cpu_init(cpu_model); + if (!env) { + fprintf(stderr, "Unable to find x86 CPU definition\n"); + exit(1); + } + env->kvm_cpu_state.regs_modified = 1; + if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { + env->cpuid_apic_id = env->cpu_index; + /* APIC reset callback resets cpu */ + apic_init(env); + } else { + qemu_register_reset((QEMUResetHandler*)cpu_reset, env); + } /* kvm needs this to run after the apic is initialized. Otherwise, * it can access invalid state and crash.