Skip to content

Commit 370a132

Browse files
praritKAGA-KOKO
authored andcommitted
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: fa94d0c ("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
1 parent ff924c5 commit 370a132

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/x86/kernel/cpu/microcode/amd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ static enum ucode_state apply_microcode_amd(int cpu)
537537
uci->cpu_sig.rev = mc_amd->hdr.patch_id;
538538
c->microcode = mc_amd->hdr.patch_id;
539539

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+
540544
return UCODE_UPDATED;
541545
}
542546

arch/x86/kernel/cpu/microcode/intel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,10 @@ static enum ucode_state apply_microcode_intel(int cpu)
851851
uci->cpu_sig.rev = rev;
852852
c->microcode = rev;
853853

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+
854858
return UCODE_UPDATED;
855859
}
856860

0 commit comments

Comments
 (0)