summaryrefslogtreecommitdiff
path: root/arch/riscv/include/uapi
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2024-07-02 11:37:31 +0800
committerPalmer Dabbelt <palmer@rivosinc.com>2024-07-26 05:50:51 -0700
commit52420e483d3e1562f11a208d3c540b27b5e5dbf4 (patch)
tree151da776746d0951d9cf741b5b091f3aca13a9eb /arch/riscv/include/uapi
parent5c8405d763dc2b125b39166bc70be1b8dcc80582 (diff)
downloadlinux-52420e483d3e1562f11a208d3c540b27b5e5dbf4.tar.gz
linux-52420e483d3e1562f11a208d3c540b27b5e5dbf4.tar.bz2
linux-52420e483d3e1562f11a208d3c540b27b5e5dbf4.zip
RISC-V: Provide the frequency of time CSR via hwprobe
The RISC-V architecture makes a real time counter CSR (via RDTIME instruction) available for applications in U-mode but there is no architected mechanism for an application to discover the frequency the counter is running at. Some applications (e.g., DPDK) use the time counter for basic performance analysis as well as fine grained time-keeping. Add support to the hwprobe system call to export the time CSR frequency to code running in U-mode. Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> Reviewed-by: Evan Green <evan@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Acked-by: Punit Agrawal <punit.agrawal@bytedance.com> Link: https://lore.kernel.org/r/20240702033731.71955-2-cuiyunhui@bytedance.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/include/uapi')
-rw-r--r--arch/riscv/include/uapi/asm/hwprobe.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h
index 8b8f6ac0eae2..b706c8e47b02 100644
--- a/arch/riscv/include/uapi/asm/hwprobe.h
+++ b/arch/riscv/include/uapi/asm/hwprobe.h
@@ -81,6 +81,7 @@ struct riscv_hwprobe {
#define RISCV_HWPROBE_MISALIGNED_MASK (7 << 0)
#define RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE 6
#define RISCV_HWPROBE_KEY_HIGHEST_VIRT_ADDRESS 7
+#define RISCV_HWPROBE_KEY_TIME_CSR_FREQ 8
/* Increase RISCV_HWPROBE_MAX_KEY when adding items. */
/* Flags */