File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1186,6 +1186,7 @@ static const struct attribute_group *amd_attr_update[] = {
1186
1186
1187
1187
static int __init amd_core_pmu_init (void )
1188
1188
{
1189
+ union cpuid_0x80000022_ebx ebx ;
1189
1190
u64 even_ctr_mask = 0ULL ;
1190
1191
int i ;
1191
1192
@@ -1206,9 +1207,14 @@ static int __init amd_core_pmu_init(void)
1206
1207
1207
1208
/* Check for Performance Monitoring v2 support */
1208
1209
if (boot_cpu_has (X86_FEATURE_PERFMON_V2 )) {
1210
+ ebx .full = cpuid_ebx (EXT_PERFMON_DEBUG_FEATURES );
1211
+
1209
1212
/* Update PMU version for later usage */
1210
1213
x86_pmu .version = 2 ;
1211
1214
1215
+ /* Find the number of available Core PMCs */
1216
+ x86_pmu .num_counters = ebx .split .num_core_pmc ;
1217
+
1212
1218
amd_pmu_global_cntr_mask = (1ULL << x86_pmu .num_counters ) - 1 ;
1213
1219
}
1214
1220
Original file line number Diff line number Diff line change @@ -186,6 +186,18 @@ union cpuid28_ecx {
186
186
unsigned int full ;
187
187
};
188
188
189
+ /*
190
+ * AMD "Extended Performance Monitoring and Debug" CPUID
191
+ * detection/enumeration details:
192
+ */
193
+ union cpuid_0x80000022_ebx {
194
+ struct {
195
+ /* Number of Core Performance Counters */
196
+ unsigned int num_core_pmc :4 ;
197
+ } split ;
198
+ unsigned int full ;
199
+ };
200
+
189
201
struct x86_pmu_capability {
190
202
int version ;
191
203
int num_counters_gp ;
@@ -367,6 +379,11 @@ struct pebs_xmm {
367
379
u64 xmm [16 * 2 ]; /* two entries for each register */
368
380
};
369
381
382
+ /*
383
+ * AMD Extended Performance Monitoring and Debug cpuid feature detection
384
+ */
385
+ #define EXT_PERFMON_DEBUG_FEATURES 0x80000022
386
+
370
387
/*
371
388
* IBS cpuid feature detection
372
389
*/
You can’t perform that action at this time.
0 commit comments