mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-14 02:00:27 +00:00
Follow multi-arch design, implement the mandatory arch barrier functions declared in common barrier.h for risc-v support. Tracked-On: #8803 Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> Co-developed-by: Haoyu Tang <haoyu.tang@intel.com> Signed-off-by: Haoyu Tang <haoyu.tang@intel.com> Reviewed-by: Yifan Liu <yifan1.liu@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
29 lines
684 B
C
29 lines
684 B
C
/*
|
|
* Copyright (C) 2023-2025 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
* Authors:
|
|
* Haicheng Li <haicheng.li@intel.com>
|
|
*/
|
|
|
|
#ifndef RISCV_LIB_BARRIER_H
|
|
#define RISCV_LIB_BARRIER_H
|
|
/* Synchronizes all read accesses to/from memory */
|
|
static inline void arch_cpu_read_memory_barrier(void)
|
|
{
|
|
asm volatile ("fence r,r" : : : "memory");
|
|
}
|
|
|
|
static inline void arch_cpu_write_memory_barrier(void)
|
|
{
|
|
asm volatile ("fence w,w" : : : "memory");
|
|
}
|
|
|
|
/* Synchronizes all read and write accesses to/from memory */
|
|
static inline void arch_cpu_memory_barrier(void)
|
|
{
|
|
asm volatile ("fence rw,rw" : : : "memory");
|
|
}
|
|
#endif /* RISCV_LIB_BARRIER_H */
|