aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrarit Bhargava <prarit@redhat.com>2018-07-31 07:27:39 -0400
committerThomas Gleixner <tglx@linutronix.de>2018-09-02 08:10:54 -0400
commit370a132bb2227ff76278f98370e0e701d86ff752 (patch)
treeafab066cc0e9a56a2ab1dc197b52e5a07aee599a
parentff924c5a1ec7548825cc2d07980b03be4224ffac (diff)
x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
When preparing an MCE record for logging, boot_cpu_data.microcode is used to read out the microcode revision on the box. However, on systems where late microcode update has happened, the microcode revision output in a MCE log record is wrong because boot_cpu_data.microcode is not updated when the microcode gets updated. But, the microcode revision saved in boot_cpu_data's microcode member should be kept up-to-date, regardless, for consistency. Make it so. Fixes: fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records") Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: sironi@amazon.de Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20180731112739.32338-1-prarit@redhat.com
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c4
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 0624957aa068..602f17134103 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -537,6 +537,10 @@ static enum ucode_state apply_microcode_amd(int cpu)
537 uci->cpu_sig.rev = mc_amd->hdr.patch_id; 537 uci->cpu_sig.rev = mc_amd->hdr.patch_id;
538 c->microcode = mc_amd->hdr.patch_id; 538 c->microcode = mc_amd->hdr.patch_id;
539 539
540 /* Update boot_cpu_data's revision too, if we're on the BSP: */
541 if (c->cpu_index == boot_cpu_data.cpu_index)
542 boot_cpu_data.microcode = mc_amd->hdr.patch_id;
543
540 return UCODE_UPDATED; 544 return UCODE_UPDATED;
541} 545}
542 546
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 97ccf4c3b45b..256d336cbc04 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -851,6 +851,10 @@ static enum ucode_state apply_microcode_intel(int cpu)
851 uci->cpu_sig.rev = rev; 851 uci->cpu_sig.rev = rev;
852 c->microcode = rev; 852 c->microcode = rev;
853 853
854 /* Update boot_cpu_data's revision too, if we're on the BSP: */
855 if (c->cpu_index == boot_cpu_data.cpu_index)
856 boot_cpu_data.microcode = rev;
857
854 return UCODE_UPDATED; 858 return UCODE_UPDATED;
855} 859}
856 860