arch: arm: Fix up_interrupt_context() for SMP

Summary:
- I found an issue with up_interrupt_context() when testing.
- And finally found that up_interrupt_context() is not atomic.
- This commit fixes the issue

Impact:
- Affects SMP only

Testing:
- Tested with spresense:wifi_smp and sabre-6quad:smp (qemu)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2020-09-29 08:17:17 +09:00 committed by patacongo
parent 22b837f440
commit bbc6571b28

View file

@ -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;
}