diff options
-rw-r--r-- | src/arch/riscv/include/arch/barrier.h | 2 | ||||
-rw-r--r-- | src/arch/riscv/include/arch/smp/spinlock.h | 4 | ||||
-rw-r--r-- | src/arch/riscv/smp.c | 5 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/arch/riscv/include/arch/barrier.h b/src/arch/riscv/include/arch/barrier.h index 798f879a32..023e8c3acd 100644 --- a/src/arch/riscv/include/arch/barrier.h +++ b/src/arch/riscv/include/arch/barrier.h @@ -7,4 +7,6 @@ static inline void mb(void) { asm volatile("fence"); } static inline void rmb(void) { asm volatile("fence"); } static inline void wmb(void) { asm volatile("fence"); } +#define barrier() { asm volatile ("fence" ::: "memory"); } + #endif /* __ARCH_BARRIER_H__ */ diff --git a/src/arch/riscv/include/arch/smp/spinlock.h b/src/arch/riscv/include/arch/smp/spinlock.h index b316ff078d..968fdc6c70 100644 --- a/src/arch/riscv/include/arch/smp/spinlock.h +++ b/src/arch/riscv/include/arch/smp/spinlock.h @@ -3,11 +3,9 @@ #ifndef ARCH_SMP_SPINLOCK_H #define ARCH_SMP_SPINLOCK_H -#include <arch/encoding.h> +#include <arch/barrier.h> #include <arch/smp/atomic.h> -#define barrier() { asm volatile ("fence" ::: "memory"); } - typedef struct { atomic_t lock; } spinlock_t; diff --git a/src/arch/riscv/smp.c b/src/arch/riscv/smp.c index 1d58602627..0a93763cb0 100644 --- a/src/arch/riscv/smp.c +++ b/src/arch/riscv/smp.c @@ -1,10 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <arch/barrier.h> #include <arch/encoding.h> #include <arch/smp/smp.h> -#include <arch/smp/spinlock.h> -#include <mcall.h> +#include <arch/smp/atomic.h> #include <console/console.h> +#include <mcall.h> void smp_pause(int working_hartid) { |