diff options
| -rw-r--r-- | meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch | 44 | ||||
| -rw-r--r-- | meta-oe/recipes-dbs/rocksdb/rocksdb_6.20.3.bb | 1 |
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 @@ | |||
| 1 | From 89c032a9b4011385c0b504ea61e5df0db71f0ff5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 16 Jun 2021 19:06:02 -0700 | ||
| 4 | Subject: [PATCH] range_tree: Implement toku_time_now for rv32/rv64 in asm | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 8 | --- | ||
| 9 | .../range_tree/lib/portability/toku_time.h | 19 +++++++++++++++++++ | ||
| 10 | 1 file changed, 19 insertions(+) | ||
| 11 | |||
| 12 | 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 | ||
| 13 | index 4425a4a2e..4ac964f85 100644 | ||
| 14 | --- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h | ||
| 15 | +++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h | ||
| 16 | @@ -133,6 +133,25 @@ static inline tokutime_t toku_time_now(void) { | ||
| 17 | return result; | ||
| 18 | #elif defined(__powerpc__) | ||
| 19 | return __ppc_get_timebase(); | ||
| 20 | +#elif defined(__riscv) // RISC-V | ||
| 21 | +#if __riscv_xlen == 32 | ||
| 22 | + uint32_t lo, hi0, hi1; | ||
| 23 | + __asm __volatile__( | ||
| 24 | + "rdcycleh %0\n" | ||
| 25 | + "rdcycle %1\n" | ||
| 26 | + "rdcycleh %2\n" | ||
| 27 | + "sub %0, %0, %2\n" | ||
| 28 | + "seqz %0, %0\n" | ||
| 29 | + "sub %0, zero, %0\n" | ||
| 30 | + "and %1, %1, %0\n" | ||
| 31 | + : "=r"(hi0), "=r"(lo), "=r"(hi1)); | ||
| 32 | + return ((uint64_t)hi1 << 32) | lo; | ||
| 33 | +#else | ||
| 34 | + uint64_t result; | ||
| 35 | + __asm __volatile__("rdcycle %0" : "=r"(result)); | ||
| 36 | + return result; | ||
| 37 | +#endif | ||
| 38 | + | ||
| 39 | #else | ||
| 40 | #error No timer implementation for this platform | ||
| 41 | #endif | ||
| 42 | -- | ||
| 43 | 2.32.0 | ||
| 44 | |||
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} \ | |||
| 14 | file://0001-cmake-Use-exported-target-for-bz2.patch \ | 14 | file://0001-cmake-Use-exported-target-for-bz2.patch \ |
| 15 | file://0001-folly-Use-SYS_futex-for-syscall.patch \ | 15 | file://0001-folly-Use-SYS_futex-for-syscall.patch \ |
| 16 | file://0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch \ | 16 | file://0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch \ |
| 17 | file://0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch \ | ||
| 17 | " | 18 | " |
| 18 | 19 | ||
| 19 | S = "${WORKDIR}/git" | 20 | S = "${WORKDIR}/git" |
