mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-19 18:21:41 +00:00
lib: sbi_pmu: Fix fixed-counter events reported as unsupported
OpenSBI assigns SBI_PMU_HW_CPU_CYCLES and SBI_PMU_HW_INSTRUCTIONS to
fixed counters during PMU initialization. sbi_pmu_ctr_cfg_match()
recognizes these events without searching hw_event_map[].
However, sbi_pmu_event_get_info() only checks hw_event_map[] when
determining whether a hardware event is supported. As a result, these
fixed-counter events are reported as unsupported when no riscv,pmu
device tree node is provided.
Check fixed-counter events separately using pmu_ctr_find_fixed_hw() and
report them as supported.
Fixes: e434584216 ("lib: sbi_pmu: Implement SBI PMU event info function")
Signed-off-by: Fengwei Tan <tfx2001@outlook.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/SY8P300MB0041D04649621E79FE950B43B58E2@SY8P300MB0041.AUSP300.PROD.OUTLOOK.COM
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
d28bc6f898
commit
2bbee7d82a
1 file changed
+3
@@ -1132,6 +1132,9 @@ int sbi_pmu_event_get_info(unsigned long shmem_phys_lo, unsigned long shmem_phys
|
||||
einfo[i].output = 0;
|
||||
} else if (event_type == SBI_PMU_EVENT_TYPE_FW) {
|
||||
einfo[i].output = 1;
|
||||
} else if (event_type == SBI_PMU_EVENT_TYPE_HW &&
|
||||
pmu_ctr_find_fixed_hw(event_idx) >= 0) {
|
||||
einfo[i].output = 1;
|
||||
} else {
|
||||
for (j = 0; j < num_hw_events; j++) {
|
||||
temp = &hw_event_map[j];
|
||||
|
||||
Reference in new issue
Block a user