Skip to content

Commit

Permalink
core: panic(): avoid panic in panic
Browse files Browse the repository at this point in the history
When configured with CFG_HALT_CORES_ON_PANIC=y panic() sends a secure
SGI to all other CPUs to trap all of them, but if interrupts haven't
been configured yet it triggers a cascade of panics. So add a check to
see if interrupts are configured before trying to trap the other CPUs.

Fixes: 2b719df ("core: interrupt: halt other cores when one is panicking")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
  • Loading branch information
jenswi-linaro authored and jforissier committed Dec 1, 2023
1 parent 245a552 commit 01ef3c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ DECLARE_KEEP_PAGER(multi_core_panic_handler);

static void notify_other_cores(void)
{
interrupt_raise_sgi(interrupt_get_main_chip(),
CFG_HALT_CORES_ON_PANIC_SGI,
ITR_CPU_MASK_TO_OTHER_CPUS);
struct itr_chip *chip = interrupt_get_main_chip_may_fail();

if (chip)
interrupt_raise_sgi(chip, CFG_HALT_CORES_ON_PANIC_SGI,
ITR_CPU_MASK_TO_OTHER_CPUS);
else
EMSG("Can't notify other cores, main interrupt chip not set");
}

static TEE_Result init_multi_core_panic_handler(void)
Expand Down

0 comments on commit 01ef3c7

Please sign in to comment.