]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
riscv: Add hwprobe vdso call support
authorEvan Green <evan@rivosinc.com>
Tue, 27 Feb 2024 22:56:39 +0000 (14:56 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 1 Mar 2024 15:14:57 +0000 (07:14 -0800)
The new riscv_hwprobe syscall also comes with a vDSO for faster answers
to your most common questions. Call in today to speak with a kernel
representative near you!

Signed-off-by: Evan Green <evan@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
sysdeps/unix/sysv/linux/dl-vdso-setup.c
sysdeps/unix/sysv/linux/dl-vdso-setup.h
sysdeps/unix/sysv/linux/riscv/hwprobe.c
sysdeps/unix/sysv/linux/riscv/sysdep.h

index 5dd7ed9d126feedcae01c2472c51d20eb3a2bd44..3a44944dbb56a55dd750d1fe197e9f8b1fb410a3 100644 (file)
@@ -71,6 +71,16 @@ PROCINFO_CLASS int (*_dl_vdso_clock_getres_time64) (clockid_t,
 # ifdef HAVE_GET_TBFREQ
 PROCINFO_CLASS uint64_t (*_dl_vdso_get_tbfreq)(void) RELRO;
 # endif
+
+/* RISC-V specific ones.  */
+# ifdef HAVE_RISCV_HWPROBE
+PROCINFO_CLASS int (*_dl_vdso_riscv_hwprobe)(void *,
+                                             size_t,
+                                             size_t,
+                                             unsigned long *,
+                                             unsigned int) RELRO;
+# endif
+
 #endif
 
 #undef RELRO
index e87d88694098588ed8a08ce6a2f61efe95cea7d1..8aee5a8212750140a11ff45964a137e4c9572601 100644 (file)
@@ -47,6 +47,9 @@ setup_vdso_pointers (void)
 #ifdef HAVE_GET_TBFREQ
   GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ);
 #endif
+#ifdef HAVE_RISCV_HWPROBE
+  GLRO(dl_vdso_riscv_hwprobe) = dl_vdso_vsym (HAVE_RISCV_HWPROBE);
+#endif
 }
 
 #endif
index 28a448175baf366a1a26f7dd0cfd05cb40de52bd..e64c159eb316d2d19bc667a4e94e26964b45429f 100644 (file)
@@ -28,8 +28,8 @@ int __riscv_hwprobe (struct riscv_hwprobe *pairs, size_t pair_count,
 {
   int r;
 
-  r = INTERNAL_SYSCALL_CALL (riscv_hwprobe, pairs, pair_count,
-                             cpu_count, cpus, flags);
+  r = INTERNAL_VSYSCALL (riscv_hwprobe, 5, pairs, pair_count,
+                         cpu_count, cpus, flags);
 
   /* Negate negative errno values to match pthreads API. */
   return -r;
index 5583b96d23c5dcdc4fee07cffcd16ab34514c9a8..ee015dfeb65b5131d1786a897aecddc5382953b1 100644 (file)
 /* List of system calls which are supported as vsyscalls (for RV32 and
    RV64).  */
 # define HAVE_GETCPU_VSYSCALL          "__vdso_getcpu"
+# define HAVE_RISCV_HWPROBE            "__vdso_riscv_hwprobe"
 
 # undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
 # define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1