diff options
author | Borislav Petkov <bp@suse.de> | 2018-03-14 14:36:14 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-03-16 15:55:51 -0400 |
commit | 2613f36ed965d0e5a595a1d931fd3b480e82d6fd (patch) | |
tree | 47c242f71716d90d80c84f6e8c2ac576737fc4a3 /arch/x86/kernel/cpu/microcode/intel.c | |
parent | e3b3121fa8da94cb20f9e0c64ab7981ae47fd085 (diff) |
x86/microcode: Attempt late loading only when new microcode is present
Return UCODE_NEW from the scanning functions to denote that new microcode
was found and only then attempt the expensive synchronization dance.
Reported-by: Emanuel Czirai <xftroxgpx@protonmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Emanuel Czirai <xftroxgpx@protonmail.com>
Tested-by: Ashok Raj <ashok.raj@intel.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lkml.kernel.org/r/20180314183615.17629-1-bp@alien8.de
Diffstat (limited to 'arch/x86/kernel/cpu/microcode/intel.c')
-rw-r--r-- | arch/x86/kernel/cpu/microcode/intel.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 2aded9db1d42..32b8e5724f96 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c | |||
@@ -862,6 +862,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
862 | unsigned int leftover = size; | 862 | unsigned int leftover = size; |
863 | unsigned int curr_mc_size = 0, new_mc_size = 0; | 863 | unsigned int curr_mc_size = 0, new_mc_size = 0; |
864 | unsigned int csig, cpf; | 864 | unsigned int csig, cpf; |
865 | enum ucode_state ret = UCODE_OK; | ||
865 | 866 | ||
866 | while (leftover) { | 867 | while (leftover) { |
867 | struct microcode_header_intel mc_header; | 868 | struct microcode_header_intel mc_header; |
@@ -903,6 +904,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
903 | new_mc = mc; | 904 | new_mc = mc; |
904 | new_mc_size = mc_size; | 905 | new_mc_size = mc_size; |
905 | mc = NULL; /* trigger new vmalloc */ | 906 | mc = NULL; /* trigger new vmalloc */ |
907 | ret = UCODE_NEW; | ||
906 | } | 908 | } |
907 | 909 | ||
908 | ucode_ptr += mc_size; | 910 | ucode_ptr += mc_size; |
@@ -932,7 +934,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
932 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", | 934 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", |
933 | cpu, new_rev, uci->cpu_sig.rev); | 935 | cpu, new_rev, uci->cpu_sig.rev); |
934 | 936 | ||
935 | return UCODE_OK; | 937 | return ret; |
936 | } | 938 | } |
937 | 939 | ||
938 | static int get_ucode_fw(void *to, const void *from, size_t n) | 940 | static int get_ucode_fw(void *to, const void *from, size_t n) |