1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2015 RehiveTech. All rights reserved. 3 * Copyright(c) 2022 StarFive 4 * Copyright(c) 2022 SiFive 5 * Copyright(c) 2022 Semihalf 6 */ 7 8 #ifndef RTE_SPINLOCK_RISCV_H 9 #define RTE_SPINLOCK_RISCV_H 10 11 #ifndef RTE_FORCE_INTRINSICS 12 # error Platform must be built with RTE_FORCE_INTRINSICS 13 #endif 14 15 #include <rte_common.h> 16 #include "generic/rte_spinlock.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 static inline int rte_tm_supported(void) 23 { 24 return 0; 25 } 26 27 static inline void 28 rte_spinlock_lock_tm(rte_spinlock_t *sl) 29 { 30 rte_spinlock_lock(sl); /* fall-back */ 31 } 32 33 static inline int 34 rte_spinlock_trylock_tm(rte_spinlock_t *sl) 35 { 36 return rte_spinlock_trylock(sl); 37 } 38 39 static inline void 40 rte_spinlock_unlock_tm(rte_spinlock_t *sl) 41 { 42 rte_spinlock_unlock(sl); 43 } 44 45 static inline void 46 rte_spinlock_recursive_lock_tm(rte_spinlock_recursive_t *slr) 47 { 48 rte_spinlock_recursive_lock(slr); /* fall-back */ 49 } 50 51 static inline void 52 rte_spinlock_recursive_unlock_tm(rte_spinlock_recursive_t *slr) 53 { 54 rte_spinlock_recursive_unlock(slr); 55 } 56 57 static inline int 58 rte_spinlock_recursive_trylock_tm(rte_spinlock_recursive_t *slr) 59 { 60 return rte_spinlock_recursive_trylock(slr); 61 } 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif /* RTE_SPINLOCK_RISCV_H */ 68