Skip to contentSkip to conversation

ppc64: set MSR_SF bit

PATCH Applied Laurent Vivier 4 participants 8 messages Mar 16, 2016 – Mar 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64: set MSR_SF bit

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index bd0cffc..d7a1aeb 100644
@@ -9663,7 +9663,7 @@ static void ppc_cpu_reset(CPUState *s)
 
 #if defined(TARGET_PPC64)
     if (env->mmu_model & POWERPC_MMU_64) {
-        env->msr |= (1ULL << MSR_SF);
+        msr |= (1ULL << MSR_SF);
     }
 #endif
 
Signature · 1 line
2.5.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Quoted 18 lines
---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index bd0cffc..d7a1aeb 100644
@@ -9663,7 +9663,7 @@ static void ppc_cpu_reset(CPUState *s)
 
 #if defined(TARGET_PPC64)
     if (env->mmu_model & POWERPC_MMU_64) {
-        env->msr |= (1ULL << MSR_SF);
+        msr |= (1ULL << MSR_SF);
     }
 #endif
 
#2 lore raw
Quoted 10 lines · Alexander Graf
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Linux kernel is ready to manage that: see enable_64b_mode in arch/powerpc/kernel/head_64.S

Quoted 1 line

Thanks,
Laurent

Quoted 18 lines
Quoted 18 lines
---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index bd0cffc..d7a1aeb 100644
@@ -9663,7 +9663,7 @@ static void ppc_cpu_reset(CPUState *s)
 
 #if defined(TARGET_PPC64)
     if (env->mmu_model & POWERPC_MMU_64) {
-        env->msr |= (1ULL << MSR_SF);
+        msr |= (1ULL << MSR_SF);
     }
 #endif
 
#3 lore raw
Quoted 7 lines · Laurent Vivier
Quoted 6 lines · Alexander Graf
Quoted 3 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Linux kernel is ready to manage that: see enable_64b_mode in arch/powerpc/kernel/head_64.S

We don't boot Linux directly though, only openBIOS and SLOF :).

Alex

#4 lore raw
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Laurent Vivier
Quoted 8 lines · Alexander Graf
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Linux kernel is ready to manage that: see enable_64b_mode in arch/powerpc/kernel/head_64.S

We don't boot Linux directly though, only openBIOS and SLOF :).

Same thing in SLOF:

./board-qemu/llfw/startup.S

_start:
...

        mfmsr   r11                     /* grab the current MSR */
        li      r12,(MSR_SF | MSR_ISF)@highest
        sldi    r12,r12,48
        or      r11,r11,r12
        mtmsrd  r11

isync

And openbios seems to disable it explicitly:

./arch/ppc/qemu/start.S

_entry:
...
/* clear MSR, disable MMU, SF */

[BTW, I've never been able to compile a 64bit version of openbios...]

Laurent

#5 lore raw
In reply to Alexander Graf
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Laurent Vivier
Quoted 8 lines · Alexander Graf
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Linux kernel is ready to manage that: see enable_64b_mode in arch/powerpc/kernel/head_64.S

We don't boot Linux directly though, only openBIOS and SLOF :).

Both, SLOF and OpenBIOS, seem to enable the SF bit manually, too, see:

https://github.com/qemu/openbios/blob/master/arch/ppc/qemu/start.S#L524

https://github.com/aik/SLOF/blob/master/board-qemu/llfw/startup.S#L91

Thomas

#6 lore raw
Quoted 19 lines · Thomas Huth
Quoted 18 lines · Alexander Graf
Quoted 14 lines · Laurent Vivier
Quoted 10 lines · Alexander Graf
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

I guess commit 2cf3eb6df552cee74b52de9989e270b74e42847e broke this. I'm surprised it didn't cause us more problems :).

Linux kernel is ready to manage that: see enable_64b_mode in arch/powerpc/kernel/head_64.S

Quoted 7 lines
Quoted 1 line

We don't boot Linux directly though, only openBIOS and SLOF :).

Both, SLOF and OpenBIOS, seem to enable the SF bit manually, too, see:

https://github.com/qemu/openbios/blob/master/arch/ppc/qemu/start.S#L524

https://github.com/aik/SLOF/blob/master/board-qemu/llfw/startup.S#L91

Power up is slightly tricky, as machine state is pushed into the CPU from the outside FWIW. I think we're "cleanest" if we just consider power up a reset.

Reset is properly defined as an exception (0x100). For exceptions, the 970MP user manual for example says:

4.5 Exception Definitions
When an exception/interrupt is taken, all bits in the MSR are set to ‘0’, with the following exceptions:
• Exceptions always set MSR[SF] to ‘1’.

So the qemu fix is the correct one IMHO.

Alex

Applied
#7 lore raw
In reply to Laurent Vivier
Quoted 4 lines · Laurent Vivier

When a qemu-system-ppc64 is started, the 64-bit mode bit is not set in MSR.

Applied to ppc-for-2.6, thanks.

Quoted 17 lines
---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index bd0cffc..d7a1aeb 100644
@@ -9663,7 +9663,7 @@ static void ppc_cpu_reset(CPUState *s)
 
 #if defined(TARGET_PPC64)
     if (env->mmu_model & POWERPC_MMU_64) {
-        env->msr |= (1ULL << MSR_SF);
+        msr |= (1ULL << MSR_SF);
     }
 #endif
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson