1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2023 SiFive
4 * Author: Andy Chiu <andy.chiu@sifive.com>
6 #include <linux/export.h>
8 #include <asm/vector.h>
13 unsigned long riscv_v_vsize __read_mostly;
14 EXPORT_SYMBOL_GPL(riscv_v_vsize);
16 int riscv_v_setup_vsize(void)
18 unsigned long this_vsize;
20 /* There are 32 vector registers with vlenb length. */
22 this_vsize = csr_read(CSR_VLENB) * 32;
26 riscv_v_vsize = this_vsize;
30 if (riscv_v_vsize != this_vsize) {
31 WARN(1, "RISCV_ISA_V only supports one vlenb on SMP systems");