x86/microcode changes for v4.10
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: 14cfbe55c75ada9abd2d9cad97dafb4206c5f9e2 x86/microcode: Bump driver version, update copyrights
The biggest change (by Borislav Petkov) is a thorough rewrite of the Intel microcode loader and its interactions with the core code.
The biggest conceptual change is the decoupling of the microcode loading on boot and application processors (which load the microcode in different scenarios), so that both parse the input patches with as few assumptions as possible - this also fixes various kernel address space randomization bugs. (The AP side then goes on and caches the result to improve boot performance.)
Since the AMD side already did this, this change also opened up the path towards more unification/simplification of the core microcode loading infrastructure.
10 files changed, 647 insertions(+), 940 deletions(-)
Which speaks for itself.
out-of-topic modifications in x86-microcode-for-linus:
--------------------------------------------------------
CREDITS # 5879a2675208: x86/microcode: Move driver a
Thanks,
Ingo
------------------>
Borislav Petkov (12):
x86/microcode: Run the AP-loading routine only on the application processors x86/microcode: Move driver authors to CREDITS x86/microcode/intel: Simplify generic_load_microcode() x86/microcode: Remove one #ifdef clause
x86/microcode: Export the microcode cache linked list x86/microcode/amd: Hand down the CPU family
x86/microcode: Issue the debug printk on resume only on success x86/microcode: Collect CPU info on resume
x86/microcode/amd: Move private inlines to .c and mark local functions static x86/microcode/intel: Remove intel_lib.c
x86/microcode: Rework microcode loading
x86/microcode: Bump driver version, update copyrights
CREDITS | 4 + arch/x86/include/asm/microcode.h | 18 +- arch/x86/include/asm/microcode_amd.h | 30 +- arch/x86/include/asm/microcode_intel.h | 4 - arch/x86/kernel/cpu/common.c | 7 +- arch/x86/kernel/cpu/microcode/Makefile | 2 +- arch/x86/kernel/cpu/microcode/amd.c | 421 ++++++++------- arch/x86/kernel/cpu/microcode/core.c | 83 ++- arch/x86/kernel/cpu/microcode/intel.c | 834 +++++++++++++----------------- arch/x86/kernel/cpu/microcode/intel_lib.c | 184 ------- 10 files changed, 647 insertions(+), 940 deletions(-) delete mode 100644 arch/x86/kernel/cpu/microcode/intel_lib.c
CREDITS +4 -0
@@ -2774,6 +2774,10 @@ S: C/ Mieses 20, 9-B S: Valladolid 47009 S: Spain +N: Peter Oruba +D: AMD Microcode loader driver +S: Germany + N: Jens Osterkamp E: [email protected] D: Maintainer of Spidernet network driver for Cell
arch/x86/include/asm/microcode.h +12 -6
@@ -20,6 +20,15 @@ do { \ (u32)((u64)(val)), \ (u32)((u64)(val) >> 32)) +struct ucode_patch { +struct list_head plist; +void *data;/* Intel uses only this one */ +u32 patch_id; +u16 equiv_cpu; +}; + +extern struct list_head microcode_cache; +struct cpu_signature {unsigned int sig;unsigned int pf;
@@ -55,12 +64,7 @@ struct ucode_cpu_info {void *mc; };extern struct ucode_cpu_info ucode_cpu_info[]; - -#ifdef CONFIG_MICROCODE -int __init microcode_init (void ); -#else -static inline int __init microcode_init (void ) {return 0 ; }; -#endif +struct cpio_data find_microcode_in_initrd (const char *path,bool use_pa);#ifdef CONFIG_MICROCODE_INTEL extern struct microcode_ops *__init init_intel_microcode (void );
@@ -131,11 +135,13 @@ static inline unsigned int x86_cpuid_family(void) }#ifdef CONFIG_MICROCODE +int __init microcode_init (void );extern void __init load_ucode_bsp (void );extern void load_ucode_ap (void );void reload_early_microcode (void );extern bool get_builtin_firmware (struct cpio_data *cd,const char *name);#else +static inline int __init microcode_init (void ) {return 0 ; };static inline void __init load_ucode_bsp (void ) { }static inline void load_ucode_ap (void ) { }static inline void reload_early_microcode (void ) { }
arch/x86/include/asm/microcode_amd.h +5 -25
@@ -40,38 +40,18 @@ struct microcode_amd {unsigned int mpb[0 ]; }; -static inline u16 find_equiv_id (struct equiv_cpu_entry *equiv_cpu_table, -unsigned int sig) -{ -int i =0 ; - -if (!equiv_cpu_table) -return 0 ; - -while (equiv_cpu_table[i].installed_cpu !=0 ) { -if (sig == equiv_cpu_table[i].installed_cpu) -return equiv_cpu_table[i].equiv_cpu; - - i++; - } -return 0 ; -} - -extern int __apply_microcode_amd (struct microcode_amd *mc_amd); -extern int apply_microcode_amd (int cpu); -extern enum ucode_state load_microcode_amd (int cpu,u8 family,const u8 *data,size_t size); -#define PATCH_MAX_SIZE PAGE_SIZE#ifdef CONFIG_MICROCODE_AMD extern void __init load_ucode_amd_bsp (unsigned int family); -extern void load_ucode_amd_ap (void ); -extern int __init save_microcode_in_initrd_amd (void ); +extern void load_ucode_amd_ap (unsigned int family); +extern int __init save_microcode_in_initrd_amd (unsigned int family);void reload_ucode_amd (void );#else static inline void __init load_ucode_amd_bsp (unsigned int family) {} -static inline void load_ucode_amd_ap (void ) {} -static inline int __init save_microcode_in_initrd_amd (void ) {return -EINVAL ; } +static inline void load_ucode_amd_ap (unsigned int family) {} +static inline int __init +save_microcode_in_initrd_amd (unsigned int family) {return -EINVAL ; }void reload_ucode_amd (void ) {}#endif
arch/x86/include/asm/microcode_intel.h +0 -4
@@ -52,10 +52,6 @@ struct extended_sigtable {#define exttable_size (et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) -extern int has_newer_microcode (void *mc,unsigned int csig,int cpf,int rev); -extern int microcode_sanity_check (void *mc,int print_err); -extern int find_matching_signature (void *mc,unsigned int csig,int cpf); -#ifdef CONFIG_MICROCODE_INTEL extern void __init load_ucode_intel_bsp (void );extern void load_ucode_intel_ap (void );
arch/x86/kernel/cpu/common.c +2 -5
@@ -1462,11 +1462,8 @@ void cpu_init(void)*/ cr4_init_shadow (); -/* -* Load microcode on this cpu if a valid microcode is available. -* This is early microcode loading procedure. -*/ -load_ucode_ap (); +if (cpu) +load_ucode_ap (); t = &per_cpu (cpu_tss, cpu); oist = &per_cpu (orig_ist, cpu);
arch/x86/kernel/cpu/microcode/Makefile +1 -1
@@ -1,4 +1,4 @@ microcode-y := core.o obj-$(CONFIG_MICROCODE) += microcode.o -microcode-$(CONFIG_MICROCODE_INTEL) += intel.o intel_lib.o +microcode-$(CONFIG_MICROCODE_INTEL) += intel.o microcode-$(CONFIG_MICROCODE_AMD) += amd.o
arch/x86/kernel/cpu/microcode/amd.c +206 -215
624 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/core.c +68 -15
149 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel.c +349 -485
1,128 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel_lib.c deleted +0 -184
184 lines not on this page · raw message