]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
powerpc/32s: Fix RTAS machine check with VMAP stack
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 22 Dec 2020 07:11:18 +0000 (07:11 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 4 Jan 2021 12:59:25 +0000 (23:59 +1100)
When we have VMAP stack, exception prolog 1 sets r1, not r11.

When it is not an RTAS machine check, don't trash r1 because it is
needed by prolog 1.

Fixes: da7bb43ab9da ("powerpc/32: Fix vmap stack - Properly set r1 before activating MMU")
Fixes: d2e006036082 ("powerpc/32: Use SPRN_SPRG_SCRATCH2 in exception prologs")
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Squash in fixup for RTAS machine check from Christophe]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/bc77d61d1c18940e456a2dee464f1e2eda65a3f0.1608621048.git.christophe.leroy@csgroup.eu
arch/powerpc/kernel/head_book3s_32.S

index 349bf3f0c3afa994c5cc0c0ccd88ad4c1df7c8ac..858fbc8b19f325a1f28db35378f3f5f7175f4763 100644 (file)
@@ -260,10 +260,19 @@ __secondary_hold_acknowledge:
 MachineCheck:
        EXCEPTION_PROLOG_0
 #ifdef CONFIG_PPC_CHRP
+#ifdef CONFIG_VMAP_STACK
+       mtspr   SPRN_SPRG_SCRATCH2,r1
+       mfspr   r1, SPRN_SPRG_THREAD
+       lwz     r1, RTAS_SP(r1)
+       cmpwi   cr1, r1, 0
+       bne     cr1, 7f
+       mfspr   r1, SPRN_SPRG_SCRATCH2
+#else
        mfspr   r11, SPRN_SPRG_THREAD
        lwz     r11, RTAS_SP(r11)
        cmpwi   cr1, r11, 0
        bne     cr1, 7f
+#endif
 #endif /* CONFIG_PPC_CHRP */
        EXCEPTION_PROLOG_1 for_rtas=1
 7:     EXCEPTION_PROLOG_2