aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaibhav Jain <vaibhav@linux.vnet.ibm.com>2018-04-27 14:30:07 +0530
committerStewart Smith <stewart@linux.ibm.com>2018-04-29 19:41:25 -0500
commit8ed37072c07ee0c8be2ed8d9e2ede19333856e86 (patch)
tree26900cf9269b3e16b3a6a2d5802a424009e4cb29
parentd32ddea94ba6299a28649a40ccff53c4a4176eb3 (diff)
downloadskiboot-8ed37072c07ee0c8be2ed8d9e2ede19333856e86.zip
skiboot-8ed37072c07ee0c8be2ed8d9e2ede19333856e86.tar.gz
skiboot-8ed37072c07ee0c8be2ed8d9e2ede19333856e86.tar.bz2
asm/head: Fix comparison in opal_entry for switching to emergency
Commit 3fdd2629516d ("core/opal: Emergency stack for re-entry") introduced an emergency stack for re-entrant OPAL calls. A branch was added in opal_entry() that switches to emergency stack checks if current thread is already in an active opal call. However the conditional branch that checks the value cpu_thread->in_opal_call is reverse forcing the use of emergency stack in even in non re-entrant cases. This causes a opal stack guard routine __mcount_stack_check() to falsely assume that stack is overflown as stack pointer of EMERGENCY_STACK is compared against the bounds of NORMAL_STACK, forcing the function to call abort() with an error message of this form: INIT: Starting kernel at 0x20010000, fdt at 0x3073f708 53664 bytes) CPU 0004 Stack overflow detected ! pc=3001d8ec sp=31c27c90 (gap=30488) token=70 Aborting! CPU 0004 Backtrace: S: 0000000031c27b20 R: 000000003001ca2c E ._abort+0x60 S: 0000000031c27bb0 R: 0000000030013e10 E .__mcount_stack_check+0x168 S: 0000000031c27c90 R: 000000003001d8ec E .opal_entry_check+0x1c S: 0000000031c27d20 R: 00000000300051a4 E opal_entry+0xf4 --- OPAL call token: 0x46 caller R1: 0xc0000000011e3e50 --- So this patch update the 'bne' branch in opal_entry() to 'bgt' branch so that switch to emergency stack only happens when current cpu_thread->is_opal_call is greater than 1 indicating an re-entrant opal call. Fixes: 3fdd2629516d ("core/opal: Emergency stack for re-entry") Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com> Signed-off-by: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--asm/head.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/asm/head.S b/asm/head.S
index 48d3acb..2cf4a6b 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -1023,7 +1023,7 @@ opal_entry:
cmpwi %r11,1
mfspr %r12,SPR_PIR
- beq 5f
+ bgt 5f
GET_STACK(%r12,%r12)
b 6f
5: