mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
sbi: sbi_pmu: Add hw_counter_filter_mode() to pmu device
Add support for custom PMU extensions to set inhibit bits on custom CSRs by introducing the PMU device callback hw_counter_filter_mode(). This allows the perf tool to restrict event counting under a specified privileged mode by appending a modifier, e.g. perf record -e event:k to count events only happening in kernel mode. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
090fa99d7c
commit
a48f2cfd94
@@ -89,6 +89,12 @@ struct sbi_pmu_device {
|
||||
* Custom function returning the machine-specific irq-bit.
|
||||
*/
|
||||
int (*hw_counter_irq_bit)(void);
|
||||
|
||||
/**
|
||||
* Custom function to inhibit counting of events while in
|
||||
* specified mode.
|
||||
*/
|
||||
void (*hw_counter_filter_mode)(unsigned long flags, int counter_index);
|
||||
};
|
||||
|
||||
/** Get the PMU platform device */
|
||||
|
Reference in New Issue
Block a user