[PATCH 4/4] lib: sbi: Enable Svpbmt extension in the menvcfg CSR

Xiang W wxjstz at 126.com
Wed Mar 30 07:49:59 PDT 2022


在 2022-03-29星期二的 21:22 +0530,Anup Patel写道:
> 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 at ventanamicro.com>
Reviewed-by: Xiang W <wxjstz at 126.com>

Regards,
Xiang W
> ---
>  lib/sbi/sbi_hart.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index d2c7aba..6be9286 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);
>         }
>  
> -- 
> 2.25.1
> 
> 





More information about the opensbi mailing list