lib: sbi: Add Zihpm as a HART ISA extension

Recently ratified Zihpm ISA extension covers all [m]hpm* CSRs
so we add Zihpm as a HART ISA extension in OpenSBI.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
Anup Patel 2023-07-05 12:15:56 +05:30 committed by Anup Patel
parent 1a398d9faa
commit 669089c5f2
2 changed files with 10 additions and 0 deletions

View file

@ -36,6 +36,8 @@ enum sbi_hart_extensions {
SBI_HART_EXT_SMSTATEEN,
/** HART has Sstc extension */
SBI_HART_EXT_SSTC,
/** HART has Zihpm extension */
SBI_HART_EXT_ZIHPM,
/** Maximum index of Hart extension */
SBI_HART_EXT_MAX,

View file

@ -453,6 +453,9 @@ static inline char *sbi_hart_extension_id2string(int ext)
case SBI_HART_EXT_SMSTATEEN:
estr = "smstateen";
break;
case SBI_HART_EXT_ZIHPM:
estr = "zihpm";
break;
default:
break;
}
@ -706,6 +709,11 @@ __mhpm_skip:
if (rc)
return rc;
/* Extensions implied by other extensions and features */
if (hfeatures->mhpm_count)
__sbi_hart_update_extension(hfeatures,
SBI_HART_EXT_ZIHPM, true);
/* Mark hart feature detection done */
hfeatures->detected = true;