diff options
author | Atish Patra <atish.patra@wdc.com> | 2020-04-17 04:56:30 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-04-17 07:00:17 +0300 |
commit | 6c7922e23b85bef624ef84a8b05ed89495e1eb20 (patch) | |
tree | a34e921e37d79578f968bedbf935656ed5e336f1 /lib/sbi/sbi_hart.c | |
parent | f281de885ec9417a6d3ae702d0ed5acab6396bee (diff) | |
download | opensbi-6c7922e23b85bef624ef84a8b05ed89495e1eb20.tar.xz |
lib: Support vector extension
Enable vector context in mstatus by updating the corresponding bits
in mstatus if vector extension is supported by the hart.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_hart.c')
-rw-r--r-- | lib/sbi/sbi_hart.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index b0f9919..b5df7c4 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -25,10 +25,17 @@ void (*sbi_hart_unpriv_trap)(void) = &__sbi_unpriv_trap; static void mstatus_init(struct sbi_scratch *scratch, u32 hartid) { const struct sbi_platform *plat = sbi_platform_ptr(scratch); + unsigned long mstatus_val = 0; /* Enable FPU */ if (misa_extension('D') || misa_extension('F')) - csr_write(CSR_MSTATUS, MSTATUS_FS); + mstatus_val |= MSTATUS_FS; + + /* Enable Vector context */ + if (misa_extension('V')) + mstatus_val |= MSTATUS_VS; + + csr_write(CSR_MSTATUS, mstatus_val); /* Enable user/supervisor use of perf counters */ if (misa_extension('S') && sbi_platform_has_scounteren(plat)) |