]>
Commit | Line | Data |
---|---|---|
ffc1c2fe SL |
1 | From 6fa756f7aa84827d2e839b8a1ef4360092ecf23d Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Wed, 1 Nov 2023 11:14:59 +0100 | |
4 | Subject: x86/CPU/AMD: Carve out the erratum 1386 fix | |
5 | ||
6 | From: Borislav Petkov (AMD) <bp@alien8.de> | |
7 | ||
8 | [ Upstream commit a7c32a1ae9ee43abfe884f5af376877c4301d166 ] | |
9 | ||
10 | Call it on the affected CPU generations. | |
11 | ||
12 | No functional changes. | |
13 | ||
14 | Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> | |
15 | Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> | |
16 | Link: http://lore.kernel.org/r/20231120104152.13740-3-bp@alien8.de | |
17 | Stable-dep-of: c7b2edd8377b ("perf/x86/amd/core: Update and fix stalled-cycles-* events for Zen 2 and later") | |
18 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
19 | --- | |
20 | arch/x86/kernel/cpu/amd.c | 24 +++++++++++++++--------- | |
21 | 1 file changed, 15 insertions(+), 9 deletions(-) | |
22 | ||
23 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c | |
24 | index 5391385707b3f..28c3a1045b060 100644 | |
25 | --- a/arch/x86/kernel/cpu/amd.c | |
26 | +++ b/arch/x86/kernel/cpu/amd.c | |
27 | @@ -988,6 +988,19 @@ static void init_amd_bd(struct cpuinfo_x86 *c) | |
28 | clear_rdrand_cpuid_bit(c); | |
29 | } | |
30 | ||
31 | +static void fix_erratum_1386(struct cpuinfo_x86 *c) | |
32 | +{ | |
33 | + /* | |
34 | + * Work around Erratum 1386. The XSAVES instruction malfunctions in | |
35 | + * certain circumstances on Zen1/2 uarch, and not all parts have had | |
36 | + * updated microcode at the time of writing (March 2023). | |
37 | + * | |
38 | + * Affected parts all have no supervisor XSAVE states, meaning that | |
39 | + * the XSAVEC instruction (which works fine) is equivalent. | |
40 | + */ | |
41 | + clear_cpu_cap(c, X86_FEATURE_XSAVES); | |
42 | +} | |
43 | + | |
44 | void init_spectral_chicken(struct cpuinfo_x86 *c) | |
45 | { | |
46 | #ifdef CONFIG_CPU_UNRET_ENTRY | |
47 | @@ -1008,15 +1021,6 @@ void init_spectral_chicken(struct cpuinfo_x86 *c) | |
48 | } | |
49 | } | |
50 | #endif | |
51 | - /* | |
52 | - * Work around Erratum 1386. The XSAVES instruction malfunctions in | |
53 | - * certain circumstances on Zen1/2 uarch, and not all parts have had | |
54 | - * updated microcode at the time of writing (March 2023). | |
55 | - * | |
56 | - * Affected parts all have no supervisor XSAVE states, meaning that | |
57 | - * the XSAVEC instruction (which works fine) is equivalent. | |
58 | - */ | |
59 | - clear_cpu_cap(c, X86_FEATURE_XSAVES); | |
60 | } | |
61 | ||
62 | static void init_amd_zn(struct cpuinfo_x86 *c) | |
63 | @@ -1085,10 +1089,12 @@ static void zenbleed_check(struct cpuinfo_x86 *c) | |
64 | ||
65 | static void init_amd_zen(struct cpuinfo_x86 *c) | |
66 | { | |
67 | + fix_erratum_1386(c); | |
68 | } | |
69 | ||
70 | static void init_amd_zen2(struct cpuinfo_x86 *c) | |
71 | { | |
72 | + fix_erratum_1386(c); | |
73 | } | |
74 | ||
75 | static void init_amd_zen3(struct cpuinfo_x86 *c) | |
76 | -- | |
77 | 2.43.0 | |
78 |