xref: /linux/tools/perf/arch/arm/util/pmu.c (revision c21614d5c0e76cf1d7a864f15d495fd3e5876acc)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright(C) 2015 Linaro Limited. All rights reserved.
4  * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
5  */
6 
7 #include <string.h>
8 #include <linux/coresight-pmu.h>
9 #include <linux/perf_event.h>
10 #include <linux/string.h>
11 
12 #include "arm-spe.h"
13 #include "hisi-ptt.h"
14 #include "../../../util/pmu.h"
15 #include "../../../util/cs-etm.h"
16 #include "../../arm64/util/mem-events.h"
17 
18 void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
19 {
20 #ifdef HAVE_AUXTRACE_SUPPORT
21 	if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
22 		/* add ETM default config here */
23 		pmu->selectable = true;
24 		pmu->perf_event_attr_init_default = cs_etm_get_default_config;
25 #if defined(__aarch64__)
26 	} else if (strstarts(pmu->name, ARM_SPE_PMU_NAME)) {
27 		pmu->selectable = true;
28 		pmu->is_uncore = false;
29 		pmu->perf_event_attr_init_default = arm_spe_pmu_default_config;
30 		if (!strcmp(pmu->name, "arm_spe_0"))
31 			pmu->mem_events = perf_mem_events_arm;
32 	} else if (strstarts(pmu->name, HISI_PTT_PMU_NAME)) {
33 		pmu->selectable = true;
34 #endif
35 	}
36 
37 #endif
38 }
39