Message ID | 1475696333-8706-6-git-send-email-lvivier@redhat.com |
---|---|
State | New |
Headers | show |
On Wed, Oct 05, 2016 at 09:38:39PM +0200, Laurent Vivier wrote: > I've removed the cannot_destroy_with_object_finalize_yet field as > cpu_exec_init() is not called by arm_cpu_initfn() anymore I think this (and most of the similar commit messages following) needs a slight reword. A function called 'cpu_exec_init()' is still called from the initfn, it's just the unsafe things it used to do have been moved to cpu_exec_realize(). > (tested with QOM command provided by commit 4c315c27 with > "arm1026-arm-cpu") > > CC: Peter Maydell <peter.maydell@linaro.org> > CC: qemu-arm@nongnu.org > Signed-off-by: Laurent Vivier <lvivier@redhat.com> > --- > target-arm/cpu.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) > > diff --git a/target-arm/cpu.c b/target-arm/cpu.c > index 5fda716..7920fb0 100644 > --- a/target-arm/cpu.c > +++ b/target-arm/cpu.c > @@ -445,7 +445,6 @@ static void arm_cpu_initfn(Object *obj) > > cs->env_ptr = &cpu->env; > cpu_exec_init(cs, &error_abort); > - cpu_exec_realize(cs, &error_abort); > cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal, > g_free, g_free); > > @@ -577,6 +576,13 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) > ARMCPU *cpu = ARM_CPU(dev); > ARMCPUClass *acc = ARM_CPU_GET_CLASS(dev); > CPUARMState *env = &cpu->env; > + Error *local_err = NULL; > + > + cpu_exec_realize(cs, &local_err); > + if (local_err != NULL) { > + error_propagate(errp, local_err); > + return; > + } > > /* Some features automatically imply others: */ > if (arm_feature(env, ARM_FEATURE_V8)) { > @@ -1534,17 +1540,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) > cc->debug_check_watchpoint = arm_debug_check_watchpoint; > > cc->disas_set_info = arm_disas_set_info; > - > - /* > - * Reason: arm_cpu_initfn() calls cpu_exec_init(), which saves > - * the object in cpus -> dangling pointer after final > - * object_unref(). > - * > - * Once this is fixed, the devices that create ARM CPUs should be > - * updated not to set cannot_destroy_with_object_finalize_yet, > - * unless they still screw up something else. > - */ > - dc->cannot_destroy_with_object_finalize_yet = true; > } > > static void cpu_register(const ARMCPUInfo *info)
diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 5fda716..7920fb0 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -445,7 +445,6 @@ static void arm_cpu_initfn(Object *obj) cs->env_ptr = &cpu->env; cpu_exec_init(cs, &error_abort); - cpu_exec_realize(cs, &error_abort); cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); @@ -577,6 +576,13 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) ARMCPU *cpu = ARM_CPU(dev); ARMCPUClass *acc = ARM_CPU_GET_CLASS(dev); CPUARMState *env = &cpu->env; + Error *local_err = NULL; + + cpu_exec_realize(cs, &local_err); + if (local_err != NULL) { + error_propagate(errp, local_err); + return; + } /* Some features automatically imply others: */ if (arm_feature(env, ARM_FEATURE_V8)) { @@ -1534,17 +1540,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->debug_check_watchpoint = arm_debug_check_watchpoint; cc->disas_set_info = arm_disas_set_info; - - /* - * Reason: arm_cpu_initfn() calls cpu_exec_init(), which saves - * the object in cpus -> dangling pointer after final - * object_unref(). - * - * Once this is fixed, the devices that create ARM CPUs should be - * updated not to set cannot_destroy_with_object_finalize_yet, - * unless they still screw up something else. - */ - dc->cannot_destroy_with_object_finalize_yet = true; } static void cpu_register(const ARMCPUInfo *info)
I've removed the cannot_destroy_with_object_finalize_yet field as cpu_exec_init() is not called by arm_cpu_initfn() anymore (tested with QOM command provided by commit 4c315c27 with "arm1026-arm-cpu") CC: Peter Maydell <peter.maydell@linaro.org> CC: qemu-arm@nongnu.org Signed-off-by: Laurent Vivier <lvivier@redhat.com> --- target-arm/cpu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)