xref: /dpdk/lib/eal/x86/include/rte_rtm.h (revision d92745a99b17ab7599eb43e14e0d8f476ddf8d92)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2012,2013 Intel Corporation
3  */
4 
5 #ifndef _RTE_RTM_H_
6 #define _RTE_RTM_H_ 1
7 
8 #include <immintrin.h>
9 
10 /* Official RTM intrinsics interface matching gcc/icc, but works
11    on older gcc compatible compilers and binutils. */
12 
13 #include <rte_common.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 
20 #define RTE_XBEGIN_STARTED		(~0u)
21 #define RTE_XABORT_EXPLICIT		(1 << 0)
22 #define RTE_XABORT_RETRY		(1 << 1)
23 #define RTE_XABORT_CONFLICT		(1 << 2)
24 #define RTE_XABORT_CAPACITY		(1 << 3)
25 #define RTE_XABORT_DEBUG		(1 << 4)
26 #define RTE_XABORT_NESTED		(1 << 5)
27 #define RTE_XABORT_CODE(x)		(((x) >> 24) & 0xff)
28 
29 static __rte_always_inline
rte_xbegin(void)30 unsigned int rte_xbegin(void)
31 {
32 	return _xbegin();
33 }
34 
35 static __rte_always_inline
rte_xend(void)36 void rte_xend(void)
37 {
38 	_xend();
39 }
40 
41 /* not an inline function to workaround a clang bug with -O0 */
42 #define rte_xabort(status) _xabort(status)
43 
44 static __rte_always_inline
rte_xtest(void)45 int rte_xtest(void)
46 {
47 	return _xtest();
48 }
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* _RTE_RTM_H_ */
55