kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: enable 64-bit mode
@ 2016-03-15 13:15 Laurent Vivier
  2016-03-15 13:43 ` Laurent Vivier
  2016-03-15 18:43 ` Thomas Huth
  0 siblings, 2 replies; 7+ messages in thread
From: Laurent Vivier @ 2016-03-15 13:15 UTC (permalink / raw)
  To: kvm, kvm-ppc; +Cc: drjones, thuth, dgibson, pbonzini, Laurent Vivier

When they are started, processors are in 32-bit mode,
as we are testing ppc64 processors, enable the 64bit mode
on starting.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 powerpc/cstart64.S | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
index c87e3d6..634b854 100644
--- a/powerpc/cstart64.S
+++ b/powerpc/cstart64.S
@@ -18,6 +18,15 @@
 .globl start
 start:
 	FIXUP_ENDIAN
+
+	/* enable 64-bit mode */
+	mfmsr	r11
+	li	r12,-1
+	rldicr	r12,r12,0,0
+	or	r11,r11,r12
+	mtmsrd	r11
+	isync
+
 	/*
 	 * We were loaded at QEMU's kernel load address, but we're not
 	 * allowed to link there due to how QEMU deals with linker VMAs,
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 13:15 [PATCH] powerpc: enable 64-bit mode Laurent Vivier
@ 2016-03-15 13:43 ` Laurent Vivier
  2016-03-15 18:43 ` Thomas Huth
  1 sibling, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2016-03-15 13:43 UTC (permalink / raw)
  To: kvm, kvm-ppc; +Cc: drjones, thuth, dgibson, pbonzini

Missing in the subject: it's a kvm-unit-tests patch.

Laurent

On 15/03/2016 14:15, Laurent Vivier wrote:
> When they are started, processors are in 32-bit mode,
> as we are testing ppc64 processors, enable the 64bit mode
> on starting.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  powerpc/cstart64.S | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> index c87e3d6..634b854 100644
> --- a/powerpc/cstart64.S
> +++ b/powerpc/cstart64.S
> @@ -18,6 +18,15 @@
>  .globl start
>  start:
>  	FIXUP_ENDIAN
> +
> +	/* enable 64-bit mode */
> +	mfmsr	r11
> +	li	r12,-1
> +	rldicr	r12,r12,0,0
> +	or	r11,r11,r12
> +	mtmsrd	r11
> +	isync
> +
>  	/*
>  	 * We were loaded at QEMU's kernel load address, but we're not
>  	 * allowed to link there due to how QEMU deals with linker VMAs,
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 13:15 [PATCH] powerpc: enable 64-bit mode Laurent Vivier
  2016-03-15 13:43 ` Laurent Vivier
@ 2016-03-15 18:43 ` Thomas Huth
  2016-03-15 18:44   ` Alexander Graf
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2016-03-15 18:43 UTC (permalink / raw)
  To: Laurent Vivier, kvm, kvm-ppc; +Cc: drjones, dgibson, pbonzini

On 15.03.2016 14:15, Laurent Vivier wrote:
> When they are started, processors are in 32-bit mode,
> as we are testing ppc64 processors, enable the 64bit mode
> on starting.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  powerpc/cstart64.S | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> index c87e3d6..634b854 100644
> --- a/powerpc/cstart64.S
> +++ b/powerpc/cstart64.S
> @@ -18,6 +18,15 @@
>  .globl start
>  start:
>  	FIXUP_ENDIAN
> +
> +	/* enable 64-bit mode */
> +	mfmsr	r11
> +	li	r12,-1
> +	rldicr	r12,r12,0,0

Nice idea to set the highest bit, I didn't know that one yet :-)

> +	or	r11,r11,r12
> +	mtmsrd	r11
> +	isync

Looks good!

Reviewed-by: Thomas Huth <thuth@redhat.com>


