x86/microcode changes for v3.11
Subsystems (2)
Linus,
Please pull the latest x86-microcode-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-microcode-for-linus
HEAD: 9608d33b8210c993af4430d661a6474946480c9b x86, microcode, amd: Another early loading fixup
Two main changes that improve microcode loading on AMD CPUs:
- Add support for all-in-one binary microcode files that concatenate the microcode images of multiple processor families, by Jacob Shin
- Add early microcode loading (embedded in the initrd) support, by Jacob Shin
Thanks,
Ingo
------------------>
Borislav Petkov (1):
x86, microcode, intel: Correct typo in printk
Jacob Shin (7):
x86, microcode: Vendor abstract out save_microcode_in_initrd() x86, microcode, amd: Refactor functions to prepare for early loading x86, microcode, amd: Early microcode patch loading support for AMD x86, microcode, amd: Fix warnings and errors on with CONFIG_MICROCODE=m x86, microcode, amd: Make find_ucode_in_initrd() __init
x86, microcode, amd: Allow multiple families' bin files appended together x86, microcode, amd: Another early loading fixup
Documentation/x86/early-microcode.txt | 11 +- arch/x86/Kconfig | 14 +- arch/x86/include/asm/microcode_amd.h | 78 +++++++++ arch/x86/include/asm/microcode_intel.h | 2 + arch/x86/kernel/Makefile | 1 + arch/x86/kernel/microcode_amd.c | 133 +++++++------- arch/x86/kernel/microcode_amd_early.c | 302 ++++++++++++++++++++++++++++++++ arch/x86/kernel/microcode_core_early.c | 49 +++++- arch/x86/kernel/microcode_intel_early.c | 6 +- 9 files changed, 509 insertions(+), 87 deletions(-) create mode 100644 arch/x86/include/asm/microcode_amd.h create mode 100644 arch/x86/kernel/microcode_amd_early.c
Documentation/x86/early-microcode.txt +5 -6
@@ -11,7 +11,8 @@ file and loaded to CPUs during boot time. The format of the combined initrd image is microcode in cpio format followed by the initrd image (maybe compressed). Kernel parses the combined initrd image during boot time. The microcode file in cpio name space is: -kernel/x86/microcode/GenuineIntel.bin +on Intel: kernel/x86/microcode/GenuineIntel.bin +on AMD : kernel/x86/microcode/AuthenticAMD.bin During BSP boot (before SMP starts), if the kernel finds the microcode file in the initrd file, it parses the microcode and saves matching microcode in memory.
@@ -34,10 +35,8 @@ original initrd image /boot/initrd-3.5.0.img. mkdir initrd cd initrd -mkdir kernel -mkdir kernel/x86 -mkdir kernel/x86/microcode -cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin -find .|cpio -oc >../ucode.cpio +mkdir -p kernel/x86/microcode +cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin (or AuthenticAMD.bin) +find . | cpio -o -H newc >../ucode.cpio cd .. cat ucode.cpio /boot/initrd-3.5.0.img >/boot/initrd-3.5.0.ucode.img
arch/x86/Kconfig +9 -5
@@ -1058,8 +1058,16 @@ config MICROCODE_INTEL_LIB depends on MICROCODE_INTEL config MICROCODE_INTEL_EARLY + def_bool n + +config MICROCODE_AMD_EARLY + def_bool n + +config MICROCODE_EARLY bool "Early load microcode" - depends on MICROCODE_INTEL && BLK_DEV_INITRD + depends on MICROCODE=y && BLK_DEV_INITRD + select MICROCODE_INTEL_EARLY if MICROCODE_INTEL + select MICROCODE_AMD_EARLY if MICROCODE_AMD default y help This option provides functionality to read additional microcode data
@@ -1067,10 +1075,6 @@ config MICROCODE_INTEL_EARLY microcode to CPU's as early as possible. No functional change if no microcode data is glued to the initrd, therefore it's safe to say Y. -config MICROCODE_EARLY - def_bool y - depends on MICROCODE_INTEL_EARLY - config X86_MSR tristate "/dev/cpu/*/msr - Model-specific register support" ---help---
arch/x86/include/asm/microcode_amd.h new file +78 -0
78 lines not on this page · raw message
arch/x86/include/asm/microcode_intel.h +2 -0
@@ -67,10 +67,12 @@ update_match_revision(struct microcode_header_intel *mc_header, int rev);extern void __init load_ucode_intel_bsp (void );extern void __cpuinit load_ucode_intel_ap (void );extern void show_ucode_info_early (void ); +extern int __init save_microcode_in_initrd_intel (void );#else static inline __init void load_ucode_intel_bsp (void ) {}static inline __cpuinit void load_ucode_intel_ap (void ) {}static inline void show_ucode_info_early (void ) {} +static inline int __init save_microcode_in_initrd_intel (void ) {return -EINVAL ; }#endif #if defined(CONFIG_MICROCODE_INTEL_EARLY ) && defined(CONFIG_HOTPLUG_CPU )
arch/x86/kernel/Makefile +1 -0
@@ -93,6 +93,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o microcode-y := microcode_core.o microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o +obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o obj-$(CONFIG_MICROCODE) += microcode.o obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
arch/x86/kernel/microcode_amd.c +64 -69
200 lines not on this page · raw message
arch/x86/kernel/microcode_amd_early.c new file +302 -0
302 lines not on this page · raw message
arch/x86/kernel/microcode_core_early.c +45 -4
65 lines not on this page · raw message
arch/x86/kernel/microcode_intel_early.c +3 -3
@@ -529,7 +529,7 @@ int save_mc_for_early(u8 *mc)*/ ret =save_microcode (&mc_saved_data, mc_saved_tmp, mc_saved_count);if (ret) { -pr_err ("Can not save microcode patch.\n" ); +pr_err ("Cannot save microcode patch.\n" ); goto out; }
@@ -699,7 +699,7 @@ static int __cpuinit apply_microcode_early(struct mc_saved_data *mc_saved_data,* This function converts microcode patch offsets previously stored in * mc_saved_in_initrd to pointers and stores the pointers in mc_saved_data. */ -int __init save_microcode_in_initrd (void ) +int __init save_microcode_in_initrd_intel (void ) {unsigned int count = mc_saved_data.mc_saved_count;struct microcode_intel *mc_saved[MAX_UCODE_COUNT ];
@@ -711,7 +711,7 @@ int __init save_microcode_in_initrd(void)microcode_pointer (mc_saved, mc_saved_in_initrd, initrd_start, count); ret =save_microcode (&mc_saved_data, mc_saved, count);if (ret) -pr_err ("Can not save microcod patches from initrd" ); +pr_err ("Cannot save microcode patches from initrd.\n" );show_saved_mc ();