diff --git a/arch/riscv/include/asm/vector.h b/arch/riscv/include/asm/vector.h index e8bafcf80a2d..4cb38556236d 100644 --- a/arch/riscv/include/asm/vector.h +++ b/arch/riscv/include/asm/vector.h @@ -115,6 +115,11 @@ static __always_inline bool has_vector(void) riscv_has_extension_unlikely(RISCV_ISA_EXT_XTHEADVECTOR); } +static __always_inline bool has_xtheadvector(void) +{ + return riscv_has_extension_unlikely(RISCV_ISA_EXT_XTHEADVECTOR); +} + static inline void __riscv_v_vstate_clean(struct pt_regs *regs) { xlen_t sr_vs, sr_vs_clean; @@ -416,6 +421,7 @@ struct pt_regs; static inline int riscv_v_setup_vsize(void) { return -EOPNOTSUPP; } static __always_inline bool has_vector(void) { return false; } static __always_inline bool has_matrix(void) { return false; } +static __always_inline bool has_xtheadvector(void) { return false; } static inline bool riscv_v_first_use_handler(struct pt_regs *regs) { return false; } static inline bool riscv_v_vstate_query(struct pt_regs *regs) { return false; } static inline bool riscv_v_vstate_ctrl_user_allowed(void) { return false; } diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c index 473159b5f303..aa8526ece603 100644 --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -135,7 +135,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, if (riscv_isa_extension_available(NULL, c)) pair->value |= RISCV_HWPROBE_IMA_C; - if (has_vector()) + if (has_vector() && !has_xtheadvector()) pair->value |= RISCV_HWPROBE_IMA_V; /*