PS: As far as I can see, the C code has already been compiled for 64
bits ... how did that work if it has been run in 32-bit mode so far??


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 18:43 ` Thomas Huth
@ 2016-03-15 18:44   ` Alexander Graf
  2016-03-15 19:10     ` Thomas Huth
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alexander Graf @ 2016-03-15 18:44 UTC (permalink / raw)
  To: Thomas Huth, Laurent Vivier, kvm, kvm-ppc; +Cc: drjones, dgibson, pbonzini



On 15.03.16 19:43, Thomas Huth wrote:
> On 15.03.2016 14:15, Laurent Vivier wrote:
>> When they are started, processors are in 32-bit mode,
>> as we are testing ppc64 processors, enable the 64bit mode
>> on starting.
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  powerpc/cstart64.S | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>> index c87e3d6..634b854 100644
>> --- a/powerpc/cstart64.S
>> +++ b/powerpc/cstart64.S
>> @@ -18,6 +18,15 @@
>>  .globl start
>>  start:
>>  	FIXUP_ENDIAN
>> +
>> +	/* enable 64-bit mode */
>> +	mfmsr	r11
>> +	li	r12,-1
>> +	rldicr	r12,r12,0,0
> 
> Nice idea to set the highest bit, I didn't know that one yet :-)
> 
>> +	or	r11,r11,r12
>> +	mtmsrd	r11
>> +	isync
> 
> Looks good!
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> 
> PS: As far as I can see, the C code has already been compiled for 64
> bits ... how did that work if it has been run in 32-bit mode so far??

And why would we enter a 64bit CPU without MSR_SF set?


Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 18:44   ` Alexander Graf
@ 2016-03-15 19:10     ` Thomas Huth
  2016-03-15 20:12     ` Laurent Vivier
  2016-03-16  9:45     ` Laurent Vivier
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2016-03-15 19:10 UTC (permalink / raw)
  To: Alexander Graf, Laurent Vivier, kvm, kvm-ppc; +Cc: drjones, dgibson, pbonzini

On 15.03.2016 19:44, Alexander Graf wrote:
> 
> 
> On 15.03.16 19:43, Thomas Huth wrote:
>> On 15.03.2016 14:15, Laurent Vivier wrote:
>>> When they are started, processors are in 32-bit mode,
>>> as we are testing ppc64 processors, enable the 64bit mode
>>> on starting.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  powerpc/cstart64.S | 9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>>> index c87e3d6..634b854 100644
>>> --- a/powerpc/cstart64.S
>>> +++ b/powerpc/cstart64.S
>>> @@ -18,6 +18,15 @@
>>>  .globl start
>>>  start:
>>>  	FIXUP_ENDIAN
>>> +
>>> +	/* enable 64-bit mode */
>>> +	mfmsr	r11
>>> +	li	r12,-1
>>> +	rldicr	r12,r12,0,0
>>
>> Nice idea to set the highest bit, I didn't know that one yet :-)
>>
>>> +	or	r11,r11,r12
>>> +	mtmsrd	r11
>>> +	isync
>>
>> Looks good!
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>>
>> PS: As far as I can see, the C code has already been compiled for 64
>> bits ... how did that work if it has been run in 32-bit mode so far??
> 
> And why would we enter a 64bit CPU without MSR_SF set?

Ah, I see, 64-bit mode is already enabled in translate_init.c for 64-bit
CPUs! I somehow thought that 64-bit PPCs would start in 32-bit mode (for
backwards compatibility), and thus I expected that the VMs would also be
started in 32-bit mode. But seems like this is not the case... and I
learned again a new detail about PPCs :-)

 Thomas


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 18:44   ` Alexander Graf
  2016-03-15 19:10     ` Thomas Huth
@ 2016-03-15 20:12     ` Laurent Vivier
  2016-03-16  9:45     ` Laurent Vivier
  2 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2016-03-15 20:12 UTC (permalink / raw)
  To: Alexander Graf, Thomas Huth, kvm, kvm-ppc; +Cc: drjones, dgibson, pbonzini



On 15/03/2016 19:44, Alexander Graf wrote:
> 
> 
> On 15.03.16 19:43, Thomas Huth wrote:
>> On 15.03.2016 14:15, Laurent Vivier wrote:
>>> When they are started, processors are in 32-bit mode,
>>> as we are testing ppc64 processors, enable the 64bit mode
>>> on starting.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  powerpc/cstart64.S | 9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>>> index c87e3d6..634b854 100644
>>> --- a/powerpc/cstart64.S
>>> +++ b/powerpc/cstart64.S
>>> @@ -18,6 +18,15 @@
>>>  .globl start
>>>  start:
>>>  	FIXUP_ENDIAN
>>> +
>>> +	/* enable 64-bit mode */
>>> +	mfmsr	r11
>>> +	li	r12,-1
>>> +	rldicr	r12,r12,0,0
>>
>> Nice idea to set the highest bit, I didn't know that one yet :-)
>>
>>> +	or	r11,r11,r12
>>> +	mtmsrd	r11
>>> +	isync
>>
>> Looks good!
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>>
>> PS: As far as I can see, the C code has already been compiled for 64
>> bits ... how did that work if it has been run in 32-bit mode so far??
> 
> And why would we enter a 64bit CPU without MSR_SF set?

I don't know, but:

When I start "qemu-system-ppc64 -machine pseries -s -S" and check the
MSR with gdb, the MSR is always set to 0 (or "info registers" in
monitor). It's why I've added this initialization.

So, perhaps there is  a bug in QEMU?

[Perhaps "env->msr |= (1ULL << MSR_SF)" is overwritten by the following
hreg_store_msr(env, msr, 1);"?]


Laurent




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] powerpc: enable 64-bit mode
  2016-03-15 18:44   ` Alexander Graf
  2016-03-15 19:10     ` Thomas Huth
  2016-03-15 20:12     ` Laurent Vivier
