diff options
| author | Leo Yu-Chi Liang <[email protected]> | 2025-03-28 16:41:42 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2025-04-14 17:28:59 +0530 |
| commit | 0442f1318e116ac54c95ebcf88d504fc5633195a (patch) | |
| tree | 937993bddc28e32d4f9e42c119717fd07360bb4e | |
| parent | 5ab908d6227e6021678cca57d7040d9401a3615e (diff) | |
lib: sbi: Allow programmable counters to monitor cycle/instret events for Andes PMU
Referencing commit 0c304b661965
("lib: sbi: Allow programmable counters to monitor cycle/instret events")
to support this functionality for Andes PMU.
Signed-off-by: Leo Yu-Chi Liang <[email protected]>
Reviewed-by: Samuel Holland <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/sbi/sbi_pmu.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c index 4f113c23..5983a784 100644 --- a/lib/sbi/sbi_pmu.c +++ b/lib/sbi/sbi_pmu.c @@ -732,12 +732,13 @@ static int pmu_ctr_find_hw(struct sbi_pmu_hart_state *phs, return SBI_EINVAL; /** - * If Sscof is present try to find the programmable counter for - * cycle/instret as well. + * If Sscofpmf or Andes PMU is present, try to find + * the programmable counter for cycle/instret as well. */ fixed_ctr = pmu_ctr_find_fixed_hw(event_idx); 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); if (sbi_hart_priv_version(scratch) >= SBI_HART_PRIV_VER_1_11) |
