mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-13 17:34:12 +00:00
hv: multi-arch add RISC-V barrier library implementation
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>
This commit is contained in:
committed by
acrnsi-robot
parent
f67a437e5a
commit
090aaf4c34
@@ -12,9 +12,9 @@
|
||||
#include <lib/util.h>
|
||||
#include <debug/logmsg.h>
|
||||
#include <board_info.h>
|
||||
#include <barrier.h>
|
||||
|
||||
#define barrier() __asm__ __volatile__("fence": : :"memory")
|
||||
#define cpu_relax() barrier() /* TODO: replace with yield instruction */
|
||||
#define cpu_relax() cpu_memory_barrier() /* TODO: replace with yield instruction */
|
||||
#define NR_CPUS MAX_PCPU_NUM
|
||||
|
||||
#define LONG_BYTEORDER 3
|
||||
|
||||
28
hypervisor/include/arch/riscv/asm/lib/barrier.h
Normal file
28
hypervisor/include/arch/riscv/asm/lib/barrier.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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 */
|
||||
Reference in New Issue
Block a user