* [kvm-unit-tests v2 PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
@ 2022-12-06 11:08 Thomas Huth
2022-12-06 11:43 ` Cédric Le Goater
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2022-12-06 11:08 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>
---
lib/powerpc/asm/ppc_asm.h | 3 +++
powerpc/cstart64.S | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/lib/powerpc/asm/ppc_asm.h b/lib/powerpc/asm/ppc_asm.h
index 39620a39..1b85f6bb 100644
--- a/lib/powerpc/asm/ppc_asm.h
+++ b/lib/powerpc/asm/ppc_asm.h
@@ -35,4 +35,7 @@
#endif /* __BYTE_ORDER__ */
+/* Machine State Register definitions: */
+#define MSR_SF_BIT 63 /* 64-bit mode */
+
#endif /* _ASMPOWERPC_PPC_ASM_H */
diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
index 972851f9..34e39341 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,MSR_SF_BIT
+ 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] 2+ messages in thread
* Re: [kvm-unit-tests v2 PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
2022-12-06 11:08 [kvm-unit-tests v2 PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU Thomas Huth
@ 2022-12-06 11:43 ` Cédric Le Goater
0 siblings, 0 replies; 2+ messages in thread
From: Cédric Le Goater @ 2022-12-06 11:43 UTC (permalink / raw)
To: Thomas Huth, kvm; +Cc: kvm-ppc, Laurent Vivier
On 12/6/22 12:08, 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>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
> ---
> lib/powerpc/asm/ppc_asm.h | 3 +++
> powerpc/cstart64.S | 6 ++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/lib/powerpc/asm/ppc_asm.h b/lib/powerpc/asm/ppc_asm.h
> index 39620a39..1b85f6bb 100644
> --- a/lib/powerpc/asm/ppc_asm.h
> +++ b/lib/powerpc/asm/ppc_asm.h
> @@ -35,4 +35,7 @@
>
> #endif /* __BYTE_ORDER__ */
>
> +/* Machine State Register definitions: */
> +#define MSR_SF_BIT 63 /* 64-bit mode */
> +
> #endif /* _ASMPOWERPC_PPC_ASM_H */
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> index 972851f9..34e39341 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,MSR_SF_BIT
> + 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,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-06 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 11:08 [kvm-unit-tests v2 PATCH] powerpc: Fix running the kvm-unit-tests with recent versions of QEMU Thomas Huth
2022-12-06 11:43 ` Cédric Le Goater
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).