Skip to content

Commit

Permalink
xtheadvector: fix it used as v-ext when hwprobe is used
Browse files Browse the repository at this point in the history
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR committed Sep 4, 2024
1 parent 62bcdab commit 0ba1dc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions arch/riscv/include/asm/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/kernel/sys_riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down

0 comments on commit 0ba1dc1

Please sign in to comment.