blob: 8ba685cfe135a524829f1a3c2282bb2ee4d3a7d1 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From 780fd27ea6f7f2c446c46a7a5e26d94106c67efd Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: "Richard W.M. Jones" <rjones@redhat.com>
3Date: Sun, 20 Nov 2016 15:04:52 +0000
4Subject: [PATCH] Add support for RISC-V.
5
6The architecture is sufficiently similar to aarch64 that simply
7extending the existing aarch64 macro works.
8---
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06009 src/include/storage/s_lock.h | 6 +++---
10 1 file changed, 3 insertions(+), 3 deletions(-)
Brad Bishop19323692019-04-05 15:28:33 -040011
Andrew Geissler595f6302022-01-24 19:11:47 +000012diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060013index 4d3ffc7..22e27bf 100644
Brad Bishop19323692019-04-05 15:28:33 -040014--- a/src/include/storage/s_lock.h
15+++ b/src/include/storage/s_lock.h
Andrew Geissler595f6302022-01-24 19:11:47 +000016@@ -317,11 +317,12 @@ tas(volatile slock_t *lock)
Brad Bishop19323692019-04-05 15:28:33 -040017
18 /*
19 * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available.
20+ * On RISC-V, the same.
21 *
22 * We use the int-width variant of the builtin because it works on more chips
23 * than other widths.
24 */
25-#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64)
26+#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__riscv)
27 #ifdef HAVE_GCC__SYNC_INT32_TAS
28 #define HAS_TEST_AND_SET
29
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060030@@ -355,8 +356,7 @@ spin_delay(void)
Brad Bishop19323692019-04-05 15:28:33 -040031
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060032 #endif /* __aarch64__ || __aarch64 */
Brad Bishop19323692019-04-05 15:28:33 -040033 #endif /* HAVE_GCC__SYNC_INT32_TAS */
34-#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060035-
Brad Bishop19323692019-04-05 15:28:33 -040036+#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */
37
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060038 /* S/390 and S/390x Linux (32- and 64-bit zSeries) */
39 #if defined(__s390__) || defined(__s390x__)
Andrew Geissler595f6302022-01-24 19:11:47 +000040--
412.34.1
42