Received: from eggs.gnu.org ([2001:4830:134:3::10]:37271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQamw-0000ik-LC for qemu-devel@nongnu.org; Fri, 22 Jul 2016 09:46:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQamu-0003b4-MU for qemu-devel@nongnu.org; Fri, 22 Jul 2016 09:46:49 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Fri, 22 Jul 2016 15:46:44 +0200 From: Michael Walle In-Reply-To: <3B05311A-964D-4702-9C18-CFF265065388@suse.de> References: <1469192408-21713-1-git-send-email-michael@walle.cc> <3B05311A-964D-4702-9C18-CFF265065388@suse.de> Message-ID: <78e83644673b8869a3d183e74ac256dc@walle.cc> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] target-ppc: set MSR_CM bit for BookE 2.06 MMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org Am 2016-07-22 15:07, schrieb Alexander Graf: >> On 22 Jul 2016, at 15:00, Michael Walle wrote: >>=20 >> 64 bit user mode doesn't work for the e5500 core because the MSR_CM=20 >> bit is >> not set which enables the 64 bit mode for this MMU model. Memory=20 >> 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. >>=20 >> Signed-off-by: Michael Walle >> --- >> target-ppc/translate_init.c | 3 +++ >> 1 file changed, 3 insertions(+) >>=20 >> 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 |=3D (1ULL << MSR_SF); >> } >> + if (env->mmu_model =3D=3D POWERPC_MMU_BOOKE206) { >=20 > Is this check correct? Doesn=E2=80=99t e500mc adhere to 2.06 as well? R= unning >=20 > qemu-system-ppc64 -M ppce500 -cpu e500mc =E2=80=A6 >=20 > is perfectly valid and should just work. With your patch, it would > start in invalid 64bit mode :). >=20 >=20 > Alex Mhh, sorry I don't really have any understanding of the PPC state after=20 reset. Should have flagged this as RFC. Maybe I should explain my issue. I'm debugging a problem with the 64 bit=20 linux-user variant (qemu-ppc64). There the first instructions causes an=20 "Invalid data memory access" because the address is truncated to 32 bit.=20 This is because the msr_is_64bit() returns false in my case. So first=20 question here, is qemu-ppc64 supposed to set the MSR to 64bit mode? I=20 guess so, because 32bit mode would be the qemu-ppc binary. What is the=20 MSR state in full system emulation for a e5500 core? 64bit or 32bit? If it is 32bit, the simple solution would be to put #ifdef=20 CONFIG_USER_ONLY around my patch, right? If the MMU is in 64bit mode after reset, I would have to check for the=20 e5500, too. Mhh, I don't see that this information is available in=20 ppc_cpu_reset(). -michael