forked from Mirrors/opensbi
lib: sbi_pmu: move pmu irq information into pmu itself
Don't spread checking for pmu extensions through the code but instead introduce a sbi-pmu function that other code can call to get the correct information about the existence of the pmu interrupt. Add a sbi_pmu_device override function to allow overridung this bit as well if needed. Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
This commit is contained in:

committed by
Anup Patel

parent
3f3d401d2d
commit
e54cb3298b
@@ -344,6 +344,18 @@ skip_inhibit_update:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sbi_pmu_irq_bit(void)
|
||||
{
|
||||
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
|
||||
|
||||
if (sbi_hart_has_extension(scratch, SBI_HART_EXT_SSCOFPMF))
|
||||
return MIP_LCOFIP;
|
||||
if (pmu_dev && pmu_dev->hw_counter_irq_bit)
|
||||
return pmu_dev->hw_counter_irq_bit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pmu_ctr_start_fw(uint32_t cidx, uint32_t event_code,
|
||||
uint64_t ival, bool ival_update)
|
||||
{
|
||||
|
Reference in New Issue
Block a user