Skip to content

Commit fd515e0

Browse files
geomatsiPaul Walmsley
authored andcommitted
riscv: csr: define vtype register elements
Define masks and shifts for vtype CSR according to the vector specs: - v0.7.1 used in early T-Head cores, known as xtheadvector in the kernel - v1.0 Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com> Reviewed-by: Andy Chiu <andybnac@gmail.com> Tested-by: Andy Chiu <andybnac@gmail.com> Link: https://patch.msgid.link/20251214163537.1054292-4-geomatsi@gmail.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
1 parent ef3ff40 commit fd515e0

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • arch/riscv/include/asm

arch/riscv/include/asm/csr.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,23 @@
458458
#define CSR_VTYPE 0xc21
459459
#define CSR_VLENB 0xc22
460460

461+
#define VTYPE_VLMUL _AC(7, UL)
462+
#define VTYPE_VLMUL_FRAC _AC(4, UL)
463+
#define VTYPE_VSEW_SHIFT 3
464+
#define VTYPE_VSEW (_AC(7, UL) << VTYPE_VSEW_SHIFT)
465+
#define VTYPE_VTA_SHIFT 6
466+
#define VTYPE_VTA (_AC(1, UL) << VTYPE_VTA_SHIFT)
467+
#define VTYPE_VMA_SHIFT 7
468+
#define VTYPE_VMA (_AC(1, UL) << VTYPE_VMA_SHIFT)
469+
#define VTYPE_VILL_SHIFT (__riscv_xlen - 1)
470+
#define VTYPE_VILL (_AC(1, UL) << VTYPE_VILL_SHIFT)
471+
472+
#define VTYPE_VLMUL_THEAD _AC(3, UL)
473+
#define VTYPE_VSEW_THEAD_SHIFT 2
474+
#define VTYPE_VSEW_THEAD (_AC(7, UL) << VTYPE_VSEW_THEAD_SHIFT)
475+
#define VTYPE_VEDIV_THEAD_SHIFT 5
476+
#define VTYPE_VEDIV_THEAD (_AC(3, UL) << VTYPE_VEDIV_THEAD_SHIFT)
477+
461478
/* Scalar Crypto Extension - Entropy */
462479
#define CSR_SEED 0x015
463480
#define SEED_OPST_MASK _AC(0xC0000000, UL)

0 commit comments

Comments
 (0)