lib: sbi: Do not enter OpenSBI with mseccfg.MML == 1

On platforms with Smepmp, the previous booting stage must enter
OpenSBI with mseccfg.MML == 0. This allows OpenSBI to configure
it's own M-mode only regions without depending on the previous
booting stage.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
This commit is contained in:
Anup Patel
2023-12-12 15:19:11 +05:30
committed by Anup Patel
parent 5a57e8cd41
commit 2b80b92f02

View File

@@ -914,6 +914,16 @@ __pmp_skip:
/* Mark hart feature detection done */ /* Mark hart feature detection done */
hfeatures->detected = true; hfeatures->detected = true;
/*
* On platforms with Smepmp, the previous booting stage must
* enter OpenSBI with mseccfg.MML == 0. This allows OpenSBI
* to configure it's own M-mode only regions without depending
* on the previous booting stage.
*/
if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMEPMP) &&
(csr_read(CSR_MSECCFG) & MSECCFG_MML))
return SBI_EILL;
return 0; return 0;
} }