!15 Add riscv64 support
From: @misaka00251 Reviewed-by: @dillon_chen Signed-off-by: @dillon_chen
This commit is contained in:
commit
89c3e2ea58
85
DCF-1.0.0-add-riscv64-support.patch
Normal file
85
DCF-1.0.0-add-riscv64-support.patch
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
From 645a5d63a1cbf866babdce9eade8d5719f62a7fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: misaka00251 <liuxin@iscas.ac.cn>
|
||||||
|
Date: Fri, 28 Jul 2023 15:19:20 +0800
|
||||||
|
Subject: [PATCH] Add riscv64 support
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 2 +-
|
||||||
|
src/common/cm_concurrency/cm_spinlock.h | 2 +-
|
||||||
|
src/common/cm_concurrency/cm_thread.c | 2 +-
|
||||||
|
src/common/cm_utils/cm_checksum.h | 2 +-
|
||||||
|
src/common/cm_utils/cm_memory.h | 6 ++++++
|
||||||
|
5 files changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 0380198..89d8551 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -89,7 +89,7 @@ if (UNIX)
|
||||||
|
|
||||||
|
add_compile_options(-mtune=cortex-a72 -fsigned-char -g -ggdb3 -march=armv8-a+crc -funwind-tables)
|
||||||
|
else ()
|
||||||
|
- add_compile_options(-msse4.2 )
|
||||||
|
+ add_compile_options()
|
||||||
|
endif ()
|
||||||
|
Add_Definitions(-DWSEC_COMPILE_CAC_OPENSSL -DWSEC_AES_GCM_SUPPORT -DWSEC_USE_OPENSSL_110)
|
||||||
|
else ()
|
||||||
|
diff --git a/src/common/cm_concurrency/cm_spinlock.h b/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
index 7965853..c7ef986 100644
|
||||||
|
--- a/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
+++ b/src/common/cm_concurrency/cm_spinlock.h
|
||||||
|
@@ -37,7 +37,7 @@ extern "C" {
|
||||||
|
|
||||||
|
typedef volatile uint32 spinlock_t;
|
||||||
|
typedef volatile uint32 ip_spinlock_t;
|
||||||
|
-#if defined(__arm__) || defined(__aarch64__)
|
||||||
|
+#if defined(__arm__) || defined(__aarch64__) || defined(_riscv)
|
||||||
|
#define GS_INIT_SPIN_LOCK(lock) \
|
||||||
|
{ \
|
||||||
|
__atomic_store_n(&lock, 0, __ATOMIC_SEQ_CST); \
|
||||||
|
diff --git a/src/common/cm_concurrency/cm_thread.c b/src/common/cm_concurrency/cm_thread.c
|
||||||
|
index 2d0aa2a..fd5f0f1 100644
|
||||||
|
--- a/src/common/cm_concurrency/cm_thread.c
|
||||||
|
+++ b/src/common/cm_concurrency/cm_thread.c
|
||||||
|
@@ -294,7 +294,7 @@ uint32 cm_get_current_thread_id()
|
||||||
|
{
|
||||||
|
#if (defined __x86_64__)
|
||||||
|
#define __SYS_GET_SPID 186
|
||||||
|
-#elif (defined __aarch64__)
|
||||||
|
+#elif (defined __aarch64__) || defined(__riscv)
|
||||||
|
#define __SYS_GET_SPID 178
|
||||||
|
#endif
|
||||||
|
#define gettid() syscall(__SYS_GET_SPID)
|
||||||
|
diff --git a/src/common/cm_utils/cm_checksum.h b/src/common/cm_utils/cm_checksum.h
|
||||||
|
index 85bb9fa..06e60ca 100644
|
||||||
|
--- a/src/common/cm_utils/cm_checksum.h
|
||||||
|
+++ b/src/common/cm_utils/cm_checksum.h
|
||||||
|
@@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
#include "cm_defs.h"
|
||||||
|
|
||||||
|
-#if defined(__arm__) || defined(__aarch64__)
|
||||||
|
+#if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
|
||||||
|
#ifdef __has_include
|
||||||
|
#if __has_include(<arm_acle.h>)
|
||||||
|
#include <arm_acle.h>
|
||||||
|
diff --git a/src/common/cm_utils/cm_memory.h b/src/common/cm_utils/cm_memory.h
|
||||||
|
index 988b78e..05520a6 100644
|
||||||
|
--- a/src/common/cm_utils/cm_memory.h
|
||||||
|
+++ b/src/common/cm_utils/cm_memory.h
|
||||||
|
@@ -56,6 +56,12 @@ extern "C" {
|
||||||
|
__asm__ volatile("dmb ish" :: \
|
||||||
|
: "memory"); \
|
||||||
|
}
|
||||||
|
+#elif defined(__riscv)
|
||||||
|
+#define CM_MFENCE \
|
||||||
|
+ { \
|
||||||
|
+ __asm__ volatile("fence " iorw "," iorw :: \
|
||||||
|
+ : "memory"); \
|
||||||
|
+ }
|
||||||
|
#else
|
||||||
|
#define CM_MFENCE \
|
||||||
|
{ \
|
||||||
|
--
|
||||||
|
2.39.2 (Apple Git-143)
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: DCF
|
Name: DCF
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 5
|
Release: 6
|
||||||
Summary: A distributed consensus framework library
|
Summary: A distributed consensus framework library
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
URL: https://gitee.com/opengauss/DCF
|
URL: https://gitee.com/opengauss/DCF
|
||||||
@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.gz
|
|||||||
Patch1: 01-boundcheck.patch
|
Patch1: 01-boundcheck.patch
|
||||||
Patch2: DCF-1.0.0-sw.patch
|
Patch2: DCF-1.0.0-sw.patch
|
||||||
Patch3: DCF-1.0.0-add-loongarch64-support.patch
|
Patch3: DCF-1.0.0-add-loongarch64-support.patch
|
||||||
|
Patch4: DCF-1.0.0-add-riscv64-support.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc gcc-c++ lz4-devel openssl-devel zstd-devel libboundscheck cjson-devel
|
BuildRequires: cmake gcc gcc-c++ lz4-devel openssl-devel zstd-devel libboundscheck cjson-devel
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ DCF is A distributed consensus framework library for openGauss
|
|||||||
%ifarch loongarch64
|
%ifarch loongarch64
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%ifarch riscv64
|
||||||
|
%patch4 -p1
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt
|
cmake -DCMAKE_BUILD_TYPE=Release -DUSE32BIT=OFF -DTEST=OFF -DENABLE_EXPORT_API=OFF CMakeLists.txt
|
||||||
@ -60,6 +64,9 @@ cp output/lib/libdcf.* %{buildroot}/%{_prefix}/lib64
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jul 28 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.0.0-6
|
||||||
|
- Add riscv64 support
|
||||||
|
|
||||||
* Mon May 29 2023 huajingyun<huajingyun@loongson.cn> - 1.0.0-5
|
* Mon May 29 2023 huajingyun<huajingyun@loongson.cn> - 1.0.0-5
|
||||||
- add loongarch64 support
|
- add loongarch64 support
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user