]>
Commit | Line | Data |
---|---|---|
7748c0ed SL |
1 | From 7ca5d7073ae0c050abeb874bc6839b6888110c8f Mon Sep 17 00:00:00 2001 |
2 | From: Thomas Lendacky <Thomas.Lendacky@amd.com> | |
3 | Date: Thu, 31 Jan 2019 14:33:06 +0000 | |
4 | Subject: x86/microcode/amd: Don't falsely trick the late loading mechanism | |
5 | ||
6 | [ Upstream commit 912139cfbfa6a2bc1da052314d2c29338dae1f6a ] | |
7 | ||
8 | The load_microcode_amd() function searches for microcode patches and | |
9 | attempts to apply a microcode patch if it is of different level than the | |
10 | currently installed level. | |
11 | ||
12 | While the processor won't actually load a level that is less than | |
13 | what is already installed, the logic wrongly returns UCODE_NEW thus | |
14 | signaling to its caller reload_store() that a late loading should be | |
15 | attempted. | |
16 | ||
17 | If the file-system contains an older microcode revision than what is | |
18 | currently running, such a late microcode reload can result in these | |
19 | misleading 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 | ||
24 | These messages were issued on a system where SME/SEV are not | |
25 | enabled by the BIOS (MSR C001_0010[23] = 0b) because during boot, | |
26 | early_detect_mem_encrypt() is called and cleared the SME and SEV | |
27 | features in this case. | |
28 | ||
29 | However, after the wrong late load attempt, get_cpu_cap() is called and | |
30 | reloads the SME and SEV feature bits, resulting in the messages. | |
31 | ||
32 | Update the microcode level check to not attempt microcode loading if the | |
33 | current level is greater than(!) and not only equal to the current patch | |
34 | level. | |
35 | ||
36 | [ bp: massage commit message. ] | |
37 | ||
38 | Fixes: 2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present") | |
39 | Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> | |
40 | Signed-off-by: Borislav Petkov <bp@suse.de> | |
41 | Cc: "H. Peter Anvin" <hpa@zytor.com> | |
42 | Cc: Ingo Molnar <mingo@redhat.com> | |
43 | Cc: Thomas Gleixner <tglx@linutronix.de> | |
44 | Cc: x86-ml <x86@kernel.org> | |
45 | Link: https://lkml.kernel.org/r/154894518427.9406.8246222496874202773.stgit@tlendack-t1.amdoffice.net | |
46 | Signed-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 | ||
51 | diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c | |
52 | index 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 | -- | |
65 | 2.19.1 | |
66 |