* [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
@ 2020-12-22 7:11 ` Christophe Leroy
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Leroy @ 2020-12-22 7:11 UTC (permalink / raw
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linux-kernel, linuxppc-dev
When we have VMAP stack, exception prolog 1 sets r1, not r11.
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
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/kernel/head_book3s_32.S | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S
index 349bf3f0c3af..fbc48a500846 100644
--- a/arch/powerpc/kernel/head_book3s_32.S
+++ b/arch/powerpc/kernel/head_book3s_32.S
@@ -260,9 +260,16 @@ __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
+#else
mfspr r11, SPRN_SPRG_THREAD
lwz r11, RTAS_SP(r11)
cmpwi cr1, r11, 0
+#endif
bne cr1, 7f
#endif /* CONFIG_PPC_CHRP */
EXCEPTION_PROLOG_1 for_rtas=1
--
2.25.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
@ 2020-12-22 7:11 ` Christophe Leroy
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Leroy @ 2020-12-22 7:11 UTC (permalink / raw
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
When we have VMAP stack, exception prolog 1 sets r1, not r11.
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
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/kernel/head_book3s_32.S | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S
index 349bf3f0c3af..fbc48a500846 100644
--- a/arch/powerpc/kernel/head_book3s_32.S
+++ b/arch/powerpc/kernel/head_book3s_32.S
@@ -260,9 +260,16 @@ __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
+#else
mfspr r11, SPRN_SPRG_THREAD
lwz r11, RTAS_SP(r11)
cmpwi cr1, r11, 0
+#endif
bne cr1, 7f
#endif /* CONFIG_PPC_CHRP */
EXCEPTION_PROLOG_1 for_rtas=1
--
2.25.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
2020-12-22 7:11 ` Christophe Leroy
@ 2020-12-22 13:11 ` Michael Ellerman
-1 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-12-22 13:11 UTC (permalink / raw
To: Michael Ellerman, Benjamin Herrenschmidt, Christophe Leroy,
Paul Mackerras
Cc: linux-kernel, linuxppc-dev
On Tue, 22 Dec 2020 07:11:18 +0000 (UTC), Christophe Leroy wrote:
> When we have VMAP stack, exception prolog 1 sets r1, not r11.
Applied to powerpc/fixes.
[1/1] powerpc/32s: Fix RTAS machine check with VMAP stack
https://git.kernel.org/powerpc/c/9c7422b92cb27369653c371ad9c44a502e5eea8f
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
@ 2020-12-22 13:11 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-12-22 13:11 UTC (permalink / raw
To: Michael Ellerman, Benjamin Herrenschmidt, Christophe Leroy,
Paul Mackerras
Cc: linuxppc-dev, linux-kernel
On Tue, 22 Dec 2020 07:11:18 +0000 (UTC), Christophe Leroy wrote:
> When we have VMAP stack, exception prolog 1 sets r1, not r11.
Applied to powerpc/fixes.
[1/1] powerpc/32s: Fix RTAS machine check with VMAP stack
https://git.kernel.org/powerpc/c/9c7422b92cb27369653c371ad9c44a502e5eea8f
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
2020-12-22 7:11 ` Christophe Leroy
(?)
(?)
@ 2020-12-23 6:48 ` Christophe Leroy
2020-12-24 1:05 ` Michael Ellerman
-1 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2020-12-23 6:48 UTC (permalink / raw
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
Le 22/12/2020 à 08:11, Christophe Leroy a écrit :
> When we have VMAP stack, exception prolog 1 sets r1, not r11.
But exception prolog 1 uses r1 to setup r1 when machine check happens in kernel.
So r1 must be restored when the branch is not taken. See subsequent patch I just sent out.
Christophe
>
> 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
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/kernel/head_book3s_32.S | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S
> index 349bf3f0c3af..fbc48a500846 100644
> --- a/arch/powerpc/kernel/head_book3s_32.S
> +++ b/arch/powerpc/kernel/head_book3s_32.S
> @@ -260,9 +260,16 @@ __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
> +#else
> mfspr r11, SPRN_SPRG_THREAD
> lwz r11, RTAS_SP(r11)
> cmpwi cr1, r11, 0
> +#endif
> bne cr1, 7f
> #endif /* CONFIG_PPC_CHRP */
> EXCEPTION_PROLOG_1 for_rtas=1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack
2020-12-23 6:48 ` Christophe Leroy
@ 2020-12-24 1:05 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2020-12-24 1:05 UTC (permalink / raw
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 22/12/2020 à 08:11, Christophe Leroy a écrit :
>> When we have VMAP stack, exception prolog 1 sets r1, not r11.
>
> But exception prolog 1 uses r1 to setup r1 when machine check happens in kernel.
> So r1 must be restored when the branch is not taken. See subsequent patch I just sent out.
OK. This is still on the tip of fixes, so I'll rewind it to drop this
commit, and then apply this and the fixup as one patch next week.
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-24 1:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-22 7:11 [PATCH] powerpc/32s: Fix RTAS machine check with VMAP stack Christophe Leroy
2020-12-22 7:11 ` Christophe Leroy
2020-12-22 13:11 ` Michael Ellerman
2020-12-22 13:11 ` Michael Ellerman
2020-12-23 6:48 ` Christophe Leroy
2020-12-24 1:05 ` Michael Ellerman
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.