diff options
author | Borislav Petkov <bp@suse.de> | 2015-02-09 16:59:51 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-03-02 14:31:51 -0500 |
commit | 02f35177fb00ee0d73f9af2d6006af6b75b58c11 (patch) | |
tree | bd3a5d80c228e4de949cc62b549832743052ebfe /arch/x86 | |
parent | 2d48bb9b6ec6fb0f28e5135fd080edc23152ae45 (diff) |
x86/microcode/intel: Simplify load_ucode_intel_bsp()
Don't compute start and end from start and size in order to compute size
again down the path in scan_microcode(). So pass size directly instead
and simplify a bunch. Shorten variable names and remove useless ones.
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/microcode/intel_early.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c index ed30bc77dd38..34a2ff9217f8 100644 --- a/arch/x86/kernel/cpu/microcode/intel_early.c +++ b/arch/x86/kernel/cpu/microcode/intel_early.c | |||
@@ -552,12 +552,10 @@ EXPORT_SYMBOL_GPL(save_mc_for_early); | |||
552 | 552 | ||
553 | static __initdata char ucode_name[] = "kernel/x86/microcode/GenuineIntel.bin"; | 553 | static __initdata char ucode_name[] = "kernel/x86/microcode/GenuineIntel.bin"; |
554 | static __init enum ucode_state | 554 | static __init enum ucode_state |
555 | scan_microcode(unsigned long start, unsigned long end, | 555 | scan_microcode(unsigned long start, unsigned long size, |
556 | struct mc_saved_data *mc_saved_data, | 556 | struct mc_saved_data *mc_saved_data, |
557 | unsigned long *mc_saved_in_initrd, | 557 | unsigned long *mc_saved_in_initrd, struct ucode_cpu_info *uci) |
558 | struct ucode_cpu_info *uci) | ||
559 | { | 558 | { |
560 | unsigned int size = end - start + 1; | ||
561 | struct cpio_data cd; | 559 | struct cpio_data cd; |
562 | long offset = 0; | 560 | long offset = 0; |
563 | #ifdef CONFIG_X86_32 | 561 | #ifdef CONFIG_X86_32 |
@@ -573,7 +571,6 @@ scan_microcode(unsigned long start, unsigned long end, | |||
573 | if (!cd.data) | 571 | if (!cd.data) |
574 | return UCODE_ERROR; | 572 | return UCODE_ERROR; |
575 | 573 | ||
576 | |||
577 | return get_matching_model_microcode(0, start, cd.data, cd.size, | 574 | return get_matching_model_microcode(0, start, cd.data, cd.size, |
578 | mc_saved_data, mc_saved_in_initrd, | 575 | mc_saved_data, mc_saved_in_initrd, |
579 | uci); | 576 | uci); |
@@ -721,50 +718,40 @@ int __init save_microcode_in_initrd_intel(void) | |||
721 | static void __init | 718 | static void __init |
722 | _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data, | 719 | _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data, |
723 | unsigned long *mc_saved_in_initrd, | 720 | unsigned long *mc_saved_in_initrd, |
724 | unsigned long initrd_start_early, | 721 | unsigned long start, unsigned long size) |
725 | unsigned long initrd_end_early) | ||
726 | { | 722 | { |
727 | struct ucode_cpu_info uci; | 723 | struct ucode_cpu_info uci; |
728 | enum ucode_state ret; | 724 | enum ucode_state ret; |
729 | 725 | ||
730 | collect_cpu_info_early(&uci); | 726 | collect_cpu_info_early(&uci); |
731 | scan_microcode(initrd_start_early, initrd_end_early, mc_saved_data, | 727 | scan_microcode(start, size, mc_saved_data, mc_saved_in_initrd, &uci); |
732 | mc_saved_in_initrd, &uci); | ||
733 | 728 | ||
734 | ret = load_microcode(mc_saved_data, mc_saved_in_initrd, | 729 | ret = load_microcode(mc_saved_data, mc_saved_in_initrd, start, &uci); |
735 | initrd_start_early, &uci); | ||
736 | if (ret != UCODE_OK) | 730 | if (ret != UCODE_OK) |
737 | return; | 731 | return; |
738 | 732 | ||
739 | apply_microcode_early(&uci, true); | 733 | apply_microcode_early(&uci, true); |
740 | } | 734 | } |
741 | 735 | ||
742 | void __init | 736 | void __init load_ucode_intel_bsp(void) |
743 | load_ucode_intel_bsp(void) | ||
744 | { | 737 | { |
745 | u64 ramdisk_image, ramdisk_size; | 738 | u64 start, size; |
746 | unsigned long initrd_start_early, initrd_end_early; | ||
747 | #ifdef CONFIG_X86_32 | 739 | #ifdef CONFIG_X86_32 |
748 | struct boot_params *boot_params_p; | 740 | struct boot_params *p; |
749 | 741 | ||
750 | boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params); | 742 | p = (struct boot_params *)__pa_nodebug(&boot_params); |
751 | ramdisk_image = boot_params_p->hdr.ramdisk_image; | 743 | start = p->hdr.ramdisk_image; |
752 | ramdisk_size = boot_params_p->hdr.ramdisk_size; | 744 | size = p->hdr.ramdisk_size; |
753 | initrd_start_early = ramdisk_image; | ||
754 | initrd_end_early = initrd_start_early + ramdisk_size; | ||
755 | 745 | ||
756 | _load_ucode_intel_bsp( | 746 | _load_ucode_intel_bsp( |
757 | (struct mc_saved_data *)__pa_nodebug(&mc_saved_data), | 747 | (struct mc_saved_data *)__pa_nodebug(&mc_saved_data), |
758 | (unsigned long *)__pa_nodebug(&mc_saved_in_initrd), | 748 | (unsigned long *)__pa_nodebug(&mc_saved_in_initrd), |
759 | initrd_start_early, initrd_end_early); | 749 | start, size); |
760 | #else | 750 | #else |
761 | ramdisk_image = boot_params.hdr.ramdisk_image; | 751 | start = boot_params.hdr.ramdisk_image + PAGE_OFFSET; |
762 | ramdisk_size = boot_params.hdr.ramdisk_size; | 752 | size = boot_params.hdr.ramdisk_size; |
763 | initrd_start_early = ramdisk_image + PAGE_OFFSET; | ||
764 | initrd_end_early = initrd_start_early + ramdisk_size; | ||
765 | 753 | ||
766 | _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, | 754 | _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, start, size); |
767 | initrd_start_early, initrd_end_early); | ||
768 | #endif | 755 | #endif |
769 | } | 756 | } |
770 | 757 | ||