diff options
author | Atish Patra <atish.patra@wdc.com> | 2021-11-08 10:53:05 -0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-11-11 17:54:01 +0530 |
commit | b28f07005cef03d5eea43a8a7954154b391871fe (patch) | |
tree | c2fb39ffdc37d5abc6138a5fd51784035edc7afa /lib/sbi/sbi_ecall_pmu.c | |
parent | b628cfd6a0c1e8bf858b33a62d6a6fa16f4db640 (diff) |
lib: sbi: Enable PMU extension for platforms without mcountinhibit
Some platforms such as hifive unmatched doesn't implement mcountinhibit
csr. However, it has hardware events that can be monitored using 2
hpmcounter it has (i.e. mhpmcounter3 & mhpmcounter4).
Currently, PMU extension disabled if mcountinhibit is absent. That's not
really necessary as long as the supervisor OS keeps track of the delta
value of the counters. Without mcountinhibit, the delta value won't be
entirely accurate because the counters are freely running. However, that
should be fine to produce an approximate counter value which can help
performance analysis. Perf sampling won't work though as sscof extension
is not present in hifive unmatched.
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>
Diffstat (limited to 'lib/sbi/sbi_ecall_pmu.c')
-rw-r--r-- | lib/sbi/sbi_ecall_pmu.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/sbi/sbi_ecall_pmu.c b/lib/sbi/sbi_ecall_pmu.c index 39d3857..9ee9e81 100644 --- a/lib/sbi/sbi_ecall_pmu.c +++ b/lib/sbi/sbi_ecall_pmu.c @@ -74,14 +74,8 @@ static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_pmu_probe(unsigned long extid, unsigned long *out_val) { - struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); - - /* SBI PMU extension is useless without mcount inhibit features */ - if (sbi_hart_has_feature(scratch, SBI_HART_HAS_MCOUNTINHIBIT)) - *out_val = 1; - else - *out_val = 0; - + /* PMU extension is always enabled */ + *out_val = 1; return 0; } |