1 |
commit: 6b75b7fdc950f376e04ff246e6aa583a700e1855 |
2 |
Author: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 25 04:22:54 2022 +0000 |
4 |
Commit: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 28 22:23:09 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b75b7fd |
7 |
|
8 |
dev-libs/userspace-rcu: add support for loong |
9 |
|
10 |
The patch comes from https://github.com/loongarch64/userspace-rcu/pull/2 |
11 |
which is reviewed by the LoongArch community, but not upstreamed yet. |
12 |
|
13 |
This has been inside loongson-overlay for a while, and is tested on real |
14 |
loong hardware. |
15 |
|
16 |
See: https://github.com/gentoo/gentoo/pull/25189 |
17 |
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org> |
18 |
|
19 |
.../files/userspace-rcu-0.13.1-loong.patch | 178 +++++++++++++++++++++ |
20 |
dev-libs/userspace-rcu/userspace-rcu-0.13.1.ebuild | 2 + |
21 |
2 files changed, 180 insertions(+) |
22 |
|
23 |
diff --git a/dev-libs/userspace-rcu/files/userspace-rcu-0.13.1-loong.patch b/dev-libs/userspace-rcu/files/userspace-rcu-0.13.1-loong.patch |
24 |
new file mode 100644 |
25 |
index 000000000000..22daddedb61c |
26 |
--- /dev/null |
27 |
+++ b/dev-libs/userspace-rcu/files/userspace-rcu-0.13.1-loong.patch |
28 |
@@ -0,0 +1,178 @@ |
29 |
+This is https://github.com/loongarch64/userspace-rcu/pull/2, yet to be |
30 |
+upstreamed but already reviewed and accepted by the LoongArch porting |
31 |
+community. |
32 |
+From 213197eea1a711da2f7cc0c04cdf33acb1b3c50e Mon Sep 17 00:00:00 2001 |
33 |
+From: Wang Jing <wangjing@××××××××.cn> |
34 |
+Date: Tue, 8 Jun 2021 19:44:49 +0800 |
35 |
+Subject: [PATCH] Add LoongArch support |
36 |
+ |
37 |
+--- a/LICENSE |
38 |
++++ b/LICENSE |
39 |
+@@ -44,6 +44,7 @@ MIT/X11 (BSD like) license apply to: |
40 |
+ compiler.h |
41 |
+ arch/s390.h |
42 |
+ uatomic/alpha.h |
43 |
++uatomic/loongarch.h |
44 |
+ uatomic/mips.h |
45 |
+ uatomic/nios2.h |
46 |
+ uatomic/s390.h |
47 |
+--- a/README.md |
48 |
++++ b/README.md |
49 |
+@@ -51,6 +51,7 @@ Currently, the following architectures are supported: |
50 |
+ - hppa/PA-RISC |
51 |
+ - m68k |
52 |
+ - RISC-V |
53 |
++ - LoongArch |
54 |
+ |
55 |
+ Tested on: |
56 |
+ |
57 |
+--- a/include/Makefile.am |
58 |
++++ b/include/Makefile.am |
59 |
+@@ -7,6 +7,7 @@ nobase_include_HEADERS = \ |
60 |
+ urcu/arch.h \ |
61 |
+ urcu/arch/hppa.h \ |
62 |
+ urcu/arch/ia64.h \ |
63 |
++ urcu/arch/loongarch.h \ |
64 |
+ urcu/arch/m68k.h \ |
65 |
+ urcu/arch/mips.h \ |
66 |
+ urcu/arch/nios2.h \ |
67 |
+@@ -67,6 +68,7 @@ nobase_include_HEADERS = \ |
68 |
+ urcu/uatomic.h \ |
69 |
+ urcu/uatomic/hppa.h \ |
70 |
+ urcu/uatomic/ia64.h \ |
71 |
++ urcu/uatomic/loongarch.h \ |
72 |
+ urcu/uatomic/m68k.h \ |
73 |
+ urcu/uatomic/mips.h \ |
74 |
+ urcu/uatomic/nios2.h \ |
75 |
+--- a/include/urcu/arch.h |
76 |
++++ b/include/urcu/arch.h |
77 |
+@@ -49,6 +49,7 @@ |
78 |
+ * URCU_ARCH_HPPA : All HP PA-RISC variants |
79 |
+ * URCU_ARCH_M68K : All Motorola 68000 variants |
80 |
+ * URCU_ARCH_RISCV : All RISC-V variants |
81 |
++ * URCU_ARCH_LOONGARCH : All LoongArch variants |
82 |
+ */ |
83 |
+ |
84 |
+ #if (defined(__INTEL_OFFLOAD) || defined(__TARGET_ARCH_MIC) || defined(__MIC__)) |
85 |
+@@ -157,6 +158,11 @@ |
86 |
+ #define URCU_ARCH_RISCV 1 |
87 |
+ #include <urcu/arch/riscv.h> |
88 |
+ |
89 |
++#elif defined(__loongarch__) |
90 |
++ |
91 |
++#define URCU_ARCH_LOONGARCH 1 |
92 |
++#include <urcu/arch/loongarch.h> |
93 |
++ |
94 |
+ #else |
95 |
+ #error "Cannot build: unrecognized architecture, see <urcu/arch.h>." |
96 |
+ #endif |
97 |
+--- /dev/null |
98 |
++++ b/include/urcu/arch/loongarch.h |
99 |
+@@ -0,0 +1,49 @@ |
100 |
++#ifndef _URCU_ARCH_LOONGARCH_H |
101 |
++#define _URCU_ARCH_LOONGARCH_H |
102 |
++ |
103 |
++/* |
104 |
++ * arch/loongarch.h: trivial definitions for the LoongArch architecture. |
105 |
++ * |
106 |
++ * Copyright (c) 2021 Wang Jing <wangjing@××××××××.cn> |
107 |
++ * |
108 |
++ * This library is free software; you can redistribute it and/or |
109 |
++ * modify it under the terms of the GNU Lesser General Public |
110 |
++ * License as published by the Free Software Foundation; either |
111 |
++ * version 2.1 of the License, or (at your option) any later version. |
112 |
++ * |
113 |
++ * This library is distributed in the hope that it will be useful, |
114 |
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
115 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
116 |
++ * Lesser General Public License for more details. |
117 |
++ * |
118 |
++ * You should have received a copy of the GNU Lesser General Public |
119 |
++ * License along with this library; if not, write to the Free Software |
120 |
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
121 |
++ */ |
122 |
++ |
123 |
++#include <urcu/compiler.h> |
124 |
++#include <urcu/config.h> |
125 |
++#include <urcu/syscall-compat.h> |
126 |
++ |
127 |
++#ifdef __cplusplus |
128 |
++extern "C" { |
129 |
++#endif |
130 |
++ |
131 |
++#include <stdlib.h> |
132 |
++#include <sys/time.h> |
133 |
++ |
134 |
++/* |
135 |
++ * On Linux, define the membarrier system call number if not yet available in |
136 |
++ * the system headers. |
137 |
++ */ |
138 |
++#if (defined(__linux__) && !defined(__NR_membarrier)) |
139 |
++#define __NR_membarrier 283 |
140 |
++#endif |
141 |
++ |
142 |
++#ifdef __cplusplus |
143 |
++} |
144 |
++#endif |
145 |
++ |
146 |
++#include <urcu/arch/generic.h> |
147 |
++ |
148 |
++#endif /* _URCU_ARCH_LOONGARCH_H */ |
149 |
+--- a/include/urcu/uatomic.h |
150 |
++++ b/include/urcu/uatomic.h |
151 |
+@@ -51,6 +51,8 @@ |
152 |
+ #include <urcu/uatomic/m68k.h> |
153 |
+ #elif defined(URCU_ARCH_RISCV) |
154 |
+ #include <urcu/uatomic/riscv.h> |
155 |
++#elif defined(URCU_ARCH_LOONGARCH) |
156 |
++#include <urcu/uatomic/loongarch.h> |
157 |
+ #else |
158 |
+ #error "Cannot build: unrecognized architecture, see <urcu/arch.h>." |
159 |
+ #endif |
160 |
+--- /dev/null |
161 |
++++ b/include/urcu/uatomic/loongarch.h |
162 |
+@@ -0,0 +1,44 @@ |
163 |
++#ifndef _URCU_UATOMIC_ARCH_LOONGARCH_H |
164 |
++#define _URCU_UATOMIC_ARCH_LOONGARCH_H |
165 |
++ |
166 |
++/* |
167 |
++ * Atomic exchange operations for the LoongArch architecture. Let GCC do it. |
168 |
++ * |
169 |
++ * Copyright (c) 2021 Wang Jing <wangjing@××××××××.cn> |
170 |
++ * |
171 |
++ * Permission is hereby granted, free of charge, to any person obtaining a copy |
172 |
++ * of this software and associated documentation files (the "Software"), to |
173 |
++ * deal in the Software without restriction, including without limitation the |
174 |
++ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
175 |
++ * sell copies of the Software, and to permit persons to whom the Software is |
176 |
++ * furnished to do so, subject to the following conditions: |
177 |
++ * |
178 |
++ * The above copyright notice and this permission notice shall be included in |
179 |
++ * all copies or substantial portions of the Software. |
180 |
++ * |
181 |
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
182 |
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
183 |
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
184 |
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
185 |
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
186 |
++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
187 |
++ * IN THE SOFTWARE. |
188 |
++ */ |
189 |
++ |
190 |
++#include <urcu/compiler.h> |
191 |
++#include <urcu/system.h> |
192 |
++ |
193 |
++#ifdef __cplusplus |
194 |
++extern "C" { |
195 |
++#endif |
196 |
++ |
197 |
++#define UATOMIC_HAS_ATOMIC_BYTE |
198 |
++#define UATOMIC_HAS_ATOMIC_SHORT |
199 |
++ |
200 |
++#ifdef __cplusplus |
201 |
++} |
202 |
++#endif |
203 |
++ |
204 |
++#include <urcu/uatomic/generic.h> |
205 |
++ |
206 |
++#endif /* _URCU_UATOMIC_ARCH_LOONGARCH_H */ |
207 |
|
208 |
diff --git a/dev-libs/userspace-rcu/userspace-rcu-0.13.1.ebuild b/dev-libs/userspace-rcu/userspace-rcu-0.13.1.ebuild |
209 |
index 598ded04cf70..ab5f96219bd5 100644 |
210 |
--- a/dev-libs/userspace-rcu/userspace-rcu-0.13.1.ebuild |
211 |
+++ b/dev-libs/userspace-rcu/userspace-rcu-0.13.1.ebuild |
212 |
@@ -19,6 +19,7 @@ BDEPEND="test? ( sys-process/time )" |
213 |
|
214 |
PATCHES=( |
215 |
"${FILESDIR}"/${PN}-0.13.1-tests-no-benchmark.patch |
216 |
+ "${FILESDIR}"/${PN}-0.13.1-loong.patch |
217 |
) |
218 |
|
219 |
src_prepare() { |
220 |
@@ -26,6 +27,7 @@ src_prepare() { |
221 |
|
222 |
# Needed for tests patch |
223 |
# ... and refresh libtool (see https://github.com/gentoo/gentoo/pull/23973) |
224 |
+ # ... and for build on loong (see https://github.com/gentoo/gentoo/pull/25189) |
225 |
eautoreconf |
226 |
} |