Browse Source

refactor(bl31): use elx_panic for sysreg_handler64

When we reach sysreg_handler64 from any trap handling we are entering
this path from lower EL and thus we should be calling lower_el_panic
reporting mechanism to print panic report.

Make report_elx_panic available through assembly func elx_panic which
could be used for reporting any lower_el_panic.

Change-Id: Ieb260cf20ea327a59db84198b2c6a6bfc9ca9537
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
pull/1995/head
Govindraj Raja 2 years ago
parent
commit
17d07a552b
  1. 4
      bl31/aarch64/runtime_exceptions.S
  2. 10
      common/aarch64/debug.S
  3. 13
      docs/getting_started/porting-guide.rst
  4. 4
      include/common/debug.h

4
bl31/aarch64/runtime_exceptions.S

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2022, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -563,7 +563,7 @@ sysreg_handler64:
*/
tst w0, w0
b.mi el3_panic /* negative return value: panic */
b.mi elx_panic /* negative return value: panic */
b.eq 1f /* zero: do not change ELR_EL3 */
/* advance the PC to continue after the instruction */

10
common/aarch64/debug.S

@ -14,6 +14,7 @@
.globl asm_print_newline
.globl asm_assert
.globl el3_panic
.globl elx_panic
/* Since the max decimal input number is 65536 */
#define MAX_DEC_DIVISOR 10000
@ -151,6 +152,14 @@ endfunc asm_print_newline
.section .rodata.panic_str, "aS"
panic_msg: .asciz "PANIC at PC : 0x"
func elx_panic
#if CRASH_REPORTING && defined(IMAGE_BL31)
b report_elx_panic
#endif /* CRASH_REPORTING && IMAGE_BL31 */
b panic_common
endfunc elx_panic
/* ---------------------------------------------------------------------------
* el3_panic assumes that it is invoked from a C Runtime Environment ie a
* valid stack exists. This call will not return.
@ -163,6 +172,7 @@ func el3_panic
b report_el3_panic
#endif /* CRASH_REPORTING && IMAGE_BL31 */
panic_common:
mov x6, x30
bl plat_crash_console_init

13
docs/getting_started/porting-guide.rst

@ -3204,6 +3204,17 @@ as Group 0 secure interrupt, Group 1 secure interrupt or Group 1 NS interrupt.
Common helper functions
-----------------------
Function : elx_panic()
~~~~~~~~~~~~~~~~~~~~~~
::
Argument : void
Return : void
This API is called from assembly files when reporting a critical failure
that has occured in lower EL and is been trapped in EL3. This call
**must not** return.
Function : el3_panic()
~~~~~~~~~~~~~~~~~~~~~~
@ -3539,7 +3550,7 @@ amount of open resources per driver.
--------------
*Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.*
*Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.*
.. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html

4
include/common/debug.h

@ -100,7 +100,7 @@ void backtrace(const char *cookie);
#endif
void __dead2 el3_panic(void);
void __dead2 report_elx_panic(void);
void __dead2 elx_panic(void);
#define panic() \
do { \
@ -118,7 +118,7 @@ void __dead2 report_elx_panic(void);
#define lower_el_panic() \
do { \
console_flush(); \
report_elx_panic(); \
elx_panic(); \
} while (false)
#else
#define lower_el_panic()

Loading…
Cancel
Save