mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
lib: sbi: Allow programmable counters to monitor cycle/instret events for Andes PMU
Referencing commit 0c304b6619
("lib: sbi: Allow programmable counters to monitor cycle/instret events")
to support this functionality for Andes PMU.
Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20250328084142.540807-1-ycliang@andestech.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
5ab908d622
commit
0442f1318e
@@ -732,12 +732,13 @@ static int pmu_ctr_find_hw(struct sbi_pmu_hart_state *phs,
|
|||||||
return SBI_EINVAL;
|
return SBI_EINVAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If Sscof is present try to find the programmable counter for
|
* If Sscofpmf or Andes PMU is present, try to find
|
||||||
* cycle/instret as well.
|
* the programmable counter for cycle/instret as well.
|
||||||
*/
|
*/
|
||||||
fixed_ctr = pmu_ctr_find_fixed_hw(event_idx);
|
fixed_ctr = pmu_ctr_find_fixed_hw(event_idx);
|
||||||
if (fixed_ctr >= 0 &&
|
if (fixed_ctr >= 0 &&
|
||||||
!sbi_hart_has_extension(scratch, SBI_HART_EXT_SSCOFPMF))
|
!sbi_hart_has_extension(scratch, SBI_HART_EXT_SSCOFPMF) &&
|
||||||
|
!sbi_hart_has_extension(scratch, SBI_HART_EXT_XANDESPMU))
|
||||||
return pmu_fixed_ctr_update_inhibit_bits(fixed_ctr, flags);
|
return pmu_fixed_ctr_update_inhibit_bits(fixed_ctr, flags);
|
||||||
|
|
||||||
if (sbi_hart_priv_version(scratch) >= SBI_HART_PRIV_VER_1_11)
|
if (sbi_hart_priv_version(scratch) >= SBI_HART_PRIV_VER_1_11)
|
||||||
|
Reference in New Issue
Block a user