From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5dYt-0001vM-0X for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5dYr-00078T-Oa for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:10 -0400 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:33162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5dYr-00077a-Bm for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:09 -0400 Received: by padev16 with SMTP id ev16so65739710pad.0 for ; Thu, 18 Jun 2015 10:25:08 -0700 (PDT) From: Peter Crosthwaite Date: Thu, 18 Jun 2015 10:24:50 -0700 Message-Id: <1434648295-30584-4-git-send-email-crosthwaite.peter@gmail.com> In-Reply-To: <1434648295-30584-1-git-send-email-crosthwaite.peter@gmail.com> References: <1434648295-30584-1-git-send-email-crosthwaite.peter@gmail.com> Subject: [Qemu-devel] [PATCH v3 3/8] ppc: Move cpu_exec_init() call to realize function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: ehabkost@redhat.com, Peter Crosthwaite , Bharata B Rao , afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net From: Bharata B Rao Move cpu_exec_init() call from instance_init to realize. This allows any failures from cpu_exec_init() to be handled appropriately. Also add corresponding cpu_exec_exit() call from unrealize. cpu_dt_id assignment from instance_init is no longer needed since correct assignment for cpu_dt_id is already present in realizefn. Signed-off-by: Bharata B Rao Reviewed-by: David Gibson Reviewed-by: Peter Crosthwaite Acked-by: Paolo Bonzini Signed-off-by: Peter Crosthwaite --- target-ppc/translate_init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 52d95ce..2b72f2d 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8928,6 +8928,11 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp) return; } + cpu_exec_init(&cpu->env, &local_err); + if (local_err != NULL) { + error_propagate(errp, local_err); + return; + } cpu->cpu_dt_id = (cs->cpu_index / smp_threads) * max_smt + (cs->cpu_index % smp_threads); #endif @@ -9141,6 +9146,8 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp) opc_handler_t **table; int i, j; + cpu_exec_exit(CPU(dev)); + for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) { if (env->opcodes[i] == &invalid_handler) { continue; @@ -9633,8 +9640,6 @@ static void ppc_cpu_initfn(Object *obj) CPUPPCState *env = &cpu->env; cs->env_ptr = env; - cpu_exec_init(env, &error_abort); - cpu->cpu_dt_id = cs->cpu_index; env->msr_mask = pcc->msr_mask; env->mmu_model = pcc->mmu_model; -- 1.9.1