From c744ed77b18cd2c3c6deb77a53f6a6e67de2d153 Mon Sep 17 00:00:00 2001 From: Mayuresh Chitale Date: Wed, 2 Aug 2023 16:45:23 +0530 Subject: lib: sbi_pmu: Enable noncontigous hpm event and counters Platforms may implement hpm events/counters non contiguously but the current implementation assumes them to be always contigous. Add a bitmap that captures the hpm events/counters as implemented in the hardware and use it to set the max limit of hardware counters visible to the OS. Counters not implemented in the hardware can't be used by the OS because those wont be described in the DT. Signed-off-by: Mayuresh Chitale Reviewed-by: Anup Patel --- include/sbi/sbi_hart.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index c150b7e4..1310198b 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -68,6 +68,7 @@ struct sbi_hart_features { unsigned int pmp_addr_bits; unsigned long pmp_gran; unsigned int mhpm_count; + unsigned int mhpm_mask; unsigned int mhpm_bits; }; @@ -83,6 +84,7 @@ static inline ulong sbi_hart_expected_trap_addr(void) } unsigned int sbi_hart_mhpm_count(struct sbi_scratch *scratch); +unsigned int sbi_hart_mhpm_mask(struct sbi_scratch *scratch); void sbi_hart_delegation_dump(struct sbi_scratch *scratch, const char *prefix, const char *suffix); unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch); -- cgit v1.3.1