Patchwork [RFC,qom-cpu,15/15] target-xtensa: Introduce QOM realizefn for XtensaCPU

login
register
mail settings
Submitter Andreas Färber
Date Jan. 16, 2013, 5:33 a.m.
Message ID <1358314380-9400-16-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/212406/
State New
Headers show

Comments

Andreas Färber - Jan. 16, 2013, 5:33 a.m.
Introduce realizefn and set realized = true in cpu_xtensa_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-xtensa/cpu.c    |   10 ++++++++++
 target-xtensa/helper.c |    4 +++-
 2 Dateien geändert, 13 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Patch

diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c
index 035b07c..de363ae 100644
--- a/target-xtensa/cpu.c
+++ b/target-xtensa/cpu.c
@@ -56,6 +56,13 @@  static void xtensa_cpu_reset(CPUState *s)
     reset_mmu(env);
 }
 
+static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+    XtensaCPU *cpu = XTENSA_CPU(dev);
+
+    qemu_init_vcpu(&cpu->env);
+}
+
 static void xtensa_cpu_initfn(Object *obj)
 {
     XtensaCPU *cpu = XTENSA_CPU(obj);
@@ -66,9 +73,12 @@  static void xtensa_cpu_initfn(Object *obj)
 
 static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
 {
+    DeviceClass *dc = DEVICE_CLASS(oc);
     CPUClass *cc = CPU_CLASS(oc);
     XtensaCPUClass *xcc = XTENSA_CPU_CLASS(cc);
 
+    dc->realize = xtensa_cpu_realizefn;
+
     xcc->parent_reset = cc->reset;
     cc->reset = xtensa_cpu_reset;
 }
diff --git a/target-xtensa/helper.c b/target-xtensa/helper.c
index 94c03a1..14bcc7e 100644
--- a/target-xtensa/helper.c
+++ b/target-xtensa/helper.c
@@ -104,7 +104,9 @@  XtensaCPU *cpu_xtensa_init(const char *cpu_model)
     }
 
     xtensa_irq_init(env);
-    qemu_init_vcpu(env);
+
+    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
+
     return cpu;
 }