]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.29/x86-microcode-amd-don-t-falsely-trick-the-late-loadi.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.19.29 / x86-microcode-amd-don-t-falsely-trick-the-late-loadi.patch
CommitLineData
7748c0ed
SL
1From 7ca5d7073ae0c050abeb874bc6839b6888110c8f Mon Sep 17 00:00:00 2001
2From: Thomas Lendacky <Thomas.Lendacky@amd.com>
3Date: Thu, 31 Jan 2019 14:33:06 +0000
4Subject: x86/microcode/amd: Don't falsely trick the late loading mechanism
5
6[ Upstream commit 912139cfbfa6a2bc1da052314d2c29338dae1f6a ]
7
8The load_microcode_amd() function searches for microcode patches and
9attempts to apply a microcode patch if it is of different level than the
10currently installed level.
11
12While the processor won't actually load a level that is less than
13what is already installed, the logic wrongly returns UCODE_NEW thus
14signaling to its caller reload_store() that a late loading should be
15attempted.
16
17If the file-system contains an older microcode revision than what is
18currently running, such a late microcode reload can result in these
19misleading messages:
20
21 x86/CPU: CPU features have changed after loading microcode, but might not take effect.
22 x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.
23
24These messages were issued on a system where SME/SEV are not
25enabled by the BIOS (MSR C001_0010[23] = 0b) because during boot,
26early_detect_mem_encrypt() is called and cleared the SME and SEV
27features in this case.
28
29However, after the wrong late load attempt, get_cpu_cap() is called and
30reloads the SME and SEV feature bits, resulting in the messages.
31
32Update the microcode level check to not attempt microcode loading if the
33current level is greater than(!) and not only equal to the current patch
34level.
35
36 [ bp: massage commit message. ]
37
38Fixes: 2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present")
39Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
40Signed-off-by: Borislav Petkov <bp@suse.de>
41Cc: "H. Peter Anvin" <hpa@zytor.com>
42Cc: Ingo Molnar <mingo@redhat.com>
43Cc: Thomas Gleixner <tglx@linutronix.de>
44Cc: x86-ml <x86@kernel.org>
45Link: https://lkml.kernel.org/r/154894518427.9406.8246222496874202773.stgit@tlendack-t1.amdoffice.net
46Signed-off-by: Sasha Levin <sashal@kernel.org>
47---
48 arch/x86/kernel/cpu/microcode/amd.c | 2 +-
49 1 file changed, 1 insertion(+), 1 deletion(-)
50
51diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
52index 07b5fc00b188..a4e7e100ed26 100644
53--- a/arch/x86/kernel/cpu/microcode/amd.c
54+++ b/arch/x86/kernel/cpu/microcode/amd.c
55@@ -707,7 +707,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
56 if (!p) {
57 return ret;
58 } else {
59- if (boot_cpu_data.microcode == p->patch_id)
60+ if (boot_cpu_data.microcode >= p->patch_id)
61 return ret;
62
63 ret = UCODE_NEW;
64--
652.19.1
66