From patchwork Wed Jun 29 20:51:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 9206197 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C50636075A for ; Wed, 29 Jun 2016 20:52:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4CD72842C for ; Wed, 29 Jun 2016 20:52:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8C3028615; Wed, 29 Jun 2016 20:52:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C3CF2842C for ; Wed, 29 Jun 2016 20:52:24 +0000 (UTC) Received: from localhost ([::1]:45724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIMT9-0000Wm-CA for patchwork-qemu-devel@patchwork.kernel.org; Wed, 29 Jun 2016 16:52:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIMSV-0000UB-PH for qemu-devel@nongnu.org; Wed, 29 Jun 2016 16:51:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIMSQ-0002Hn-28 for qemu-devel@nongnu.org; Wed, 29 Jun 2016 16:51:43 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59273 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIMSP-0002Hg-RF for qemu-devel@nongnu.org; Wed, 29 Jun 2016 16:51:37 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5TKhRwt006986 for ; Wed, 29 Jun 2016 16:51:37 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 23uvaev6h7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 29 Jun 2016 16:51:37 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Jun 2016 14:51:36 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Jun 2016 14:51:34 -0600 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: groug@kaod.org Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 5E4273E40047; Wed, 29 Jun 2016 14:51:33 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5TKpX3b65863894; Wed, 29 Jun 2016 13:51:33 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 325CA78019; Wed, 29 Jun 2016 14:51:33 -0600 (MDT) Received: from bahia.lan (unknown [9.164.167.94]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id 136F078015; Wed, 29 Jun 2016 14:51:26 -0600 (MDT) From: Greg Kurz To: David Gibson Date: Wed, 29 Jun 2016 22:51:23 +0200 In-Reply-To: <146723340662.9665.6413150884317978000.stgit@bahia.lan> References: <146723340662.9665.6413150884317978000.stgit@bahia.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062920-0028-0000-0000-0000051137A9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062920-0029-0000-0000-00002D1C3781 Message-Id: <146723348371.9665.14803084330813305319.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-29_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606290192 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 6/8] ppc: move cpu index setup to instance_init/finalize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , bharata@linux.vnet.ibm.com, Scott Wood , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch moves cpu_index initialization to instance init: it will allow machine code to compute cpu_dt_id between cpu initialization and cpu realization. It also adds the related exit code to be called at instance finalize, for symmetry. This doesn't change behaviour when the cpu is setup with cpu_ppc_init(), which handles initialization and realization sequentially. This is currently the case for all configurations in both user and system mode. Signed-off-by: Greg Kurz --- target-ppc/translate_init.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index d7860fd7f8ee..f7571f34d6ac 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9540,9 +9540,9 @@ static void ppc_cpu_realizefn(DeviceState *dev, Error **errp) return; } #endif - cpu_exec_init(cs, &local_err); + cpu_exec_realize(cs, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } @@ -9772,9 +9772,9 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp) CPUPPCState *env = &cpu->env; opc_handler_t **table; int i, j; - cpu_exec_exit(CPU(dev)); + cpu_exec_unrealize(CPU(dev)); for (i = 0; i < PPC_CPU_OPCODES_LEN; i++) { if (env->opcodes[i] == &invalid_handler) { continue; @@ -10336,8 +10336,15 @@ static void ppc_cpu_initfn(Object *obj) if (tcg_enabled()) { ppc_translate_init(); } + + cpu_exec_init_cpu_index(cs, &error_abort); +} + +static void ppc_cpu_finalizefn(Object *obj) +{ + cpu_exec_exit_cpu_index(CPU(obj)); } static bool ppc_pvr_match_default(PowerPCCPUClass *pcc, uint32_t pvr) { @@ -10413,8 +10420,9 @@ static const TypeInfo ppc_cpu_type_info = { .name = TYPE_POWERPC_CPU, .parent = TYPE_CPU, .instance_size = sizeof(PowerPCCPU), .instance_init = ppc_cpu_initfn, + .instance_finalize = ppc_cpu_finalizefn, .abstract = true, .class_size = sizeof(PowerPCCPUClass), .class_init = ppc_cpu_class_init, };