x86/CPU/AMD: Add X86_FEATURE_ZEN5
Borislav Petkov
maintainerPATCH 1/1 x86/CPU/AMD: Add X86_FEATURE_ZEN5
From: "Borislav Petkov (AMD)" <[email protected]>
Add a synthetic feature flag for Zen5.
Signed-off-by Borislav Petkov (AMD) <[email protected]>
--- arch/x86/include/asm/cpufeatures.h | 4 +--- arch/x86/kernel/cpu/amd.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -3
@@ -81,10 +81,8 @@#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ - -/* CPU types for specific tunings: */ #define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ -/* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */ +#define X86_FEATURE_ZEN5 ( 3*32+ 5)/* "" CPU based on Zen5 microarchitecture */ #define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */
arch/x86/kernel/cpu/amd.c +21 -4
@@ -538,7 +538,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)/* Figure out Zen generations: */ switch (c->x86) { -case 0x17 : { +case 0x17 :switch (c->x86_model) { case 0x00 ... 0x2f: case 0x50 ... 0x5f:
@@ -554,8 +554,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } -case 0x19 : { + +case 0x19 :switch (c->x86_model) { case 0x00 ... 0x0f: case 0x20 ... 0x5f:
@@ -569,7 +569,17 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } + +case 0x1a : +switch (c->x86_model) { + case 0x00 ... 0x0f: +setup_force_cpu_cap (X86_FEATURE_ZEN5 ); +break ; +default : + goto warn; + } +break ; +default :break ; }
@@ -1039,6 +1049,11 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)msr_set_bit (MSR_ZEN4_BP_CFG ,MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT ); } +static void init_amd_zen5 (struct cpuinfo_x86 *c) +{ +init_amd_zen_common (); +} +static void init_amd (struct cpuinfo_x86 *c) {u64 vm_cr;
@@ -1084,6 +1099,8 @@ static void init_amd(struct cpuinfo_x86 *c)init_amd_zen3 (c); else if (boot_cpu_has(X86_FEATURE_ZEN4)) init_amd_zen4(c); + else if (boot_cpu_has(X86_FEATURE_ZEN5)) + init_amd_zen5(c);/* * Enable workaround for FXSAVE leak on CPUs
Signature · 1 line
2.42.0.rc0.25.ga82fb66fed25
The following commit has been merged into the x86/cpu branch of tip:
The following commit has been merged into the x86/cpu branch of tip:
Commit-ID: bbfc72531ee7ae1617b39869022ea28b9b6a1b36 Gitweb: https://git.kernel.org/tip/bbfc72531ee7ae1617b39869022ea28b9b6a1b36 Author: Borislav Petkov (AMD) <[email protected]> AuthorDate: Thu, 04 Jan 2024 21:11:37 +01:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Mon, 22 Jan 2024 11:13:37 +01:00
x86/CPU/AMD: Add X86_FEATURE_ZEN5
Add a synthetic feature flag for Zen5.
Signed-off-by Borislav Petkov (AMD) <[email protected]>
--- arch/x86/include/asm/cpufeatures.h | 4 +--- arch/x86/kernel/cpu/amd.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -3
@@ -81,10 +81,8 @@#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ - -/* CPU types for specific tunings: */ #define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ -/* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */ +#define X86_FEATURE_ZEN5 ( 3*32+ 5)/* "" CPU based on Zen5 microarchitecture */ #define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */
arch/x86/kernel/cpu/amd.c +21 -4
@@ -538,7 +538,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)/* Figure out Zen generations: */ switch (c->x86) { -case 0x17 : { +case 0x17 :switch (c->x86_model) { case 0x00 ... 0x2f: case 0x50 ... 0x5f:
@@ -554,8 +554,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } -case 0x19 : { + +case 0x19 :switch (c->x86_model) { case 0x00 ... 0x0f: case 0x20 ... 0x5f:
@@ -569,7 +569,17 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } + +case 0x1a : +switch (c->x86_model) { + case 0x00 ... 0x0f: +setup_force_cpu_cap (X86_FEATURE_ZEN5 ); +break ; +default : + goto warn; + } +break ; +default :break ; }
@@ -1039,6 +1049,11 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)msr_set_bit (MSR_ZEN4_BP_CFG ,MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT ); } +static void init_amd_zen5 (struct cpuinfo_x86 *c) +{ +init_amd_zen_common (); +} +static void init_amd (struct cpuinfo_x86 *c) {u64 vm_cr;
@@ -1084,6 +1099,8 @@ static void init_amd(struct cpuinfo_x86 *c)init_amd_zen3 (c); else if (boot_cpu_has(X86_FEATURE_ZEN4)) init_amd_zen4(c); + else if (boot_cpu_has(X86_FEATURE_ZEN5)) + init_amd_zen5(c);/* * Enable workaround for FXSAVE leak on CPUs
The following commit has been merged into the x86/urgent branch of tip:
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 3e4147f33f8b647775357bae0248b9a2aeebfcd2 Gitweb: https://git.kernel.org/tip/3e4147f33f8b647775357bae0248b9a2aeebfcd2 Author: Borislav Petkov (AMD) <[email protected]> AuthorDate: Thu, 04 Jan 2024 21:11:37 +01:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Tue, 23 Jan 2024 11:06:18 +01:00
x86/CPU/AMD: Add X86_FEATURE_ZEN5
Add a synthetic feature flag for Zen5.
Signed-off-by Borislav Petkov (AMD) <[email protected]>
--- arch/x86/include/asm/cpufeatures.h | 4 +--- arch/x86/kernel/cpu/amd.c | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-)
arch/x86/include/asm/cpufeatures.h +1 -3
@@ -81,10 +81,8 @@#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ - -/* CPU types for specific tunings: */ #define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ -/* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */ +#define X86_FEATURE_ZEN5 ( 3*32+ 5)/* "" CPU based on Zen5 microarchitecture */ #define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */
arch/x86/kernel/cpu/amd.c +21 -4
@@ -538,7 +538,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)/* Figure out Zen generations: */ switch (c->x86) { -case 0x17 : { +case 0x17 :switch (c->x86_model) { case 0x00 ... 0x2f: case 0x50 ... 0x5f:
@@ -554,8 +554,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } -case 0x19 : { + +case 0x19 :switch (c->x86_model) { case 0x00 ... 0x0f: case 0x20 ... 0x5f:
@@ -569,7 +569,17 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) goto warn; }break ; - } + +case 0x1a : +switch (c->x86_model) { + case 0x00 ... 0x0f: +setup_force_cpu_cap (X86_FEATURE_ZEN5 ); +break ; +default : + goto warn; + } +break ; +default :break ; }
@@ -1039,6 +1049,11 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)msr_set_bit (MSR_ZEN4_BP_CFG ,MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT ); } +static void init_amd_zen5 (struct cpuinfo_x86 *c) +{ +init_amd_zen_common (); +} +static void init_amd (struct cpuinfo_x86 *c) {u64 vm_cr;
@@ -1084,6 +1099,8 @@ static void init_amd(struct cpuinfo_x86 *c)init_amd_zen3 (c); else if (boot_cpu_has(X86_FEATURE_ZEN4)) init_amd_zen4(c); + else if (boot_cpu_has(X86_FEATURE_ZEN5)) + init_amd_zen5(c);/* * Enable workaround for FXSAVE leak on CPUs