Commit e8c28e09 authored by Borislav Petkov's avatar Borislav Petkov Committed by Greg Kroah-Hartman

x86/microcode/intel: Make early loader look for builtin microcode too

commit 264285ac upstream.

Set the initrd @start depending on the presence of an initrd. Otherwise,
builtin microcode loading doesn't work as the start is wrong and we're
using it to compute offset to the microcode blobs.
Tested-by: default avatarThomas Voegtle <tv@lio96.de>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1454499225-21544-3-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 19e0783a
...@@ -555,10 +555,14 @@ scan_microcode(struct mc_saved_data *mc_saved_data, unsigned long *initrd, ...@@ -555,10 +555,14 @@ scan_microcode(struct mc_saved_data *mc_saved_data, unsigned long *initrd,
cd.data = NULL; cd.data = NULL;
cd.size = 0; cd.size = 0;
cd = find_cpio_data(p, (void *)start, size, &offset); /* try built-in microcode if no initrd */
if (!cd.data) { if (!size) {
if (!load_builtin_intel_microcode(&cd)) if (!load_builtin_intel_microcode(&cd))
return UCODE_ERROR; return UCODE_ERROR;
} else {
cd = find_cpio_data(p, (void *)start, size, &offset);
if (!cd.data)
return UCODE_ERROR;
} }
return get_matching_model_microcode(0, start, cd.data, cd.size, return get_matching_model_microcode(0, start, cd.data, cd.size,
...@@ -732,16 +736,20 @@ void __init load_ucode_intel_bsp(void) ...@@ -732,16 +736,20 @@ void __init load_ucode_intel_bsp(void)
struct boot_params *p; struct boot_params *p;
p = (struct boot_params *)__pa_nodebug(&boot_params); p = (struct boot_params *)__pa_nodebug(&boot_params);
start = p->hdr.ramdisk_image;
size = p->hdr.ramdisk_size; size = p->hdr.ramdisk_size;
_load_ucode_intel_bsp( /*
(struct mc_saved_data *)__pa_nodebug(&mc_saved_data), * Set start only if we have an initrd image. We cannot use initrd_start
* because it is not set that early yet.
*/
start = (size ? p->hdr.ramdisk_image : 0);
_load_ucode_intel_bsp((struct mc_saved_data *)__pa_nodebug(&mc_saved_data),
(unsigned long *)__pa_nodebug(&mc_saved_in_initrd), (unsigned long *)__pa_nodebug(&mc_saved_in_initrd),
start, size); start, size);
#else #else
start = boot_params.hdr.ramdisk_image + PAGE_OFFSET;
size = boot_params.hdr.ramdisk_size; size = boot_params.hdr.ramdisk_size;
start = (size ? boot_params.hdr.ramdisk_image + PAGE_OFFSET : 0);
_load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, start, size); _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, start, size);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment