From a48f2cfd94d3be641b2b17eb3fa9090bed2d6cb8 Mon Sep 17 00:00:00 2001 From: Yu Chien Peter Lin Date: Thu, 30 Nov 2023 20:42:02 +0800 Subject: 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 Reviewed-by: Leo Yu-Chi Liang Reviewed-by: Atish Patra Reviewed-by: Anup Patel --- include/sbi/sbi_pmu.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/sbi/sbi_pmu.h b/include/sbi/sbi_pmu.h index 16f68773..d63149cd 100644 --- a/include/sbi/sbi_pmu.h +++ b/include/sbi/sbi_pmu.h @@ -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 */ -- cgit v1.3.1