Skip to contentSkip to conversation

x86, microcode: Update BSP's microcode on resume

PATCH New Borislav Petkov 2 participants 2 messages Nov 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, microcode: Update BSP's microcode on resume

Hi guys,

here's one more fix for x86/urgent.

Please apply,
thanks.

---
In the situation when we apply early microcode but do *not* apply late microcode, we fail to update the BSP's microcode on resume because we haven't initialized the uci->mc microcode pointer. So, in order to alleviate that, we go and dig out the stashed microcode patch during early boot. It is basically the same thing that is done on the APs early during boot so do that too here.

---
 arch/x86/kernel/cpu/microcode/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/x86/kernel/cpu/microcode/core.c +8 -0
index dd9d6190b08d..2ce9051174e6 100644
@@ -465,6 +465,14 @@ static void mc_bp_resume(void)
 
 	if (uci->valid && uci->mc)
 		microcode_ops->apply_microcode(cpu);
+	else if (!uci->mc)
+		/*
+		 * We might resume and not have applied late microcode but still
+		 * have a newer patch stashed from the early loader. We don't
+		 * have it in uci->mc so we have to load it the same way we're
+		 * applying patches early on the APs.
+		 */
+		load_ucode_ap();
 }
 
 static struct syscore_ops mc_syscore_ops = {
Signature · 9 lines
2.0.0


-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#1 lore raw

[tip:x86/urgent] x86, microcode: Update BSPs microcode on resume

x86, microcode: Update BSPs microcode on resume
Commit-ID:  fb86b97300d930b57471068720c52bfa8622eab7
Gitweb:     http://git.kernel.org/tip/fb86b97300d930b57471068720c52bfa8622eab7
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 18 Nov 2014 10:46:57 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Tue, 18 Nov 2014 18:32:24 +0100

x86, microcode: Update BSPs microcode on resume

In the situation when we apply early microcode but do *not* apply late microcode, we fail to update the BSP's microcode on resume because we haven't initialized the uci->mc microcode pointer. So, in order to alleviate that, we go and dig out the stashed microcode patch during early boot. It is basically the same thing that is done on the APs early during boot so do that too here.

---
 arch/x86/kernel/cpu/microcode/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/x86/kernel/cpu/microcode/core.c +8 -0
index dd9d619..2ce9051 100644
@@ -465,6 +465,14 @@ static void mc_bp_resume(void)
 
 	if (uci->valid && uci->mc)
 		microcode_ops->apply_microcode(cpu);
+	else if (!uci->mc)
+		/*
+		 * We might resume and not have applied late microcode but still
+		 * have a newer patch stashed from the early loader. We don't
+		 * have it in uci->mc so we have to load it the same way we're
+		 * applying patches early on the APs.
+		 */
+		load_ucode_ap();
 }
 
 static struct syscore_ops mc_syscore_ops = {