summaryrefslogtreecommitdiffstats
path: root/debian/patches/2980-riscv-use-rdtime.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/2980-riscv-use-rdtime.patch')
-rw-r--r--debian/patches/2980-riscv-use-rdtime.patch59
1 files changed, 0 insertions, 59 deletions
diff --git a/debian/patches/2980-riscv-use-rdtime.patch b/debian/patches/2980-riscv-use-rdtime.patch
deleted file mode 100644
index a2e21ddb..00000000
--- a/debian/patches/2980-riscv-use-rdtime.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-Forwarded: https://github.com/MariaDB/server/pull/2980 (merged in Feb 2024)
-Origin: https://patch-diff.githubusercontent.com/raw/MariaDB/server/pull/2980.patch
-From: Aurelien Jarno <aurelien@aurel32.net>
-Date: Thu, 4 Jan 2024 11:30:34 +0100
-Subject: [PATCH] RISC-V: use RDTIME instead of RDCYCLE
-
-Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on
-RISC-V and can't be used directly from userland. There is a sysctl
-option to change that as a transition period, but it will eventually
-disappear.
-
-Use RDTIME instead, which while less accurate has the advantage of being
-synchronized between CPU (and thus monotonic) and of constant frequency.
-
-[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3
----
- include/my_rdtsc.h | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
---- a/include/my_rdtsc.h
-+++ b/include/my_rdtsc.h
-@@ -111,7 +111,7 @@ C_MODE_START
- On AARCH64, we use the generic timer base register. We override clang
- implementation for aarch64 as it access a PMU register which is not
- guaranteed to be active.
-- On RISC-V, we use the rdcycle instruction to read from mcycle register.
-+ On RISC-V, we use the rdtime instruction to read from mtime register.
-
- Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
- HP PA-RISC or other non-mainstream (or obsolete) processors.
-@@ -211,15 +211,15 @@ static inline ulonglong my_timer_cycles(
- }
- #elif defined(__riscv)
- #define MY_TIMER_ROUTINE_CYCLES MY_TIMER_ROUTINE_RISCV
-- /* Use RDCYCLE (and RDCYCLEH on riscv32) */
-+ /* Use RDTIME (and RDTIMEH on riscv32) */
- {
- # if __riscv_xlen == 32
- ulong result_lo, result_hi0, result_hi1;
- /* Implemented in assembly because Clang insisted on branching. */
- __asm __volatile__(
-- "rdcycleh %0\n"
-- "rdcycle %1\n"
-- "rdcycleh %2\n"
-+ "rdtimeh %0\n"
-+ "rdtime %1\n"
-+ "rdtimeh %2\n"
- "sub %0, %0, %2\n"
- "seqz %0, %0\n"
- "sub %0, zero, %0\n"
-@@ -228,7 +228,7 @@ static inline ulonglong my_timer_cycles(
- return (static_cast<ulonglong>(result_hi1) << 32) | result_lo;
- # else
- ulonglong result;
-- __asm __volatile__("rdcycle %0" : "=r"(result));
-+ __asm __volatile__("rdtime %0" : "=r"(result));
- return result;
- }
- # endif