xref: /linux/tools/perf/arch/arm64/util/pmu.c (revision 8137a49e1567726eb10fcf55ad141ac19804ca6b)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include "../../../util/cpumap.h"
4 #include "../../../util/pmu.h"
5 
6 struct pmu_events_map *pmu_events_map__find(void)
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 		 */
18 		if (pmu->cpus->nr != cpu__max_cpu())
19 			return NULL;
20 
21 		return perf_pmu__find_map(pmu);
22 	}
23 
24 	return NULL;
25 }
26