Skip to content

Commit 5af72a8

Browse files
jones-drewAlexandre Ghiti
authored andcommitted
riscv: Fix riscv_online_cpu_vec
We shouldn't probe when we already know vector is unsupported and we should probe when we see we don't yet know whether it's supported. Furthermore, we should ensure we've set the access type to unsupported when we don't have vector at all. Fixes: e7c9d66 ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20250304120014.143628-12-ajones@ventanamicro.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
1 parent a00e022 commit 5af72a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/riscv/kernel/unaligned_access_speed.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,12 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus
367367

368368
static int riscv_online_cpu_vec(unsigned int cpu)
369369
{
370-
if (!has_vector())
370+
if (!has_vector()) {
371+
per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED;
371372
return 0;
373+
}
372374

373-
if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED)
375+
if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN)
374376
return 0;
375377

376378
check_vector_unaligned_access_emulated(NULL);

0 commit comments

Comments
 (0)