1 // SPDX-License-Identifier: GPL-2.0-only
3 * auxtrace.c: AUX area tracing support
4 * Copyright (c) 2013-2014, Intel Corporation.
10 #include "../../../util/header.h"
11 #include "../../../util/debug.h"
12 #include "../../../util/pmu.h"
13 #include "../../../util/auxtrace.h"
14 #include "../../../util/intel-pt.h"
15 #include "../../../util/intel-bts.h"
16 #include "../../../util/evlist.h"
19 struct auxtrace_record
*auxtrace_record__init_intel(struct evlist
*evlist
,
22 struct perf_pmu
*intel_pt_pmu
;
23 struct perf_pmu
*intel_bts_pmu
;
25 bool found_pt
= false;
26 bool found_bts
= false;
28 intel_pt_pmu
= perf_pmu__find(INTEL_PT_PMU_NAME
);
30 intel_pt_pmu
->auxtrace
= true;
31 intel_bts_pmu
= perf_pmu__find(INTEL_BTS_PMU_NAME
);
33 intel_bts_pmu
->auxtrace
= true;
35 evlist__for_each_entry(evlist
, evsel
) {
36 if (intel_pt_pmu
&& evsel
->core
.attr
.type
== intel_pt_pmu
->type
)
38 if (intel_bts_pmu
&& evsel
->core
.attr
.type
== intel_bts_pmu
->type
)
42 if (found_pt
&& found_bts
) {
43 pr_err("intel_pt and intel_bts may not be used together\n");
49 return intel_pt_recording_init(err
);
52 return intel_bts_recording_init(err
);
57 struct auxtrace_record
*auxtrace_record__init(struct evlist
*evlist
,
65 ret
= get_cpuid(buffer
, sizeof(buffer
));
71 if (!strncmp(buffer
, "GenuineIntel,", 13))
72 return auxtrace_record__init_intel(evlist
, err
);