spin_lock_irqsave() and spin_unlock_irqrestore() are only valid if the CPU supports global disabling of interrupts.

This commit is contained in:
Gregory Nutt 2018-02-04 15:41:22 -06:00
parent 5c5d19f1c8
commit 5beab6fbf0
5 changed files with 16 additions and 2 deletions

View File

@ -210,6 +210,10 @@ config ARCH_HAVE_RTC_SUBSECONDS
bool
default n
config ARCH_GLOBAL_IRQDISABLE
bool
defautl n
config ARCH_USE_MMU
bool "Enable MMU"
default n

View File

@ -107,6 +107,7 @@ config ARCH_CHIP_LC823450
select ARCH_HAVE_HEAPCHECK
select ARCH_HAVE_MULTICPU
select ARCH_HAVE_I2CRESET
select ARCH_GLOBAL_IRQDISABLE
---help---
ON Semiconductor LC823450 architectures (ARM dual Cortex-M3)

View File

@ -247,7 +247,8 @@ void leave_critical_section(irqstate_t flags);
*
****************************************************************************/
#if defined (CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ)
#if defined(CONFIG_SMP) && defined(CONFIG_SPINLOCK_IRQ) && \
defined(CONFIG_ARCH_GLOBAL_IRQDISABLE)
irqstate_t spin_lock_irqsave(void);
#else
# define spin_lock_irqsave(f) enter_critical_section(f)
@ -275,7 +276,8 @@ irqstate_t spin_lock_irqsave(void);
*
****************************************************************************/
#if defined (CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ)
#if defined(CONFIG_SMP) && defined(CONFIG_SPINLOCK_IRQ) && \
defined(CONFIG_ARCH_GLOBAL_IRQDISABLE)
void spin_unlock_irqrestore(irqstate_t flags);
#else
# define spin_unlock_irqrestore(f) leave_critical_section(f)

View File

@ -38,8 +38,10 @@ CSRCS += irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c
ifeq ($(CONFIG_SMP),y)
CSRCS += irq_csection.c
ifeq ($(CONFIG_SPINLOCK_IRQ),y)
ifeq ($(CONFIG_ARCH_GLOBAL_IRQDISABLE),y)
CSRCS += irq_spinlock.c
endif
endif
else ifeq ($(CONFIG_SCHED_INSTRUMENTATION_CSECTION),y)
CSRCS += irq_csection.c
endif

View File

@ -45,6 +45,9 @@
#include "sched/sched.h"
#if defined(CONFIG_SMP) && defined (CONFIG_SPINLOCK_IRQ) && \
defined(CONFIG_ARCH_GLOBAL_IRQDISABLE)
/****************************************************************************
* Public Data
****************************************************************************/
@ -138,3 +141,5 @@ void spin_unlock_irqrestore(irqstate_t flags)
up_irq_restore(flags);
}
#endif /* CONFIG_SMP && CONFIG_SPINLOCK_IRQ && CONFIG_ARCH_GLOBAL_IRQDISABLE */