diff options
| author | Anup Patel <[email protected]> | 2022-03-29 19:55:23 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2022-04-05 08:53:11 +0530 |
| commit | 794986f87fb811ed0c5117fa7d3c84849e9b81d5 (patch) | |
| tree | afbd60f6e4686d1a4c7452a72d69f2c3b7755cc3 /lib | |
| parent | 47d676570ddb0b50e741e4239d596de4d875e370 (diff) | |
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 <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Reviewed-by: Xiang W <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_hart.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index d2c7abae..6be92861 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -114,6 +114,16 @@ static void mstatus_init(struct sbi_scratch *scratch) */ 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); } |
