From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Caraman Mihai Claudiu-B02008 <B02008@freescale.com>,
qemu-ppc Mailing List <qemu-ppc@nongnu.org>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 8/8] PPC: Add e5500 CPU target
Date: Wed, 20 Jun 2012 18:07:30 -0500 [thread overview]
Message-ID: <4FE257B2.4040709@freescale.com> (raw)
In-Reply-To: <4B0DDA93-C8A1-4517-9900-C984998A3591@suse.de>
On 06/20/2012 05:59 PM, Alexander Graf wrote:
>
> On 21.06.2012, at 00:26, Scott Wood wrote:
>
>> On 06/20/2012 03:11 PM, Alexander Graf wrote:
>>> + /* XXX better abstract into Emb.xxx features */
>>> + if (version == 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 = (1ULL < MSR_CM);
>>
>> That's a funny way of writing "env->reset_msr = 0". :-)
>>
>> Assuming you really meant "env->reset_msr = 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.
>
> Hrm. At least my self-compiled kernel did issue an "ld" instruction before going into MSR_CM mode, hence I figured we need it.
You don't need MSR_CM to run 64-bit instructions. It just affects
masking in certain places.
>>> + }
>>>
>>> #if !defined(CONFIG_USER_ONLY)
>>> env->nb_tlb = 0;
>>> @@ -4576,6 +4655,14 @@ static void init_proc_e500 (CPUPPCState *env, int version)
>>> #endif
>>>
>>> init_excp_e200(env);
>>> +
>>> +#if !defined(CONFIG_USER_ONLY)
>>> + /* We support 64bit wide IVPR on 64bit platforms */
>>> + if (version == fsl_e5500) {
>>> + env->ivpr_mask = (target_ulong)~0xFFFFULL;
>>> + }
>>> +#endif
>>
>> 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)?
>
> 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 :).
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.
-Scott
next prev parent reply other threads:[~2012-06-20 23:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-20 20:11 [Qemu-devel] [PATCH 0/8] PPC: e5500 emulation Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 1/8] dt: make setprop argument static Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 2/8] PPC: e500: allow users to set the /compatible property via -machine Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 3/8] uImage: increase the gzip load size Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 4/8] PPC: Add some booke SPR defines Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 5/8] PPC: Add support for MSR_CM Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 6/8] PPC: BookE: Implement EPR SPR Alexander Graf
2012-06-20 20:11 ` [Qemu-devel] [PATCH 7/8] PPC: Turn hardcoded reset mask into env variable Alexander Graf
2012-06-21 18:09 ` Blue Swirl
2012-06-21 19:04 ` Alexander Graf
2012-06-21 18:16 ` Peter Maydell
2012-06-20 20:11 ` [Qemu-devel] [PATCH 8/8] PPC: Add e5500 CPU target Alexander Graf
2012-06-20 22:26 ` Scott Wood
2012-06-20 22:59 ` Alexander Graf
2012-06-20 23:07 ` Scott Wood [this message]
2012-06-20 23:10 ` Alexander Graf
2012-06-20 23:28 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FE257B2.4040709@freescale.com \
--to=scottwood@freescale.com \
--cc=B02008@freescale.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.