powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
PATCH 1/1 powerpc: Fix running the kvm-unit-tests with recent versions of QEMU
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.
--- powerpc/cstart64.S | 6 ++++++ 1 file changed, 6 insertions(+)
powerpc/cstart64.S +6 -0
@@ -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,
Signature · 1 line
2.31.1
Quoted 18 lines · Thomas Huth
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 ourtest_64bit()inpowerpc/emulator.cto fail. Let's switch to 64-bit in our startup code instead to fix the issue.Signed-off-by Thomas Huth <[email protected]>--- powerpc/cstart64.S | 6 ++++++ 1 file changed, 6 insertions(+)powerpc/cstart64.S +0
-0@@ -23,6 +23,12 @@ .globl start start:
powerpc/cstart64.S line 34
Quoted 10 lines
powerpc/cstart64.S +6
-0FIXUP_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.
Quoted 32 lines · Cédric Le Goater
Quoted 20 lines · Thomas Huth
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 ourtest_64bit()inpowerpc/emulator.cto fail. Let's switch to 64-bit in our startup code instead to fix the issue.Signed-off-by Thomas Huth <[email protected]>---
powerpc/cstart64.S| 6 ++++++1 file changed, 6 insertions(+)powerpc/cstart64.S +0
-0@@ -23,6 +23,12 @@.globl start
start:
FIXUP_ENDIAN
+ /* Switch to 64-bit mode */Quoted 8 lines
+ 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 :
Quoted 3 lines
#define MSR_SF
0x8000000000000000uland possibly use the
LOAD_REG_IMMEDIATEmacro 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