Skip to content

Commit

Permalink
core/opal: allow some re-entrant calls
Browse files Browse the repository at this point in the history
This allows a small number of OPAL calls to succeed despite re-entering
the firmware, and rejects others rather than aborting.

This allows a system reset interrupt that interrupts OPAL to do something
useful. Sreset other CPUs, use the console, which allows xmon to work or
stack traces to be printed, reboot the system.

Use OPAL_INTERNAL_ERROR when rejecting, rather than OPAL_BUSY, which is
used for many other things that does not mean a serious permanent error.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
npiggin authored and stewartsmith committed Mar 22, 2018
1 parent 884f97b commit 82fd5d0
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions core/opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,22 @@ int64_t opal_entry_check(struct stack_frame *eframe)
return opal_bad_token(token);

if (!opal_quiesce_state && cpu->in_opal_call) {
printf("CPU ATTEMPT TO RE-ENTER FIRMWARE! PIR=%04lx cpu @%p -> pir=%04x token=%llu\n",
mfspr(SPR_PIR), cpu, cpu->pir, token);
abort();
switch (token) {
case OPAL_CONSOLE_READ:
case OPAL_CONSOLE_WRITE:
case OPAL_CONSOLE_WRITE_BUFFER_SPACE:
case OPAL_CONSOLE_FLUSH:
case OPAL_POLL_EVENTS:
case OPAL_CHECK_TOKEN:
case OPAL_CEC_REBOOT:
case OPAL_CEC_REBOOT2:
case OPAL_SIGNAL_SYSTEM_RESET:
break;
default:
printf("CPU ATTEMPT TO RE-ENTER FIRMWARE! PIR=%04lx cpu @%p -> pir=%04x token=%llu\n",
mfspr(SPR_PIR), cpu, cpu->pir, token);
return OPAL_INTERNAL_ERROR;
}
}

again:
Expand Down

0 comments on commit 82fd5d0

Please sign in to comment.