qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Michael Walle <michael@walle.cc>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target-ppc: set MSR_CM bit for BookE 2.06 MMU
Date: Fri, 22 Jul 2016 16:07:28 +0200	[thread overview]
Message-ID: <579228A0.6050302@suse.de> (raw)
In-Reply-To: <78e83644673b8869a3d183e74ac256dc@walle.cc>

On 07/22/2016 03:46 PM, Michael Walle wrote:
> Am 2016-07-22 15:07, schrieb Alexander Graf:
>>> On 22 Jul 2016, at 15:00, Michael Walle <michael@walle.cc> wrote:
>>>
>>> 64 bit user mode doesn't work for the e5500 core because the MSR_CM 
>>> bit is
>>> not set which enables the 64 bit mode for this MMU model. Memory 
>>> addresses
>>> are truncated to 32 bit, which results in "Invalid data memory access"
>>> error messages. Fix it by setting the MSR_CM bit for this MMU model.
>>>
>>> Signed-off-by: Michael Walle <michael@walle.cc>
>>> ---
>>> target-ppc/translate_init.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
>>> index 5ecafc7..1ebb143 100644
>>> --- a/target-ppc/translate_init.c
>>> +++ b/target-ppc/translate_init.c
>>> @@ -10218,6 +10218,9 @@ static void ppc_cpu_reset(CPUState *s)
>>>     if (env->mmu_model & POWERPC_MMU_64) {
>>>         msr |= (1ULL << MSR_SF);
>>>     }
>>> +    if (env->mmu_model == POWERPC_MMU_BOOKE206) {
>>
>> Is this check correct? Doesn’t e500mc adhere to 2.06 as well? Running
>>
>>   qemu-system-ppc64 -M ppce500 -cpu e500mc …
>>
>> is perfectly valid and should just work. With your patch, it would
>> start in invalid 64bit mode :).
>>
>>
>> Alex
>
> Mhh, sorry I don't really have any understanding of the PPC state 
> after reset. Should have flagged this as RFC.
>
> Maybe I should explain my issue. I'm debugging a problem with the 64 
> bit linux-user variant (qemu-ppc64). There the first instructions 
> causes an "Invalid data memory access" because the address is 
> truncated to 32 bit. This is because the msr_is_64bit() returns false 
> in my case. So first question here, is qemu-ppc64 supposed to set the 
> MSR to 64bit mode? I guess so, because 32bit mode would be the 
> qemu-ppc binary. What is the MSR state in full system emulation for a 
> e5500 core? 64bit or 32bit?

It depends on the target. Usually the reset vector is used for system 
emulation. But apparently you're targeting user mode emulation, so the 
reset MSR really goes to linux-user/main.c. We already set MSR_SF there 
for 64bit binaries, I guess you'd have to check on the cpu flavor and 
just set either SF or CM depending on cpu flags (PPC2_BOOKE206 maybe?) 
in there.


Alex

>
> If it is 32bit, the simple solution would be to put #ifdef 
> CONFIG_USER_ONLY around my patch, right?
> If the MMU is in 64bit mode after reset, I would have to check for the 
> e5500, too. Mhh, I don't see that this information is available in 
> ppc_cpu_reset().
>
> -michael
>

      reply	other threads:[~2016-07-22 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22 13:00 [Qemu-devel] [PATCH] target-ppc: set MSR_CM bit for BookE 2.06 MMU Michael Walle
2016-07-22 13:07 ` Alexander Graf
2016-07-22 13:46   ` Michael Walle
2016-07-22 14:07     ` Alexander Graf [this message]

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=579228A0.6050302@suse.de \
    --to=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=michael@walle.cc \
    --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 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).