Received: from eggs.gnu.org ([208.118.235.92]:36730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShU2s-00060X-75 for qemu-devel@nongnu.org; Wed, 20 Jun 2012 19:10:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShU2q-0001Zd-4H for qemu-devel@nongnu.org; Wed, 20 Jun 2012 19:10:41 -0400 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Alexander Graf In-Reply-To: <4FE257B2.4040709@freescale.com> Date: Thu, 21 Jun 2012 01:10:33 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <7377A535-D293-4117-ADC9-275EE23CCAF7@suse.de> References: <1340223111-13449-1-git-send-email-agraf@suse.de> <1340223111-13449-9-git-send-email-agraf@suse.de> <4FE24E18.5050106@freescale.com> <4B0DDA93-C8A1-4517-9900-C984998A3591@suse.de> <4FE257B2.4040709@freescale.com> Subject: Re: [Qemu-devel] [PATCH 8/8] PPC: Add e5500 CPU target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Scott Wood Cc: Caraman Mihai Claudiu-B02008 , qemu-ppc Mailing List , qemu-devel qemu-devel On 21.06.2012, at 01:07, Scott Wood wrote: > On 06/20/2012 05:59 PM, Alexander Graf wrote: >>=20 >> On 21.06.2012, at 00:26, Scott Wood wrote: >>=20 >>> On 06/20/2012 03:11 PM, Alexander Graf wrote: >>>> + /* XXX better abstract into Emb.xxx features */ >>>> + if (version =3D=3D fsl_e5500) { >>>> + spr_register(env, SPR_BOOKE_EPCR, "EPCR", >>>> + SPR_NOACCESS, SPR_NOACCESS, >>>> + &spr_read_generic, &spr_write_generic, >>>> + 0x00000000); >>>> + spr_register(env, SPR_BOOKE_MAS7_MAS3, "MAS7_MAS3", >>>> + SPR_NOACCESS, SPR_NOACCESS, >>>> + &spr_read_mas73, &spr_write_mas73, >>>> + 0x00000000); >>>> + env->reset_msr =3D (1ULL < MSR_CM); >>>=20 >>> That's a funny way of writing "env->reset_msr =3D 0". :-) >>>=20 >>> Assuming you really meant "env->reset_msr =3D 1ULL << MSR_CM", why? = We >>> enter the kernel in 32-bit mode. It resets in 32-bit mode as well, = if >>> we ever implement that for e5500 QEMU. >>=20 >> Hrm. At least my self-compiled kernel did issue an "ld" instruction = before going into MSR_CM mode, hence I figured we need it. >=20 > You don't need MSR_CM to run 64-bit instructions. It just affects > masking in certain places. Wait - you don't? Is there a comprehensive description on what MSR_CM = really does and does not? >=20 >>>> + } >>>>=20 >>>> #if !defined(CONFIG_USER_ONLY) >>>> env->nb_tlb =3D 0; >>>> @@ -4576,6 +4655,14 @@ static void init_proc_e500 (CPUPPCState = *env, int version) >>>> #endif >>>>=20 >>>> init_excp_e200(env); >>>> + >>>> +#if !defined(CONFIG_USER_ONLY) >>>> + /* We support 64bit wide IVPR on 64bit platforms */ >>>> + if (version =3D=3D fsl_e5500) { >>>> + env->ivpr_mask =3D (target_ulong)~0xFFFFULL; >>>> + } >>>> +#endif >>>=20 >>> So, I'm guessing you don't do this unconditionally because QEMU will >>> generate 64-bit code if compiled that way, regardless of the actual >>> target -- and you don't want stray garbage in the upper 32 bits = being >>> written into IVPR. But why isn't this an issue with all the other = SPRs? >>> Why don't we have a problem with junk being written into the upper = half >>> of MAS3, for example (there's MAS3_RPN_MASK, but it's not used)? >>=20 >> I was thinking of making it unconditional, but this way seemed >> cleaner to me, as it actually follows exactly what the spec says. Not >> sure what would happen if you have -1 in your 32-bit register value >> and you try to write that to IVPR otherwise. It'd probably break :). >=20 > It would only break because there doesn't seem to be any generic way = of > treating 32-bit SPRs as 32-bit. We should probably have a separate > spr_write_generic32(). For a register like IVPR we'd select 32 or > full-size at init time, based on the type of CPU we're modelling. For > something like MAS3 we'd always use the 32-bit version. Yup, that should work :) Alex