aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-06-16 10:27:53 -0700
committerKhem Raj <raj.khem@gmail.com>2021-06-18 08:33:07 -0700
commit66a248346c08b49318a65ecd59382b31d936b93a (patch)
treea3aafaca8dc15d9e4ae34487263ba1c18fe21456
parent912be5179c9e65fa33e9ca98c7f82d32ba31e827 (diff)
downloadmeta-openembedded-contrib-66a248346c08b49318a65ecd59382b31d936b93a.tar.gz
meta-openembedded-contrib-66a248346c08b49318a65ecd59382b31d936b93a.tar.bz2
meta-openembedded-contrib-66a248346c08b49318a65ecd59382b31d936b93a.zip
rocksdb: Implement toku_time_now function for rv32/rv64
Fixes build utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_time.h:137:2: error: #error No timer implementation for this platform 137 | #error No timer implementation for this platform | ^~~~~ Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch44
-rw-r--r--meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb1
2 files changed, 45 insertions, 0 deletions
diff --git a/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch b/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch
new file mode 100644
index 0000000000..86c1bffea6
--- /dev/null
+++ b/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch
@@ -0,0 +1,44 @@
+From 89c032a9b4011385c0b504ea61e5df0db71f0ff5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Jun 2021 19:06:02 -0700
+Subject: [PATCH] range_tree: Implement toku_time_now for rv32/rv64 in asm
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ .../range_tree/lib/portability/toku_time.h | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+index 4425a4a2e..4ac964f85 100644
+--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h
+@@ -133,6 +133,25 @@ static inline tokutime_t toku_time_now(void) {
+ return result;
+ #elif defined(__powerpc__)
+ return __ppc_get_timebase();
++#elif defined(__riscv) // RISC-V
++#if __riscv_xlen == 32
++ uint32_t lo, hi0, hi1;
++ __asm __volatile__(
++ "rdcycleh %0\n"
++ "rdcycle %1\n"
++ "rdcycleh %2\n"
++ "sub %0, %0, %2\n"
++ "seqz %0, %0\n"
++ "sub %0, zero, %0\n"
++ "and %1, %1, %0\n"
++ : "=r"(hi0), "=r"(lo), "=r"(hi1));
++ return ((uint64_t)hi1 << 32) | lo;
++#else
++ uint64_t result;
++ __asm __volatile__("rdcycle %0" : "=r"(result));
++ return result;
++#endif
++
+ #else
+ #error No timer implementation for this platform
+ #endif
+--
+2.32.0
+
diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
index ded454e167..98930c6e6d 100644
--- a/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
+++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \
file://0001-cmake-Use-exported-target-for-bz2.patch \
file://0001-folly-Use-SYS_futex-for-syscall.patch \
file://0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch \
+ file://0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch \
"
S = "${WORKDIR}/git"