@@ -616,6 +616,49 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
616
616
}
617
617
618
618
resctrl_cpu_detect (c );
619
+
620
+ /* Figure out Zen generations: */
621
+ switch (c -> x86 ) {
622
+ case 0x17 : {
623
+ switch (c -> x86_model ) {
624
+ case 0x00 ... 0x2f :
625
+ case 0x50 ... 0x5f :
626
+ setup_force_cpu_cap (X86_FEATURE_ZEN );
627
+ break ;
628
+ case 0x30 ... 0x4f :
629
+ case 0x60 ... 0x7f :
630
+ case 0x90 ... 0x91 :
631
+ case 0xa0 ... 0xaf :
632
+ setup_force_cpu_cap (X86_FEATURE_ZEN2 );
633
+ break ;
634
+ default :
635
+ goto warn ;
636
+ }
637
+ break ;
638
+ }
639
+ case 0x19 : {
640
+ switch (c -> x86_model ) {
641
+ case 0x00 ... 0x0f :
642
+ case 0x20 ... 0x5f :
643
+ setup_force_cpu_cap (X86_FEATURE_ZEN3 );
644
+ break ;
645
+ case 0x10 ... 0x1f :
646
+ case 0x60 ... 0xaf :
647
+ setup_force_cpu_cap (X86_FEATURE_ZEN4 );
648
+ break ;
649
+ default :
650
+ goto warn ;
651
+ }
652
+ break ;
653
+ }
654
+ default :
655
+ break ;
656
+ }
657
+
658
+ return ;
659
+
660
+ warn :
661
+ WARN_ONCE (1 , "Family 0x%x, model: 0x%x??\n" , c -> x86 , c -> x86_model );
619
662
}
620
663
621
664
static void early_detect_mem_encrypt (struct cpuinfo_x86 * c )
@@ -974,8 +1017,6 @@ void init_spectral_chicken(struct cpuinfo_x86 *c)
974
1017
975
1018
static void init_amd_zn (struct cpuinfo_x86 * c )
976
1019
{
977
- set_cpu_cap (c , X86_FEATURE_ZEN );
978
-
979
1020
#ifdef CONFIG_NUMA
980
1021
node_reclaim_distance = 32 ;
981
1022
#endif
@@ -1037,6 +1078,22 @@ static void zenbleed_check(struct cpuinfo_x86 *c)
1037
1078
}
1038
1079
}
1039
1080
1081
+ static void init_amd_zen (struct cpuinfo_x86 * c )
1082
+ {
1083
+ }
1084
+
1085
+ static void init_amd_zen2 (struct cpuinfo_x86 * c )
1086
+ {
1087
+ }
1088
+
1089
+ static void init_amd_zen3 (struct cpuinfo_x86 * c )
1090
+ {
1091
+ }
1092
+
1093
+ static void init_amd_zen4 (struct cpuinfo_x86 * c )
1094
+ {
1095
+ }
1096
+
1040
1097
static void init_amd (struct cpuinfo_x86 * c )
1041
1098
{
1042
1099
u64 vm_cr ;
@@ -1077,6 +1134,15 @@ static void init_amd(struct cpuinfo_x86 *c)
1077
1134
case 0x19 : init_amd_zn (c ); break ;
1078
1135
}
1079
1136
1137
+ if (boot_cpu_has (X86_FEATURE_ZEN ))
1138
+ init_amd_zen (c );
1139
+ else if (boot_cpu_has (X86_FEATURE_ZEN2 ))
1140
+ init_amd_zen2 (c );
1141
+ else if (boot_cpu_has (X86_FEATURE_ZEN3 ))
1142
+ init_amd_zen3 (c );
1143
+ else if (boot_cpu_has (X86_FEATURE_ZEN4 ))
1144
+ init_amd_zen4 (c );
1145
+
1080
1146
/*
1081
1147
* Enable workaround for FXSAVE leak on CPUs
1082
1148
* without a XSaveErPtr feature
0 commit comments