@@ -50,16 +50,32 @@ static struct perf_pmu **find_all_arm_spe_pmus(int *nr_spes, int *err)
50
50
return arm_spe_pmus ;
51
51
}
52
52
53
+ static struct perf_pmu * find_pmu_for_event (struct perf_pmu * * pmus ,
54
+ int pmu_nr , struct evsel * evsel )
55
+ {
56
+ int i ;
57
+
58
+ if (!pmus )
59
+ return NULL ;
60
+
61
+ for (i = 0 ; i < pmu_nr ; i ++ ) {
62
+ if (evsel -> core .attr .type == pmus [i ]-> type )
63
+ return pmus [i ];
64
+ }
65
+
66
+ return NULL ;
67
+ }
68
+
53
69
struct auxtrace_record
54
70
* auxtrace_record__init (struct evlist * evlist , int * err )
55
71
{
56
- struct perf_pmu * cs_etm_pmu ;
72
+ struct perf_pmu * cs_etm_pmu = NULL ;
73
+ struct perf_pmu * * arm_spe_pmus = NULL ;
57
74
struct evsel * evsel ;
58
- bool found_etm = false ;
75
+ struct perf_pmu * found_etm = NULL ;
59
76
struct perf_pmu * found_spe = NULL ;
60
- struct perf_pmu * * arm_spe_pmus = NULL ;
77
+ int auxtrace_event_cnt = 0 ;
61
78
int nr_spes = 0 ;
62
- int i = 0 ;
63
79
64
80
if (!evlist )
65
81
return NULL ;
@@ -68,24 +84,23 @@ struct auxtrace_record
68
84
arm_spe_pmus = find_all_arm_spe_pmus (& nr_spes , err );
69
85
70
86
evlist__for_each_entry (evlist , evsel ) {
71
- if (cs_etm_pmu &&
72
- evsel -> core .attr .type == cs_etm_pmu -> type )
73
- found_etm = true;
74
-
75
- if (!nr_spes || found_spe )
76
- continue ;
77
-
78
- for (i = 0 ; i < nr_spes ; i ++ ) {
79
- if (evsel -> core .attr .type == arm_spe_pmus [i ]-> type ) {
80
- found_spe = arm_spe_pmus [i ];
81
- break ;
82
- }
83
- }
87
+ if (cs_etm_pmu && !found_etm )
88
+ found_etm = find_pmu_for_event (& cs_etm_pmu , 1 , evsel );
89
+
90
+ if (arm_spe_pmus && !found_spe )
91
+ found_spe = find_pmu_for_event (arm_spe_pmus , nr_spes , evsel );
84
92
}
93
+
85
94
free (arm_spe_pmus );
86
95
87
- if (found_etm && found_spe ) {
88
- pr_err ("Concurrent ARM Coresight ETM and SPE operation not currently supported\n" );
96
+ if (found_etm )
97
+ auxtrace_event_cnt ++ ;
98
+
99
+ if (found_spe )
100
+ auxtrace_event_cnt ++ ;
101
+
102
+ if (auxtrace_event_cnt > 1 ) {
103
+ pr_err ("Concurrent AUX trace operation not currently supported\n" );
89
104
* err = - EOPNOTSUPP ;
90
105
return NULL ;
91
106
}
0 commit comments