From nobody Wed Nov 5 08:32:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504278881654347.0222451027297; Fri, 1 Sep 2017 08:14:41 -0700 (PDT) Received: from localhost ([::1]:45050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnneZ-0001WB-FD for importer@patchew.org; Fri, 01 Sep 2017 11:14:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnnU3-0007y5-CH for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnnTy-0002xF-Jp for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40961) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnnTy-0002x2-CH for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:03:42 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BB767DD08; Fri, 1 Sep 2017 15:03:40 +0000 (UTC) Received: from localhost (ovpn-116-66.gru2.redhat.com [10.97.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED5979615B; Fri, 1 Sep 2017 15:03:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2BB767DD08 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: Peter Maydell Date: Fri, 1 Sep 2017 12:02:57 -0300 Message-Id: <20170901150317.10380-10-ehabkost@redhat.com> In-Reply-To: <20170901150317.10380-1-ehabkost@redhat.com> References: <20170901150317.10380-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 01 Sep 2017 15:03:41 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/29] sparc: move adhoc CPUSPARCState initialization to realize time 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: Igor Mammedov , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Igor Mammedov SPARCCPU::env was initialized from previously set properties (with help of sparc_cpu_parse_features) in cpu_sparc_register(). However there is not reason to keep it there as this task is typically done at realize time. So move post properties initialization into sparc_cpu_realizefn, which brings cpu_sparc_init() closer to cpu_generic_init(). Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <1503592308-93913-6-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost --- target/sparc/cpu.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 82ab5ad8d9..9dfc15007d 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -109,7 +109,6 @@ static void sparc_cpu_parse_features(CPUState *cs, char= *features, =20 static int cpu_sparc_register(SPARCCPU *cpu, const char *cpu_model) { - CPUSPARCState *env =3D &cpu->env; char *s =3D g_strdup(cpu_model); char *featurestr =3D strtok(s, ","); Error *err =3D NULL; @@ -122,19 +121,6 @@ static int cpu_sparc_register(SPARCCPU *cpu, const cha= r *cpu_model) return -1; } =20 - env->version =3D env->def.iu_version; - env->fsr =3D env->def.fpu_version; - env->nwindows =3D env->def.nwindows; -#if !defined(TARGET_SPARC64) - env->mmuregs[0] |=3D env->def.mmu_version; - cpu_sparc_set_id(env, 0); - env->mxccregs[7] |=3D env->def.mxcc_version; -#else - env->mmu_version =3D env->def.mmu_version; - env->maxtl =3D env->def.maxtl; - env->version |=3D env->def.maxtl << 8; - env->version |=3D env->def.nwindows - 1; -#endif return 0; } =20 @@ -816,15 +802,29 @@ static void sparc_cpu_realizefn(DeviceState *dev, Err= or **errp) CPUState *cs =3D CPU(dev); SPARCCPUClass *scc =3D SPARC_CPU_GET_CLASS(dev); Error *local_err =3D NULL; -#if defined(CONFIG_USER_ONLY) SPARCCPU *cpu =3D SPARC_CPU(dev); CPUSPARCState *env =3D &cpu->env; =20 +#if defined(CONFIG_USER_ONLY) if ((env->def.features & CPU_FEATURE_FLOAT)) { env->def.features |=3D CPU_FEATURE_FLOAT128; } #endif =20 + env->version =3D env->def.iu_version; + env->fsr =3D env->def.fpu_version; + env->nwindows =3D env->def.nwindows; +#if !defined(TARGET_SPARC64) + env->mmuregs[0] |=3D env->def.mmu_version; + cpu_sparc_set_id(env, 0); + env->mxccregs[7] |=3D env->def.mxcc_version; +#else + env->mmu_version =3D env->def.mmu_version; + env->maxtl =3D env->def.maxtl; + env->version |=3D env->def.maxtl << 8; + env->version |=3D env->def.nwindows - 1; +#endif + cpu_exec_realizefn(cs, &local_err); if (local_err !=3D NULL) { error_propagate(errp, local_err); --=20 2.13.5