drivers/perf: riscv: handle legacy fallback in event check
Subsystems (3)
PATCH 1/1 drivers/perf: riscv: handle legacy fallback in event check
Common events PERF_COUNT_HW_CPU_CYCLES and PERF_COUNT_HW_INSTRUCTIONS can fall back to the legacy counters. So do not mark them as invalid if OpenSBI reports that they are not mapped to sampling counters in PMU DT node.
Signed-off-by Sergey Matyukevich <[email protected]>
--- drivers/perf/riscv_pmu_sbi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/perf/riscv_pmu_sbi.c +2 -1
@@ -335,7 +335,8 @@ static int pmu_sbi_check_event_info(void) goto free_mem; } -for (i =0 ; i <ARRAY_SIZE (pmu_hw_event_map); i++) { +/* skip check for cycles and instructions as they can fall back to legacy counters */ +for (i =2 ; i <ARRAY_SIZE (pmu_hw_event_map); i++) {if (!(event_info_shmem[i].output &RISCV_PMU_EVENT_INFO_OUTPUT_MASK )) pmu_hw_event_map[i].event_idx = -ENOENT ; }
base-commit: a635d6748234582ea287c5ffeae28b9b23f91c7e
Signature · 1 line
2.54.0
Will Deacon
maintainerQuoted 15 lines · Sergey Matyukevich
Common events
PERF_COUNT_HW_CPU_CYCLESandPERF_COUNT_HW_INSTRUCTIONScan fall back to the legacy counters. So do not mark them as invalid if OpenSBI reports that they are not mapped to sampling counters in PMU DT node.Signed-off-by Sergey Matyukevich <[email protected]>--- drivers/perf/riscv_pmu_sbi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/perf/riscv_pmu_sbi.c +0
-0
drivers/perf/riscv_pmu_sbi.c static int pmu_sbi_check_event_info(void) · line 342
Quoted 9 lines
drivers/perf/riscv_pmu_sbi.c +2
-1@@ -335,7 +335,8 @@ static int pmu_sbi_check_event_info(void) goto free_mem; } -for (i =0 ; i <ARRAY_SIZE (pmu_hw_event_map); i++) { +/* skip check for cycles and instructions as they can fall back to legacy counters */ +for (i =2 ; i <ARRAY_SIZE (pmu_hw_event_map); i++) {if (!(event_info_shmem[i].output &RISCV_PMU_EVENT_INFO_OUTPUT_MASK )) pmu_hw_event_map[i].event_idx = -ENOENT ; }
I'm assuming the riscv tree are handling perf patches to the riscv driver, but please shout if not.
Will