summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGovindraj Raja <govindraj.raja@arm.com>2023-02-21 17:43:55 +0000
committerGovindraj Raja <govindraj.raja@arm.com>2023-02-22 17:24:17 +0000
commit17d07a552b396a282eed52bfd6bac01052a1a978 (patch)
tree4e25d36c832685281f74ac951c305a34a73e9f1c
parentbd62ce98d2c9ef164456c6477b2e21172165dc11 (diff)
downloadarm-trusted-firmware-17d07a552b396a282eed52bfd6bac01052a1a978.tar.gz
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>
-rw-r--r--bl31/aarch64/runtime_exceptions.S4
-rw-r--r--common/aarch64/debug.S12
-rw-r--r--docs/getting_started/porting-guide.rst13
-rw-r--r--include/common/debug.h4
4 files changed, 27 insertions, 6 deletions
diff --git a/bl31/aarch64/runtime_exceptions.S b/bl31/aarch64/runtime_exceptions.S
index cf79361c2..2f00e7a85 100644
--- a/bl31/aarch64/runtime_exceptions.S
+++ b/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 */
diff --git a/common/aarch64/debug.S b/common/aarch64/debug.S
index 82d57d7ab..8768a1f74 100644
--- a/common/aarch64/debug.S
+++ b/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
@@ -189,4 +199,4 @@ _panic_handler:
mov x30, x6
b plat_panic_handler
-endfunc el3_panic \ No newline at end of file
+endfunc el3_panic
diff --git a/docs/getting_started/porting-guide.rst b/docs/getting_started/porting-guide.rst
index 98568cd7a..6ac284bec 100644
--- a/docs/getting_started/porting-guide.rst
+++ b/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
diff --git a/include/common/debug.h b/include/common/debug.h
index e0b3a1c67..5ea541da0 100644
--- a/include/common/debug.h
+++ b/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()