Commit 2a9c4f40 authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman

powerpc/powernv: Fix opal tracepoints with JUMP_LABEL=n

The recent commit to allow calling OPAL calls in real mode, commit
ab9bad0e ("powerpc/powernv: Remove separate entry for OPAL real mode
calls"), introduced a bug when CONFIG_JUMP_LABEL=n.

The commit moved the "mfmsr r12" prior to the call to OPAL_BRANCH, but
we missed that OPAL_BRANCH clobbers r12 when jump labels are disabled.
This leads to us using the tracepoint refcount as the MSR value,
typically zero, and saving that into PACASAVEDMSR. When we return from
OPAL we use that value as the MSR value for rfid, meaning we switch to
32-bit BE real mode - hilarity ensues.

Fix it by using r11 in OPAL_BRANCH, which is not live at the time the
macro is used in OPAL_CALL.

Fixes: ab9bad0e ("powerpc/powernv: Remove separate entry for OPAL real mode calls")
Suggested-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 3fb66a70
...@@ -39,8 +39,8 @@ opal_tracepoint_refcount: ...@@ -39,8 +39,8 @@ opal_tracepoint_refcount:
BEGIN_FTR_SECTION; \ BEGIN_FTR_SECTION; \
b 1f; \ b 1f; \
END_FTR_SECTION(0, 1); \ END_FTR_SECTION(0, 1); \
ld r12,opal_tracepoint_refcount@toc(r2); \ ld r11,opal_tracepoint_refcount@toc(r2); \
cmpdi r12,0; \ cmpdi r11,0; \
bne- LABEL; \ bne- LABEL; \
1: 1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment