forked from Mirrors/opensbi
lib: sbi: Add support for smcntrpmf
This adds the support for ISA extension smcntrpmf. When some inhibit flags are set by a lower privilege mode for new CSRs added by smcntrpmf, OpenSBI sets the appropriate values correspondingly. Signed-off-by: Kaiwen Xue <kaiwenx@andrew.cmu.edu> Signed-off-by: Kaiwen Xue <kaiwenx@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Atish Patra <atishp@rivosinc.com>
This commit is contained in:
@@ -606,6 +606,9 @@ static inline char *sbi_hart_extension_id2string(int ext)
|
||||
case SBI_HART_EXT_SMEPMP:
|
||||
estr = "smepmp";
|
||||
break;
|
||||
case SBI_HART_EXT_SMCNTRPMF:
|
||||
estr = "smcntrpmf";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -872,6 +875,14 @@ __pmp_skip:
|
||||
SBI_HART_EXT_SMSTATEEN, true);
|
||||
}
|
||||
|
||||
/* Detect if hart supports smcntrpmf */
|
||||
if (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_12) {
|
||||
csr_read_allowed(CSR_MCYCLECFG, (unsigned long)&trap);
|
||||
if (!trap.cause)
|
||||
__sbi_hart_update_extension(hfeatures,
|
||||
SBI_HART_EXT_SMCNTRPMF, true);
|
||||
}
|
||||
|
||||
/* Let platform populate extensions */
|
||||
rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr(),
|
||||
hfeatures);
|
||||
|
Reference in New Issue
Block a user