@ 2016-03-16  9:45     ` Laurent Vivier
  2 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2016-03-16  9:45 UTC (permalink / raw)
  To: Alexander Graf, Thomas Huth, kvm, kvm-ppc; +Cc: drjones, dgibson, pbonzini



On 15/03/2016 19:44, Alexander Graf wrote:
> 
> 
> On 15.03.16 19:43, Thomas Huth wrote:
>> On 15.03.2016 14:15, Laurent Vivier wrote:
>>> When they are started, processors are in 32-bit mode,
>>> as we are testing ppc64 processors, enable the 64bit mode
>>> on starting.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  powerpc/cstart64.S | 9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>>> index c87e3d6..634b854 100644
>>> --- a/powerpc/cstart64.S
>>> +++ b/powerpc/cstart64.S
>>> @@ -18,6 +18,15 @@
>>>  .globl start
>>>  start:
>>>  	FIXUP_ENDIAN
>>> +
>>> +	/* enable 64-bit mode */
>>> +	mfmsr	r11
>>> +	li	r12,-1
>>> +	rldicr	r12,r12,0,0
>>
>> Nice idea to set the highest bit, I didn't know that one yet :-)
>>
>>> +	or	r11,r11,r12
>>> +	mtmsrd	r11
>>> +	isync
>>
>> Looks good!
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>>
>> PS: As far as I can see, the C code has already been compiled for 64
>> bits ... how did that work if it has been run in 32-bit mode so far??
> 
> And why would we enter a 64bit CPU without MSR_SF set?

OK, it seems to be a bug in QEMU. I've sent a patch to QEMU ML trying to
fix that.

Laurent

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-16  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15 13:15 [PATCH] powerpc: enable 64-bit mode Laurent Vivier
2016-03-15 13:43 ` Laurent Vivier
2016-03-15 18:43 ` Thomas Huth
2016-03-15 18:44   ` Alexander Graf
2016-03-15 19:10     ` Thomas Huth
2016-03-15 20:12     ` Laurent Vivier
2016-03-16  9:45     ` Laurent Vivier

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).