Skip to content

Commit 3e4147f

Browse files
committed
x86/CPU/AMD: Add X86_FEATURE_ZEN5
Add a synthetic feature flag for Zen5. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240104201138.5072-1-bp@alien8.de
1 parent f7cfe70 commit 3e4147f

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,8 @@
8181
#define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */
8282
#define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */
8383
#define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */
84-
85-
/* CPU types for specific tunings: */
8684
#define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */
87-
/* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */
85+
#define X86_FEATURE_ZEN5 ( 3*32+ 5) /* "" CPU based on Zen5 microarchitecture */
8886
#define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */
8987
#define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */
9088
#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */

arch/x86/kernel/cpu/amd.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
538538

539539
/* Figure out Zen generations: */
540540
switch (c->x86) {
541-
case 0x17: {
541+
case 0x17:
542542
switch (c->x86_model) {
543543
case 0x00 ... 0x2f:
544544
case 0x50 ... 0x5f:
@@ -554,8 +554,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
554554
goto warn;
555555
}
556556
break;
557-
}
558-
case 0x19: {
557+
558+
case 0x19:
559559
switch (c->x86_model) {
560560
case 0x00 ... 0x0f:
561561
case 0x20 ... 0x5f:
@@ -569,7 +569,17 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
569569
goto warn;
570570
}
571571
break;
572-
}
572+
573+
case 0x1a:
574+
switch (c->x86_model) {
575+
case 0x00 ... 0x0f:
576+
setup_force_cpu_cap(X86_FEATURE_ZEN5);
577+
break;
578+
default:
579+
goto warn;
580+
}
581+
break;
582+
573583
default:
574584
break;
575585
}
@@ -1039,6 +1049,11 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)
10391049
msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
10401050
}
10411051

1052+
static void init_amd_zen5(struct cpuinfo_x86 *c)
1053+
{
1054+
init_amd_zen_common();
1055+
}
1056+
10421057
static void init_amd(struct cpuinfo_x86 *c)
10431058
{
10441059
u64 vm_cr;
@@ -1084,6 +1099,8 @@ static void init_amd(struct cpuinfo_x86 *c)
10841099
init_amd_zen3(c);
10851100
else if (boot_cpu_has(X86_FEATURE_ZEN4))
10861101
init_amd_zen4(c);
1102+
else if (boot_cpu_has(X86_FEATURE_ZEN5))
1103+
init_amd_zen5(c);
10871104

10881105
/*
10891106
* Enable workaround for FXSAVE leak on CPUs

0 commit comments

Comments
 (0)