Skip to contentSkip to conversation

x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

PATCH Applied John Allen 2 participants 2 messages Sep 23, 2024 – Oct 11, 2024

Subsystems (2)
lore
Share & tools
lore

John Allen

author
#0 lore raw

PATCH v2 1/1 x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

A problem was introduced with commit f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function") where a bit in the DE_CFG MSR is getting set after a microcode late load.

The problem seems to be that the microcode late load path calls into amd_check_microcode() and subsequently zen2_zenbleed_check(). Since the patch removes the cpu_has_amd_erratum() check from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go through the function and set the bit in the DE_CFG MSR.

Call into the zenbleed fix path on Zen2 CPUs only.

Fixes f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

---
v2:
- Clean up commit description

---
 arch/x86/kernel/cpu/amd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +2 -1
index 015971adadfc..368344e1394b 100644
@@ -1202,5 +1202,6 @@ void amd_check_microcode(void)
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
 		return;
 
-	on_each_cpu(zenbleed_check_cpu, NULL, 1);
+	if (boot_cpu_has(X86_FEATURE_ZEN2))
+		on_each_cpu(zenbleed_check_cpu, NULL, 1);
 }
Signature · 1 line
2.34.1
merge bot Applied
#1 lore raw
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:     ee4d4e8d2c3bec6ee652599ab31991055a72c322
Gitweb:        https://git.kernel.org/tip/ee4d4e8d2c3bec6ee652599ab31991055a72c322
Author:        John Allen <[email protected]>
AuthorDate:    Mon, 23 Sep 2024 16:44:04 
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Fri, 11 Oct 2024 21:26:45 +02:00

x86/CPU/AMD: Only apply Zenbleed fix for Zen2 during late microcode load

Commit

f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")

causes a bit in the DE_CFG MSR to get set erroneously after a microcode late load.

The microcode late load path calls into amd_check_microcode() and subsequently zen2_zenbleed_check(). Since the above commit removes the cpu_has_amd_erratum() call from zen2_zenbleed_check(), this will cause all non-Zen2 CPUs to go through the function and set the bit in the DE_CFG MSR.

Call into the Zenbleed fix path on Zen2 CPUs only.

[ bp: Massage commit message, use cpu_feature_enabled(). ]

Fixes f69759be251d ("x86/CPU/AMD: Move Zenbleed check to the Zen2 init function")
---
 arch/x86/kernel/cpu/amd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +2 -1
index 015971a..fab5cae 100644
@@ -1202,5 +1202,6 @@ void amd_check_microcode(void)
 	if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
 		return;
 
-	on_each_cpu(zenbleed_check_cpu, NULL, 1);
+	if (cpu_feature_enabled(X86_FEATURE_ZEN2))
+		on_each_cpu(zenbleed_check_cpu, NULL, 1);
 }