qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH qom-next 04/59] pc: Add CPU as /machine/cpu[n]


From: Andreas Färber
Subject: [Qemu-devel] [PATCH qom-next 04/59] pc: Add CPU as /machine/cpu[n]
Date: Wed, 23 May 2012 05:07:27 +0200

Using the cpu_index, give the X86CPU a canonical path.
This must be done before initializing the APIC.

Signed-off-by: Igor Mammedov <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
 hw/pc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 4167782..e9d7e05 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -945,6 +945,8 @@ static X86CPU *pc_new_cpu(const char *cpu_model)
 {
     X86CPU *cpu;
     CPUX86State *env;
+    char *name;
+    Error *error = NULL;
 
     cpu = cpu_x86_init(cpu_model);
     if (cpu == NULL) {
@@ -952,6 +954,16 @@ static X86CPU *pc_new_cpu(const char *cpu_model)
         exit(1);
     }
     env = &cpu->env;
+
+    name = g_strdup_printf("cpu[%d]", env->cpu_index);
+    object_property_add_child(OBJECT(qdev_get_machine()), name,
+                              OBJECT(cpu), &error);
+    g_free(name);
+    if (error_is_set(&error)) {
+        qerror_report_err(error);
+        exit(1);
+    }
+
     if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
         env->apic_state = apic_init(env, env->cpuid_apic_id);
     }
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]