All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH v2] rocksdb: Implement toku_time_now function for rv32/rv64
@ 2021-06-17  3:40 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2021-06-17  3:40 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj

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>
---
v2: Implement toku_time_now for rv32/rv64 instead of disabling the build

 ...ment-toku_time_now-for-rv32-rv64-in-.patch | 44 +++++++++++++++++++
 meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch

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"
--
2.32.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-17  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  3:40 [meta-oe][PATCH v2] rocksdb: Implement toku_time_now function for rv32/rv64 Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.