qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "\"Doug Kwan (關振德)\"" <dougkwan@google.com>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 2/3] PPC: Allow little-endian user mode.
Date: Tue, 13 May 2014 09:32:40 +0200	[thread overview]
Message-ID: <5371CA98.3030403@suse.de> (raw)
In-Reply-To: <CAH9SEo66WOnGwzxHnw2jVWcX7CdGFThhy6F7pNJJwYWLgQTeKw@mail.gmail.com>


On 13.05.14 09:30, Doug Kwan (關振德) wrote:
>
>
>
> On Tue, May 13, 2014 at 12:05 AM, Alexander Graf <agraf@suse.de 
> <mailto:agraf@suse.de>> wrote:
>
>
>     On 10.05.14 11:16, Doug Kwan wrote:
>
>         This allow running PPC64 little-endian in user mode if target
>         is configured
>         that way.  In PPC64 LE user mode we set MSR.LE during
>         initialization.
>         Overhaul handling of byteswapping in code generation and mem
>         helpers.
>
>         Signed-off-by: Doug Kwan <dougkwan@google.com
>         <mailto:dougkwan@google.com>>
>         ---
>           target-ppc/mem_helper.c     |  25 ++++++--
>           target-ppc/translate.c      | 150
>         +++++++++++++++++---------------------------
>           target-ppc/translate_init.c |   9 +++
>           3 files changed, 89 insertions(+), 95 deletions(-)
>
>
>     [...]
>
>
>         diff --git a/target-ppc/translate_init.c
>         b/target-ppc/translate_init.c
>         index 4d94015..84381ae 100644
>         --- a/target-ppc/translate_init.c
>         +++ b/target-ppc/translate_init.c
>         @@ -8418,6 +8418,9 @@ static void ppc_cpu_reset(CPUState *s)
>               msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
>               msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
>               msr |= (target_ulong)1 << MSR_PR;
>         +#if !defined(TARGET_WORDS_BIGENDIAN)
>         +    msr |= (target_ulong)1 << MSR_LE; /* Little-endian user
>         mode */
>         +#endif
>           #endif
>             #if defined(TARGET_PPC64)
>         @@ -8461,6 +8464,12 @@ static void ppc_cpu_reset(CPUState *s)
>                 /* Flush all TLBs */
>               tlb_flush(s, 1);
>         +
>         +#if defined(CONFIG_USER_ONLY) && !defined(TARGET_WORDS_BIGENDIAN)
>         +    if (!msr_le) {
>         +        cpu_abort(CPU(cpu), "Cannot set QEMU to little-endian
>         user mode\n");
>
>
>     We don't have this check the other way around, so why do we need
>     it here? How do you ever get to this?
>
>
>     Alex
>
> I am just being paranoid as I am new to this code base.  The reason 
> why this is asymmetric because the PPC targets are big-endian by 
> default and I don't know if all CPUs support setting msr.le.  If 
> someone specifies a CPU that does not support little-endian mode, I 
> want to stop qemu early with an error.  The check can be removed if it 
> is redundant.

Well, all CPUs that Linux supports with LE today also support the MSR_LE 
bit. If anyone would ever want to do an e500 LE port things would become 
messy, as LE is a TLB property there, so we don't have a generic bit to 
look at.

I think we just drop this check. If the user passes in an incompatible 
CPU it's his own fault :).


Alex

  reply	other threads:[~2014-05-13  7:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-10  9:16 [Qemu-devel] [PATCH v2 0/3] Adding new user mode target ppc64le-linux-user Doug Kwan
2014-05-10  9:16 ` [Qemu-devel] [PATCH v2 1/3] linux-user: Support little-endian PPC64 in user mode Doug Kwan
2014-05-10  9:55   ` Peter Maydell
2014-05-10 10:02   ` Peter Maydell
2014-05-10  9:16 ` [Qemu-devel] [PATCH v2 2/3] PPC: Allow little-endian " Doug Kwan
2014-05-10 10:13   ` Peter Maydell
2014-05-13  7:05   ` Alexander Graf
2014-05-13  7:30     ` Doug Kwan (關振德)
2014-05-13  7:32       ` Alexander Graf [this message]
2014-05-10  9:16 ` [Qemu-devel] [PATCH v2 3/3] Add a new user mode target for little-endian PPC64 Doug Kwan
2014-05-10 10:00   ` Peter Maydell
2014-05-12 13:05   ` Tom Musta
2014-05-13  6:45     ` Doug Kwan (關振德)
2014-05-13  7:06 ` [Qemu-devel] [PATCH v2 0/3] Adding new user mode target ppc64le-linux-user Alexander Graf
2014-05-13 12:08   ` [Qemu-devel] [Qemu-ppc] " Tom Musta

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=5371CA98.3030403@suse.de \
    --to=agraf@suse.de \
    --cc=dougkwan@google.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).