diff options
| author | Atish Patra <[email protected]> | 2020-04-16 18:56:30 -0700 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-04-17 09:30:17 +0530 |
| commit | 6c7922e23b85bef624ef84a8b05ed89495e1eb20 (patch) | |
| tree | a34e921e37d79578f968bedbf935656ed5e336f1 /lib | |
| parent | f281de885ec9417a6d3ae702d0ed5acab6396bee (diff) | |
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 <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib')
| -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 b0f9919b..b5df7c4f 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)) |
