Skip to contentSkip to conversation

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

PATCH Superseded John Allen 2 participants 3 messages Sep 23, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

John Allen

author
#0 lore raw

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

A problem was introduced with f69759b ("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 is 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")
---
 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
author
#1 lore raw
Quoted 10 lines · John Allen

A problem was introduced with f69759b ("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 is 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.

Quoted 3 lines

Call into the zenbleed fix path on Zen2 cpus only.

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

Should probably go into stable as well.

Quoted 20 lines
---
 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
maintainer Acked-by me on v1 1/1
#2 lore raw
In reply to John Allen
Quoted 1 line · John Allen

A problem was introduced with f69759b ("x86/CPU/AMD: Move Zenbleed check to

Use 12 chars for the commit id.

Quoted 6 lines

the Zen2 init function") where a bit in the DE_CFG MSR is getting set after a microcode late load.

The problem is 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

End all function names with "()".

Quoted 4 lines

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.

s/cpus/CPUs/g

And yes, it should be cc:stable.

With all that addressed, you can add:

Acked-by me

to the patch.

Thx.

Signature · 1 line
Sent from a small device: formatting sucks and brevity is inevitable.