diff mbox

qemu-kvm: Reindent pc_new_cpu

Message ID 4AB3C344.9000809@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka Sept. 18, 2009, 5:28 p.m. UTC
...for better match with upstream.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

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

Comments

Marcelo Tosatti Sept. 18, 2009, 8:03 p.m. UTC | #1
Applied, thanks.

On Fri, Sep 18, 2009 at 07:28:36PM +0200, Jan Kiszka wrote:
> ...for better match with upstream.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> 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(-)
> 
> 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.
> --
> 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
--
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 mbox

Patch

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.