[Skiboot] [RFC PATCH 1/2] opal: Fix OPAL entry path to resue callers stack.
Mahesh J Salgaonkar
mahesh at linux.vnet.ibm.com
Tue Feb 21 12:46:31 AEDT 2017
From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
OPAL uses its own stack for each opal call that are made from linux. This
makes OPAL non reentrant. This patch fixes that by using caller's stack
instead of switching to its own.
Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
---
asm/head.S | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/asm/head.S b/asm/head.S
index d7c2821..7efacb7 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -36,6 +36,9 @@
#define GET_CPU() \
clrrdi %r13,%r1,STACK_SHIFT
+#define GET_CPU_REG(stack_reg) \
+ clrrdi %r13,stack_reg,STACK_SHIFT
+
#define SAVE_GPR(reg,sp) std %r##reg,STACK_GPR##reg(sp)
#define REST_GPR(reg,sp) ld %r##reg,STACK_GPR##reg(sp)
@@ -837,9 +840,8 @@ opal_boot_trampoline:
.balign 0x10
.global opal_entry
opal_entry:
- /* Get our per CPU stack */
- mfspr %r12,SPR_PIR
- GET_STACK(%r12,%r12)
+ /* Lets stick to caller's stack. */
+ mr %r12,%r1
stdu %r12,-STACK_FRAMESIZE(%r12)
/* Save caller r1, establish new r1 */
@@ -864,7 +866,9 @@ opal_entry:
std %r12,STACK_LR(%r1)
/* Get the CPU thread */
- GET_CPU()
+ mfspr %r12,SPR_PIR
+ GET_STACK(%r12,%r12)
+ GET_CPU_REG(%r12)
/* Store token in CPU thread */
std %r0,CPUTHREAD_CUR_TOKEN(%r13)
More information about the Skiboot
mailing list