On Wed, 16 Jan 2013 06:32:48 +0100 Andreas Färber <afaer...@suse.de> wrote:
> Adapt the signature of x86_cpu_realize(), hook up to > DeviceClass::realize and set realized = true in cpu_x86_init(). > > Signed-off-by: Andreas Färber <afaer...@suse.de> > Cc: Eduardo Habkost <ehabk...@redhat.com> > Cc: Igor Mammedov <imamm...@redhat.com> Reviewed-By: Igor Mammedov <imamm...@redhat.com> > --- > target-i386/cpu-qom.h | 3 --- > target-i386/cpu.c | 7 +++++-- > target-i386/helper.c | 2 +- > 3 Dateien geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) > > diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h > index 332916a..3478dc9 100644 > --- a/target-i386/cpu-qom.h > +++ b/target-i386/cpu-qom.h > @@ -72,8 +72,5 @@ static inline X86CPU *x86_env_get_cpu(CPUX86State *env) > > #define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e)) > > -/* TODO Drop once ObjectClass::realize is available */ > -void x86_cpu_realize(Object *obj, Error **errp); > - > > #endif > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 333745b..640dcdb 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2140,9 +2140,9 @@ static void x86_cpu_apic_init(X86CPU *cpu, Error > **errp) } > #endif > > -void x86_cpu_realize(Object *obj, Error **errp) > +static void x86_cpu_realizefn(DeviceState *dev, Error **errp) > { > - X86CPU *cpu = X86_CPU(obj); > + X86CPU *cpu = X86_CPU(dev); > CPUX86State *env = &cpu->env; > > if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) { > @@ -2247,6 +2247,9 @@ static void x86_cpu_common_class_init(ObjectClass > *oc, void *data) { > X86CPUClass *xcc = X86_CPU_CLASS(oc); > CPUClass *cc = CPU_CLASS(oc); > + DeviceClass *dc = DEVICE_CLASS(oc); > + > + dc->realize = x86_cpu_realizefn; > > xcc->parent_reset = cc->reset; > cc->reset = x86_cpu_reset; > diff --git a/target-i386/helper.c b/target-i386/helper.c > index 547c25e..bf43d6a 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -1280,7 +1280,7 @@ X86CPU *cpu_x86_init(const char *cpu_model) > return NULL; > } > > - x86_cpu_realize(OBJECT(cpu), &error); > + object_property_set_bool(OBJECT(cpu), true, "realized", &error); > if (error) { > error_free(error); > object_delete(OBJECT(cpu));