diff --git a/arch/xtensa/src/common/xtensa_irqdispatch.c b/arch/xtensa/src/common/xtensa_irqdispatch.c index 813846e76e8..be494df6e2d 100644 --- a/arch/xtensa/src/common/xtensa_irqdispatch.c +++ b/arch/xtensa/src/common/xtensa_irqdispatch.c @@ -52,6 +52,7 @@ #include "group/group.h" #include "sched/sched.h" +#include "irq/irq.h" /**************************************************************************** * Public Functions @@ -129,6 +130,17 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) (void)group_addrenv(NULL); #endif + +#ifdef CONFIG_SMP + /* In the SMP configuration, critical section management uses a + * "voting" algorithm with current task on each CPU casting its + * "vote" by the state of the TCB irqcount flag. That irqcount + * for the current task on this CPU will be different is a + * context switch occurrred. + */ + + irq_restore_lock(); +#endif } #endif