mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 07:21:22 +01:00
lib: sbi_hart: reset mstateen0
The current logic clears some bits based on SBI known extensions. Be safe and do not leave enabled anything that SBI doesn't control. This is not a breaking change, because the register must be initialized to 0 by the ISA on reset, but it is better to not depend on it when we don't need to. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com> Link: https://lore.kernel.org/r/20250429142549.3673976-8-rkrcmar@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -89,7 +89,7 @@ static void mstatus_init(struct sbi_scratch *scratch)
|
||||
csr_write(CSR_HSTATUS, 0);
|
||||
|
||||
if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SMSTATEEN)) {
|
||||
mstateen_val = csr_read64(CSR_MSTATEEN0);
|
||||
mstateen_val = 0;
|
||||
mstateen_val |= SMSTATEEN_STATEN;
|
||||
mstateen_val |= SMSTATEEN0_CONTEXT;
|
||||
mstateen_val |= SMSTATEEN0_HSENVCFG;
|
||||
|
Reference in New Issue
Block a user