File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 30
30
#undef pr_fmt
31
31
#define pr_fmt (fmt ) "amd_uncore: " fmt
32
32
33
+ static int pmu_version ;
33
34
static int num_counters_llc ;
34
35
static int num_counters_nb ;
35
36
static bool l3_mask ;
@@ -629,6 +630,7 @@ static int __init amd_uncore_init(void)
629
630
{
630
631
struct attribute * * df_attr = amd_uncore_df_format_attr ;
631
632
struct attribute * * l3_attr = amd_uncore_l3_format_attr ;
633
+ union cpuid_0x80000022_ebx ebx ;
632
634
int ret = - ENODEV ;
633
635
634
636
if (boot_cpu_data .x86_vendor != X86_VENDOR_AMD &&
@@ -638,6 +640,9 @@ static int __init amd_uncore_init(void)
638
640
if (!boot_cpu_has (X86_FEATURE_TOPOEXT ))
639
641
return - ENODEV ;
640
642
643
+ if (boot_cpu_has (X86_FEATURE_PERFMON_V2 ))
644
+ pmu_version = 2 ;
645
+
641
646
num_counters_nb = NUM_COUNTERS_NB ;
642
647
num_counters_llc = NUM_COUNTERS_L2 ;
643
648
if (boot_cpu_data .x86 >= 0x17 ) {
@@ -666,6 +671,11 @@ static int __init amd_uncore_init(void)
666
671
if (ret )
667
672
goto fail_nb ;
668
673
674
+ if (pmu_version >= 2 ) {
675
+ ebx .full = cpuid_ebx (EXT_PERFMON_DEBUG_FEATURES );
676
+ num_counters_nb = ebx .split .num_df_pmc ;
677
+ }
678
+
669
679
pr_info ("%d %s %s counters detected\n" , num_counters_nb ,
670
680
boot_cpu_data .x86_vendor == X86_VENDOR_HYGON ? "HYGON" : "" ,
671
681
amd_nb_pmu .name );
Original file line number Diff line number Diff line change @@ -194,6 +194,9 @@ union cpuid_0x80000022_ebx {
194
194
struct {
195
195
/* Number of Core Performance Counters */
196
196
unsigned int num_core_pmc :4 ;
197
+ unsigned int reserved :6 ;
198
+ /* Number of Data Fabric Counters */
199
+ unsigned int num_df_pmc :6 ;
197
200
} split ;
198
201
unsigned int full ;
199
202
};
You can’t perform that action at this time.
0 commit comments