-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvdo-6.2.4-e2k.patch
81 lines (75 loc) · 2.31 KB
/
vdo-6.2.4-e2k.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From ef3da1cb3a40733c0bf3cffb5792de5b7f0c215a Mon Sep 17 00:00:00 2001
From: Ilya Kurdyukov <[email protected]>
Date: Wed, 24 Mar 2021 18:05:12 +0700
Subject: [PATCH] vdo-6.2.4 e2k support
---
utils/uds/atomicDefs.h | 13 +++++++++++--
utils/uds/cpu.h | 2 +-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/utils/uds/atomicDefs.h b/utils/uds/atomicDefs.h
index 4b7a655..5091f1a 100644
--- a/utils/uds/atomicDefs.h
+++ b/utils/uds/atomicDefs.h
@@ -24,6 +24,9 @@
#include "compiler.h"
#include "typeDefs.h"
+#ifdef __e2k__
+#include <x86intrin.h>
+#endif
// The atomic interfaces are chosen to exactly match those interfaces defined
// by the Linux kernel. This is the matching user-mode implementation.
@@ -96,6 +99,8 @@ static INLINE void smp_mb(void)
__asm__ __volatile__("bcr 14,0" : : : "memory");
#elif defined __PPC__
__asm__ __volatile__("sync" : : : "memory");
+#elif defined __e2k__
+ __builtin_ia32_mfence();
#else
#error "no fence defined"
#endif
@@ -121,6 +126,8 @@ static INLINE void smp_rmb(void)
__asm__ __volatile__("bcr 14,0" : : : "memory");
#elif defined __PPC__
__asm__ __volatile__("lwsync" : : : "memory");
+#elif defined __e2k__
+ __builtin_ia32_lfence();
#else
#error "no fence defined"
#endif
@@ -146,6 +153,8 @@ static INLINE void smp_wmb(void)
__asm__ __volatile__("bcr 14,0" : : : "memory");
#elif defined __PPC__
__asm__ __volatile__("lwsync" : : : "memory");
+#elif defined __e2k__
+ __builtin_ia32_sfence();
#else
#error "no fence defined"
#endif
@@ -172,11 +181,11 @@ static INLINE void smp_mb__before_atomic(void)
static INLINE void smp_read_barrier_depends(void)
{
#if defined(__x86_64__) || defined(__PPC__) || defined(__s390__) \
- || defined(__aarch64__)
+ || defined(__aarch64__) || defined(__e2k__)
// Nothing needed for these architectures.
#else
// Default to playing it safe.
- rmb();
+ smp_rmb();
#endif
}
diff --git a/utils/uds/cpu.h b/utils/uds/cpu.h
index 9314985..021b0ef 100644
--- a/utils/uds/cpu.h
+++ b/utils/uds/cpu.h
@@ -36,7 +36,7 @@
#define CACHE_LINE_BYTES 128
#elif defined(__s390x__)
#define CACHE_LINE_BYTES 256
-#elif defined(__x86_64__) || defined(__aarch64__)
+#elif defined(__x86_64__) || defined(__aarch64__) || defined(__e2k__)
#define CACHE_LINE_BYTES 64
#else
#error "unknown cache line size"
--
2.17.1