lib: sbi: Detect Sscofpmf extension at run time
authorAtish Patra <atish.patra@wdc.com>
Mon, 8 Nov 2021 18:52:58 +0000 (10:52 -0800)
committerAnup Patel <anup@brainfault.org>
Thu, 11 Nov 2021 12:12:59 +0000 (17:42 +0530)
commit867c65360df283f056afa963ad8333e9c1eb21bb
tree9757f8fb87e66a09d195ec18bc57e44882db94ed
parent7084ad9f4281eecd7a7f66cecfd7d9cff8d452ad
lib: sbi: Detect Sscofpmf extension at run time

Sscofpmf ISA extension introduces PMU counter overflow and filtering support.
It introduces a read only `scountovf` csr that can be used to detect if
a hart supports this extension at runtime. However, this feature is only
useful if the hart already supports mcounteren and mcountinhibit.

Add a dynamic detection mechanism and boot time print message if sscofpmf
is present.

Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
include/sbi/sbi_hart.h
lib/sbi/sbi_hart.c