diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-10-29 00:49:59 +0200 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-11-17 12:26:22 +0530 |
commit | 6e5b0cfb4520d0c2d36ae1005770f2537970e90a (patch) | |
tree | c4284d1003a698b3df5cfbcf2c72753f5e4aa389 /lib/sbi/sbi_hart.c | |
parent | efcac338bdf24273ea8a8e332bcb64adfd0dbf39 (diff) | |
download | opensbi-6e5b0cfb4520d0c2d36ae1005770f2537970e90a.zip opensbi-6e5b0cfb4520d0c2d36ae1005770f2537970e90a.tar.gz opensbi-6e5b0cfb4520d0c2d36ae1005770f2537970e90a.tar.bz2 |
lib: sbi: enable seed access in S-mode
If ISA extension Zkr is available, set
mseccfg.sseed=1
mseccfg.useed=0
This enables access to the seed CSR in S-mode but not in U-mode.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/sbi/sbi_hart.c')
-rw-r--r-- | lib/sbi/sbi_hart.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 569596f..b47f00b 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -160,6 +160,12 @@ static void mstatus_init(struct sbi_scratch *scratch) } csr_write(CSR_MENVCFG, menvcfg_val); + + /* Enable S-mode access to seed CSR */ + if (sbi_hart_has_extension(scratch, SBI_HART_EXT_ZKR)) { + csr_set(CSR_MSECCFG, MSECCFG_SSEED); + csr_clear(CSR_MSECCFG, MSECCFG_USEED); + } } /* Disable all interrupts */ |