John Garry | e126bef | 2021-04-07 18:32:47 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | |
Ian Rogers | b96da02 | 2021-04-16 14:41:13 -0700 | [diff] [blame] | 3 | #include "../../../util/cpumap.h" |
| 4 | #include "../../../util/pmu.h" |
John Garry | e126bef | 2021-04-07 18:32:47 +0800 | [diff] [blame] | 5 | |
Ian Rogers | 0ec43c0 | 2021-10-15 10:21:13 -0700 | [diff] [blame] | 6 | const struct pmu_events_map *pmu_events_map__find(void) |
John Garry | e126bef | 2021-04-07 18:32:47 +0800 | [diff] [blame] | 7 | { |
| 8 | struct perf_pmu *pmu = NULL; |
| 9 | |
| 10 | while ((pmu = perf_pmu__scan(pmu))) { |
| 11 | if (!is_pmu_core(pmu->name)) |
| 12 | continue; |
| 13 | |
| 14 | /* |
| 15 | * The cpumap should cover all CPUs. Otherwise, some CPUs may |
| 16 | * not support some events or have different event IDs. |
| 17 | */ |
Ian Rogers | 6d18804 | 2022-01-04 22:13:51 -0800 | [diff] [blame] | 18 | if (pmu->cpus->nr != cpu__max_cpu().cpu) |
John Garry | e126bef | 2021-04-07 18:32:47 +0800 | [diff] [blame] | 19 | return NULL; |
| 20 | |
| 21 | return perf_pmu__find_map(pmu); |
| 22 | } |
| 23 | |
| 24 | return NULL; |
| 25 | } |