summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/sys_hwprobe.c
diff options
context:
space:
mode:
authorJesse Taube <jesse@rivosinc.com>2024-10-17 21:00:22 +0200
committerPalmer Dabbelt <palmer@rivosinc.com>2024-10-18 21:38:34 +0200
commite7c9d66e313bc0f7cb185c4972c3c9383a0da70f (patch)
treebba7ec456197fa9ee5bc9aabb6e78b97180f83d6 /arch/riscv/kernel/sys_hwprobe.c
parentRISC-V: Detect unaligned vector accesses supported (diff)
downloadlinux-e7c9d66e313bc0f7cb185c4972c3c9383a0da70f.tar.xz
linux-e7c9d66e313bc0f7cb185c4972c3c9383a0da70f.zip
RISC-V: Report vector unaligned access speed hwprobe
Detect if vector misaligned accesses are faster or slower than equivalent vector byte accesses. This is useful for usermode to know whether vector byte accesses or vector misaligned accesses have a better bandwidth for operations like memcpy. Signed-off-by: Jesse Taube <jesse@rivosinc.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Link: https://lore.kernel.org/r/20241017-jesse_unaligned_vector-v10-5-5b33500160f8@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/kernel/sys_hwprobe.c')
-rw-r--r--arch/riscv/kernel/sys_hwprobe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c
index 6441baada36b..6673278e84d5 100644
--- a/arch/riscv/kernel/sys_hwprobe.c
+++ b/arch/riscv/kernel/sys_hwprobe.c
@@ -228,6 +228,12 @@ static u64 hwprobe_vec_misaligned(const struct cpumask *cpus)
#else
static u64 hwprobe_vec_misaligned(const struct cpumask *cpus)
{
+ if (IS_ENABLED(CONFIG_RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS))
+ return RISCV_HWPROBE_MISALIGNED_VECTOR_FAST;
+
+ if (IS_ENABLED(CONFIG_RISCV_SLOW_VECTOR_UNALIGNED_ACCESS))
+ return RISCV_HWPROBE_MISALIGNED_VECTOR_SLOW;
+
return RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN;
}
#endif