Patchwork [RFC,qom-cpu,11/15] target-s390x: Introduce QOM realizefn for S390CPU

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

Comments

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

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

Patch

diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 2ed2312..94d8d93 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -45,6 +45,13 @@  static void s390_cpu_reset(CPUState *s)
     s390_add_running_cpu(env);
 }
 
+static void s390_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+    S390CPU *cpu = S390_CPU(dev);
+
+    qemu_init_vcpu(&cpu->env);
+}
+
 static void s390_cpu_initfn(Object *obj)
 {
     S390CPU *cpu = S390_CPU(obj);
@@ -73,6 +80,9 @@  static void s390_cpu_class_init(ObjectClass *oc, void *data)
 {
     S390CPUClass *scc = S390_CPU_CLASS(oc);
     CPUClass *cc = CPU_CLASS(scc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    dc->realize = s390_cpu_realizefn;
 
     scc->parent_reset = cc->reset;
     cc->reset = s390_cpu_reset;
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 9a132e6..45020b2 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -85,7 +85,9 @@  S390CPU *cpu_s390x_init(const char *cpu_model)
     }
 
     env->cpu_model_str = cpu_model;
-    qemu_init_vcpu(env);
+
+    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
+
     return cpu;
 }