All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
@ 2022-12-06 10:14 ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2022-12-06 10:14 UTC (permalink / raw)
  To: kvm; +Cc: kvm-ppc, Laurent Vivier, Cédric Le Goater

Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
resetting a core"). This causes our test_64bit() in powerpc/emulator.c
to fail. Let's switch to 64-bit in our startup code instead to fix the
issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 powerpc/cstart64.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
index 972851f9..206c518f 100644
--- a/powerpc/cstart64.S
+++ b/powerpc/cstart64.S
@@ -23,6 +23,12 @@
 .globl start
 start:
 	FIXUP_ENDIAN
+	/* Switch to 64-bit mode */
+	mfmsr	r1
+	li	r2,1
+	sldi	r2,r2,63
+	or	r1,r1,r2
+	mtmsrd	r1
 	/*
 	 * 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.31.1


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

* [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
@ 2022-12-06 10:14 ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2022-12-06 10:14 UTC (permalink / raw)
  To: kvm; +Cc: kvm-ppc, Laurent Vivier, Cédric Le Goater

Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
resetting a core"). This causes our test_64bit() in powerpc/emulator.c
to fail. Let's switch to 64-bit in our startup code instead to fix the
issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 powerpc/cstart64.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
index 972851f9..206c518f 100644
--- a/powerpc/cstart64.S
+++ b/powerpc/cstart64.S
@@ -23,6 +23,12 @@
 .globl start
 start:
 	FIXUP_ENDIAN
+	/* Switch to 64-bit mode */
+	mfmsr	r1
+	li	r2,1
+	sldi	r2,r2,63
+	or	r1,r1,r2
+	mtmsrd	r1
 	/*
 	 * 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.31.1

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

* Re: [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
  2022-12-06 10:14 ` Thomas Huth
@ 2022-12-06 10:40   ` Cédric Le Goater
  -1 siblings, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2022-12-06 10:40 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: kvm-ppc, Laurent Vivier

On 12/6/22 11:14, Thomas Huth wrote:
> Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
> instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
> resetting a core"). This causes our test_64bit() in powerpc/emulator.c
> to fail. Let's switch to 64-bit in our startup code instead to fix the
> issue.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   powerpc/cstart64.S | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> index 972851f9..206c518f 100644
> --- a/powerpc/cstart64.S
> +++ b/powerpc/cstart64.S
> @@ -23,6 +23,12 @@
>   .globl start
>   start:
>   	FIXUP_ENDIAN
> +	/* Switch to 64-bit mode */
> +	mfmsr	r1
> +	li	r2,1
> +	sldi	r2,r2,63
> +	or	r1,r1,r2
> +	mtmsrd	r1
>   	/*
>   	 * 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,

You could add this define in lib/powerpc/asm/ppc_asm.h  :

#define MSR_SF	0x8000000000000000ul

and possibly use the LOAD_REG_IMMEDIATE macro to set the MSR.

Thanks,

C.




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

* Re: [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
@ 2022-12-06 10:40   ` Cédric Le Goater
  0 siblings, 0 replies; 6+ messages in thread
From: Cédric Le Goater @ 2022-12-06 10:40 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: kvm-ppc, Laurent Vivier

On 12/6/22 11:14, Thomas Huth wrote:
> Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
> instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
> resetting a core"). This causes our test_64bit() in powerpc/emulator.c
> to fail. Let's switch to 64-bit in our startup code instead to fix the
> issue.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   powerpc/cstart64.S | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> index 972851f9..206c518f 100644
> --- a/powerpc/cstart64.S
> +++ b/powerpc/cstart64.S
> @@ -23,6 +23,12 @@
>   .globl start
>   start:
>   	FIXUP_ENDIAN
> +	/* Switch to 64-bit mode */
> +	mfmsr	r1
> +	li	r2,1
> +	sldi	r2,r2,63
> +	or	r1,r1,r2
> +	mtmsrd	r1
>   	/*
>   	 * 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,

You could add this define in lib/powerpc/asm/ppc_asm.h  :

#define MSR_SF	0x8000000000000000ul

and possibly use the LOAD_REG_IMMEDIATE macro to set the MSR.

Thanks,

C.



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

* Re: [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
  2022-12-06 10:40   ` Cédric Le Goater
@ 2022-12-06 11:04     ` Thomas Huth
  -1 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2022-12-06 10:58 UTC (permalink / raw)
  To: Cédric Le Goater, kvm; +Cc: kvm-ppc, Laurent Vivier

On 06/12/2022 11.40, Cédric Le Goater wrote:
> On 12/6/22 11:14, Thomas Huth wrote:
>> Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
>> instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
>> resetting a core"). This causes our test_64bit() in powerpc/emulator.c
>> to fail. Let's switch to 64-bit in our startup code instead to fix the
>> issue.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   powerpc/cstart64.S | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>> index 972851f9..206c518f 100644
>> --- a/powerpc/cstart64.S
>> +++ b/powerpc/cstart64.S
>> @@ -23,6 +23,12 @@
>>   .globl start
>>   start:
>>       FIXUP_ENDIAN
>> +    /* Switch to 64-bit mode */
>> +    mfmsr    r1
>> +    li    r2,1
>> +    sldi    r2,r2,63
>> +    or    r1,r1,r2
>> +    mtmsrd    r1
>>       /*
>>        * 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,
> 
> You could add this define in lib/powerpc/asm/ppc_asm.h  :
> 
> #define MSR_SF    0x8000000000000000ul
> 
> and possibly use the LOAD_REG_IMMEDIATE macro to set the MSR.

Using LOAD_REG_IMMEDIATE would add quite a bit of additional instructions 
here, so not sure whether I like it ... but I think I could add a proper 
#define for 63 at least.

  Thomas

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

* Re: [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
@ 2022-12-06 11:04     ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2022-12-06 11:04 UTC (permalink / raw)
  To: Cédric Le Goater, kvm; +Cc: kvm-ppc, Laurent Vivier

On 06/12/2022 11.40, Cédric Le Goater wrote:
> On 12/6/22 11:14, Thomas Huth wrote:
>> Starting with version 7.0, QEMU starts the pseries guests in 32-bit mode
>> instead of 64-bit (see QEMU commit 6e3f09c28a - "spapr: Force 32bit when
>> resetting a core"). This causes our test_64bit() in powerpc/emulator.c
>> to fail. Let's switch to 64-bit in our startup code instead to fix the
>> issue.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   powerpc/cstart64.S | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
>> index 972851f9..206c518f 100644
>> --- a/powerpc/cstart64.S
>> +++ b/powerpc/cstart64.S
>> @@ -23,6 +23,12 @@
>>   .globl start
>>   start:
>>       FIXUP_ENDIAN
>> +    /* Switch to 64-bit mode */
>> +    mfmsr    r1
>> +    li    r2,1
>> +    sldi    r2,r2,63
>> +    or    r1,r1,r2
>> +    mtmsrd    r1
>>       /*
>>        * 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,
> 
> You could add this define in lib/powerpc/asm/ppc_asm.h  :
> 
> #define MSR_SF    0x8000000000000000ul
> 
> and possibly use the LOAD_REG_IMMEDIATE macro to set the MSR.

Using LOAD_REG_IMMEDIATE would add quite a bit of additional instructions 
here, so not sure whether I like it ... but I think I could add a proper 
#define for 63 at least.

  Thomas


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

end of thread, other threads:[~2022-12-06 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 10:14 [kvm-unit-tests PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU Thomas Huth
2022-12-06 10:14 ` Thomas Huth
2022-12-06 10:40 ` Cédric Le Goater
2022-12-06 10:40   ` Cédric Le Goater
2022-12-06 10:58   ` Thomas Huth
2022-12-06 11:04     ` Thomas Huth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.