]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[riscv] Check if seed CSR is accessible from S-mode
authorMichael Brown <mcb30@ipxe.org>
Mon, 28 Oct 2024 22:58:56 +0000 (22:58 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 28 Oct 2024 23:07:14 +0000 (23:07 +0000)
commit19f44d2998f6197b70fa2726c551bc8fe6956fa2
treec10207febe260530dfb7c733912994599a9594bf
parente0e102ee24bdab68b0318b505402f60cfb88a5f0
[riscv] Check if seed CSR is accessible from S-mode

The seed CSR defined by the Zkr extension is accessible only in M-mode
by default.  Older versions of OpenSBI (prior to version 1.4) do not
set mseccfg.sseed, with the result that attempts to access the seed
CSR from S-mode will raise an illegal instruction exception.

Add a facility for testing the accessibility of arbitrary CSRs, and
use it to check that the seed CSR is accessible before reporting the
seed CSR entropy source as being functional.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/riscv/core/zkr.c
src/arch/riscv/include/ipxe/csr.h [new file with mode: 0644]