From 68f102055a9e7aa2045c02cfc3f1d01b4aeef006 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 29 Sep 2020 08:28:34 +0900 Subject: [PATCH] arch: xtensa: Fix up_interrupt_context() for SMP Summary: - Apply the same fix for Arm SMP Impact: - Affects SMP only Testing: - Tested with esp32-core:smp (qemu) Signed-off-by: Masayuki Ishikawa --- arch/xtensa/src/common/xtensa_interruptcontext.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/src/common/xtensa_interruptcontext.c b/arch/xtensa/src/common/xtensa_interruptcontext.c index defed9bd61..61d29a2ee9 100644 --- a/arch/xtensa/src/common/xtensa_interruptcontext.c +++ b/arch/xtensa/src/common/xtensa_interruptcontext.c @@ -59,5 +59,15 @@ bool up_interrupt_context(void) { - return CURRENT_REGS != NULL; +#ifdef CONFIG_SMP + irqstate_t flags = up_irq_save(); +#endif + + bool ret = CURRENT_REGS != NULL; + +#ifdef CONFIG_SMP + up_irq_restore(flags); +#endif + + return ret; }