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 <mchitale@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Mayuresh Chitale
2023-08-02 16:45:23 +05:30
committed by Anup Patel
parent f536e0b02e
commit c744ed77b1
4 changed files with 54 additions and 19 deletions

View File

@@ -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);