barrier: add UP_RMB UP_WMB

This commit added linux-style UP_RMB() and UP_WMB().

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2025-09-18 08:48:05 +08:00 • committed by Alan C. Assis
parent 7d01d8aab5
commit c55954d56c
14 changed files with 93 additions and 47 deletions

View file

@ -99,6 +99,46 @@
#define DEBUGPOINT_BREAKPOINT 0x04
#define DEBUGPOINT_STEPPOINT 0x05
/* Memory barriers may be provided in arch/spinlock.h
*
* DMB - Data memory barrier. Assures writes are completed to memory.
* DSB - Data synchronization barrier.
*/
#if !defined(UP_DMB)
# define UP_DMB()
#endif
#if !defined(UP_RMB)
# define UP_RMB()
#endif
#if !defined(UP_WMB)
# define UP_WMB()
#endif
#if !defined(UP_DSB)
# define UP_DSB()
#endif
#if !defined(UP_WFE)
# define UP_WFE()
#endif
#if !defined(UP_SEV)
# define UP_SEV()
#endif
#ifdef CONFIG_SMP
# define SMP_MB() UP_DMB()
# define SMP_RMB() UP_RMB()
# define SMP_WMB() UP_WMB()
#else /* !CONFIG_SMP */
# define SMP_MB() asm volatile ("" : : : "memory")
# define SMP_RMB() asm volatile ("" : : : "memory")
# define SMP_WMB() asm volatile ("" : : : "memory")
#endif
/****************************************************************************
* Name: up_cpu_index
*

View file

@ -50,40 +50,6 @@ extern "C"
#define EXTERN extern
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Memory barriers may be provided in arch/spinlock.h
*
* DMB - Data memory barrier. Assures writes are completed to memory.
* DSB - Data synchronization barrier.
*/
#undef __SP_UNLOCK_FUNCTION
#if !defined(UP_DMB)
# define UP_DMB()
#else
# define __SP_UNLOCK_FUNCTION 1
#endif
#if !defined(UP_DSB)
# define UP_DSB()
#endif
#if !defined(UP_WFE)
# define UP_WFE()
#endif
#if !defined(UP_SEV)
# define UP_SEV()
#endif
#if !defined(__SP_UNLOCK_FUNCTION) && (defined(CONFIG_TICKET_SPINLOCK) || \
defined(CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS))
# define __SP_UNLOCK_FUNCTION 1
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/