lib: sbi: Enable Svpbmt extension in the menvcfg CSR

The menvcfg.PBMTE bit is read-only zero when Svpbmt extension is not
available so we try to enable menvcfg.PBMTE bit irrespective whether
Svpbmt is available or not.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
Anup Patel
2022-03-29 19:55:23 +05:30
committed by Anup Patel
parent 47d676570d
commit 794986f87f

View File

@@ -114,6 +114,16 @@ static void mstatus_init(struct sbi_scratch *scratch)
*/ */
menvcfg_val |= ENVCFG_CBIE_INV << ENVCFG_CBIE_SHIFT; menvcfg_val |= ENVCFG_CBIE_INV << ENVCFG_CBIE_SHIFT;
/*
* Set menvcfg.PBMTE == 1 for RV64 or RV128
*
* If Svpbmt extension is not available then menvcfg.PBMTE
* will be read-only zero.
*/
#if __riscv_xlen > 32
menvcfg_val |= ENVCFG_PBMTE;
#endif
csr_write(CSR_MENVCFG, menvcfg_val); csr_write(CSR_MENVCFG, menvcfg_val);
} }