Commit 9c9b4ad2 authored by Atish Patra's avatar Atish Patra Committed by Anup Patel
Browse files

lib: sbi: Disable m/scounteren & enable mcountinhibit



Currently, all bits in mcountern are enabled unconditionally at boot time.
With SBI PMU extension, all the programmable counters should enabled only
during performance monitoring for a particular event. However, this is done
only if mcountinhibit is implemented because the supervisor mode can not
start/stop any event without mcountinhibit.

Similarly, supervisor should take care enabling scounteren which allows
U-mode to access programmable pmu counters. All the non-programmable ones
(CY, TM, IR) should be enabled in M-mode because some userspace may rely on
builtins such as __builtin_readcyclecounter. Supervisor OS can still disable
them during initial configuration.

Reviewed-by: default avatarAnup Patel <anup.patel@wdc.com>
Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
parent 0829f2bc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment