Skip to contentSkip to conversation

linux-user: ppc64: set MSR_CM bit for BookE 2.06 MMU

PATCH Applied Michael Walle 3 participants 7 messages Jul 22, 2016 – Sep 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: ppc64: set MSR_CM bit for BookE 2.06 MMU

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.

---

This is a kind of a v2 patch. The did the fix in the wrong place:
http://lists.nongnu.org/archive/html/qemu-devel/2016-07/msg05409.html

 linux-user/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
linux-user/main.c +3 -2
index 462e820..bac2cb0 100644
@@ -4626,10 +4626,11 @@ int main(int argc, char **argv, char **envp)
         int i;
 
 #if defined(TARGET_PPC64)
+        int flag = (env->insns_flags2 & PPC2_BOOKE206) ? MSR_CM : MSR_SF;
 #if defined(TARGET_ABI32)
-        env->msr &= ~((target_ulong)1 << MSR_SF);
+        env->msr &= ~((target_ulong)1 << flag);
 #else
-        env->msr |= (target_ulong)1 << MSR_SF;
+        env->msr |= (target_ulong)1 << flag;
 #endif
 #endif
         env->nip = regs->nip;
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Michael Walle

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.

Yup, I guess that's about as smart as we have to be :).

Alex

Quoted 26 lines

---

This is a kind of a v2 patch. The did the fix in the wrong place:

   http://lists.nongnu.org/archive/html/qemu-devel/2016-07/msg05409.html
  linux-user/main.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
linux-user/main.c +3 -2
index 462e820..bac2cb0 100644
@@ -4626,10 +4626,11 @@ int main(int argc, char **argv, char **envp)
          int i;
 
  #if defined(TARGET_PPC64)
+        int flag = (env->insns_flags2 & PPC2_BOOKE206) ? MSR_CM : MSR_SF;
  #if defined(TARGET_ABI32)
-        env->msr &= ~((target_ulong)1 << MSR_SF);
+        env->msr &= ~((target_ulong)1 << flag);
  #else
-        env->msr |= (target_ulong)1 << MSR_SF;
+        env->msr |= (target_ulong)1 << flag;
  #endif
  #endif
          env->nip = regs->nip;
#2 lore raw

Am 2016-07-22 17:57, schrieb Alexander Graf:

Quoted 6 lines · Michael Walle
Quoted 5 lines

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.

Quoted 6 lines
Quoted 1 line

Yup, I guess that's about as smart as we have to be :).

ping?

-michael

#3 lore raw
Quoted 9 lines · Michael Walle

Am 2016-07-22 17:57, schrieb Alexander Graf:

Quoted 8 lines · Michael Walle
Quoted 7 lines

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.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Yup, I guess that's about as smart as we have to be :).

ping?

sorry. slipped through - looks good, but do we want this to qemu 2.7, or is next goot enough?

Riku

#4 lore raw

Am 2016-08-16 15:41, schrieb Riku Voipio:

Quoted 15 lines · Michael Walle
Quoted 14 lines

Am 2016-07-22 17:57, schrieb Alexander Graf:

Quoted 13 lines · Michael Walle
Quoted 8 lines

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.

Yup, I guess that's about as smart as we have to be :).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

ping?

sorry. slipped through - looks good, but do we want this to qemu 2.7, or is next goot enough?

Hi Riku,

mhh, personally I would prefer to see it in 2.7, too, given that it is just a bugfix. But it only makes sense with the patch that I've just posted to the mailinglist ("linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP"). Therefore, if it is too late for the latter, the first might also be just scheduled for next.

-michael

#5 lore raw

Am 2016-08-16 15:56, schrieb Michael Walle:

Quoted 23 lines

Am 2016-08-16 15:41, schrieb Riku Voipio:

Quoted 15 lines · Michael Walle
Quoted 14 lines

Am 2016-07-22 17:57, schrieb Alexander Graf:

Quoted 13 lines · Michael Walle
Quoted 8 lines

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.

Yup, I guess that's about as smart as we have to be :).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

ping?

sorry. slipped through - looks good, but do we want this to qemu 2.7, or is next goot enough?

Quoted 7 lines

Hi Riku,

mhh, personally I would prefer to see it in 2.7, too, given that it is just a bugfix. But it only makes sense with the patch that I've just posted to the mailinglist ("linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP"). Therefore, if it is too late for the latter, the first might also be just scheduled for next.

ping. this is still missing. Since David pulled the "linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP" patch. This is the last missing piece to make yocto/ppc64 user-mode emulation work ;)

-michael

Applied
#6 lore raw
Quoted 32 lines · Michael Walle

Am 2016-08-16 15:56, schrieb Michael Walle:

Quoted 23 lines

Am 2016-08-16 15:41, schrieb Riku Voipio:

Quoted 15 lines · Michael Walle
Quoted 14 lines

Am 2016-07-22 17:57, schrieb Alexander Graf:

Quoted 13 lines · Michael Walle
Quoted 8 lines

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.

Yup, I guess that's about as smart as we have to be :).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

ping?

sorry. slipped through - looks good, but do we want this to qemu 2.7, or is next goot enough?

Quoted 7 lines

Hi Riku,

mhh, personally I would prefer to see it in 2.7, too, given that it is just a bugfix. But it only makes sense with the patch that I've just posted to the mailinglist ("linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP"). Therefore, if it is too late for the latter, the first might also be just scheduled for next.

Quoted 3 lines

ping. this is still missing. Since David pulled the "linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP" patch. This is the last missing piece to make yocto/ppc64 user-mode emulation work ;)

Applied. thanks!

Riku