]>
Commit | Line | Data |
---|---|---|
6fa88700 GKH |
1 | From 2d0ed07e828b0ff877ee45b50013f219014494a1 Mon Sep 17 00:00:00 2001 |
2 | From: Prarit Bhargava <prarit@redhat.com> | |
3 | Date: Tue, 31 Jul 2018 07:27:39 -0400 | |
4 | Subject: [PATCH 09/76] x86/microcode: Make sure boot_cpu_data.microcode is | |
5 | up-to-date | |
6 | ||
7 | commit 370a132bb2227ff76278f98370e0e701d86ff752 upstream. | |
8 | ||
9 | When preparing an MCE record for logging, boot_cpu_data.microcode is used | |
10 | to read out the microcode revision on the box. | |
11 | ||
12 | However, on systems where late microcode update has happened, the microcode | |
13 | revision output in a MCE log record is wrong because | |
14 | boot_cpu_data.microcode is not updated when the microcode gets updated. | |
15 | ||
16 | But, the microcode revision saved in boot_cpu_data's microcode member | |
17 | should be kept up-to-date, regardless, for consistency. | |
18 | ||
19 | Make it so. | |
20 | ||
21 | Fixes: fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records") | |
22 | Signed-off-by: Prarit Bhargava <prarit@redhat.com> | |
23 | Signed-off-by: Borislav Petkov <bp@suse.de> | |
24 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
25 | Cc: Tony Luck <tony.luck@intel.com> | |
26 | Cc: sironi@amazon.de | |
27 | Link: http://lkml.kernel.org/r/20180731112739.32338-1-prarit@redhat.com | |
28 | [bwh: Backported to 4.9: adjust context] | |
29 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | |
30 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
31 | --- | |
32 | arch/x86/kernel/cpu/microcode/amd.c | 4 ++++ | |
33 | arch/x86/kernel/cpu/microcode/intel.c | 4 ++++ | |
34 | 2 files changed, 8 insertions(+) | |
35 | ||
36 | diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c | |
37 | index 732bb03fcf91..fdb750e76223 100644 | |
38 | --- a/arch/x86/kernel/cpu/microcode/amd.c | |
39 | +++ b/arch/x86/kernel/cpu/microcode/amd.c | |
40 | @@ -724,6 +724,10 @@ int apply_microcode_amd(int cpu) | |
41 | uci->cpu_sig.rev = mc_amd->hdr.patch_id; | |
42 | c->microcode = mc_amd->hdr.patch_id; | |
43 | ||
44 | + /* Update boot_cpu_data's revision too, if we're on the BSP: */ | |
45 | + if (c->cpu_index == boot_cpu_data.cpu_index) | |
46 | + boot_cpu_data.microcode = mc_amd->hdr.patch_id; | |
47 | + | |
48 | return 0; | |
49 | } | |
50 | ||
51 | diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c | |
52 | index 8faa5fa208d6..4748488bfaaf 100644 | |
53 | --- a/arch/x86/kernel/cpu/microcode/intel.c | |
54 | +++ b/arch/x86/kernel/cpu/microcode/intel.c | |
55 | @@ -958,6 +958,10 @@ static int apply_microcode_intel(int cpu) | |
56 | uci->cpu_sig.rev = rev; | |
57 | c->microcode = rev; | |
58 | ||
59 | + /* Update boot_cpu_data's revision too, if we're on the BSP: */ | |
60 | + if (c->cpu_index == boot_cpu_data.cpu_index) | |
61 | + boot_cpu_data.microcode = rev; | |
62 | + | |
63 | return 0; | |
64 | } | |
65 | ||
66 | -- | |
67 | 2.21.0 | |
68 |