x86 microcode changes for v4.2
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: 7b179b8feba3b887be5ddd501c25d924cf44d70a x86/microcode: Correct CPU family related variable types
x86 microcode loader updates from Borislav Petkov:
- early parsing of the built-in microcode
- cleanups
- smaller fixes
Thanks,
Ingo
------------------>
Andy Shevchenko (1):
x86/microcode: Correct CPU family related variable types
Borislav Petkov (9):
x86/microcode/intel: Get rid of revision_is_newer() x86/microcode/intel: Remove unused @rev arg of get_matching_sig() x86/microcode: Parse built-in microcode early x86/cpu/microcode: Zap changelog
x86/microcode/intel: Rename get_matching_microcode x86/microcode/intel: Simplify update_match_cpu() x86/microcode/intel: Simplify get_matching_sig() x86/microcode/intel: Rename get_matching_sig() x86/microcode: Disable builtin microcode loading on 32-bit for now
arch/x86/include/asm/microcode.h | 8 ++- arch/x86/include/asm/microcode_amd.h | 4 +- arch/x86/include/asm/microcode_intel.h | 13 +---- arch/x86/kernel/cpu/microcode/amd_early.c | 24 +++++++-- arch/x86/kernel/cpu/microcode/core.c | 76 ++++----------------------- arch/x86/kernel/cpu/microcode/core_early.c | 26 +++++++++- arch/x86/kernel/cpu/microcode/intel.c | 79 ++++------------------------- arch/x86/kernel/cpu/microcode/intel_early.c | 42 +++++++++++---- arch/x86/kernel/cpu/microcode/intel_lib.c | 45 ++++++++-------- 9 files changed, 131 insertions(+), 186 deletions(-)
arch/x86/include/asm/microcode.h +7 -1
@@ -1,6 +1,8 @@#ifndef _ASM_X86_MICROCODE_H#define _ASM_X86_MICROCODE_H +#include <linux/earlycpio.h> +#define native_rdmsr (msr, val1, val2) \ do { \ u64 __val = native_read_msr((msr)); \
@@ -152,6 +154,7 @@ extern void __init load_ucode_bsp(void);extern void load_ucode_ap (void );extern int __init save_microcode_in_initrd (void );void reload_early_microcode (void ); +extern bool get_builtin_firmware (struct cpio_data *cd,const char *name);#else static inline void __init load_ucode_bsp (void ) {}static inline void load_ucode_ap (void ) {}
@@ -160,6 +163,9 @@ static inline int __init save_microcode_in_initrd(void)return 0 ; }static inline void reload_early_microcode (void ) {} +static inline bool get_builtin_firmware (struct cpio_data *cd,const char *name) +{ +return false; +}#endif -#endif /* _ASM_X86_MICROCODE_H */
arch/x86/include/asm/microcode_amd.h +2 -2
@@ -65,12 +65,12 @@ extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, sextern u8 amd_ucode_patch[PATCH_MAX_SIZE ];#ifdef CONFIG_MICROCODE_AMD_EARLY -extern void __init load_ucode_amd_bsp (void ); +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 );void reload_ucode_amd (void );#else -static inline void __init load_ucode_amd_bsp (void ) {} +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 ; }void reload_ucode_amd (void ) {}
arch/x86/include/asm/microcode_intel.h +2 -11
@@ -51,20 +51,11 @@ struct extended_sigtable { (((struct microcode_intel *)mc)->hdr.datasize ? \ ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) -#define sigmatch (s1, s2, p1, p2) \ - (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) -#define exttable_size (et) ((et)->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE) -extern int get_matching_microcode (unsigned int csig,int cpf,int rev,void *mc); +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 get_matching_sig (unsigned int csig,int cpf,int rev,void *mc); - -static inline int -revision_is_newer (struct microcode_header_intel *mc_header,int rev) -{ -return (mc_header->rev <= rev) ?0 :1 ; -} +extern int find_matching_signature (void *mc,unsigned int csig,int cpf);#ifdef CONFIG_MICROCODE_INTEL_EARLY extern void __init load_ucode_intel_bsp (void );
arch/x86/kernel/cpu/microcode/amd_early.c +21 -3
@@ -228,7 +228,23 @@ static void apply_ucode_in_initrd(void *ucode, size_t size, bool save_patch) } } -void __init load_ucode_amd_bsp (void ) +static bool __init load_builtin_amd_microcode (struct cpio_data *cp, +unsigned int family) +{ +#ifdef CONFIG_X86_64 +char fw_name[36 ] ="amd-ucode/microcode_amd.bin" ; + +if (family >=0x15 ) +snprintf (fw_name,sizeof (fw_name), +"amd-ucode/microcode_amd_fam%.2xh.bin" , family); + +return get_builtin_firmware (cp, fw_name); +#else +return false; +#endif +} + +void __init load_ucode_amd_bsp (unsigned int family) {struct cpio_data cp;void **data;
@@ -243,8 +259,10 @@ void __init load_ucode_amd_bsp(void)#endif cp =find_ucode_in_initrd (); -if (!cp.data) -return ; +if (!cp.data) { +if (!load_builtin_amd_microcode (&cp, family)) +return ; + } *data = cp.data; *size = cp.size;
arch/x86/kernel/cpu/microcode/core.c +9 -67
83 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/core_early.c +24 -2
@@ -3,6 +3,7 @@* * Copyright (C) 2012 Fenghua Yu <[email protected]> * H Peter Anvin" <[email protected]> +* (C) 2015 Borislav Petkov <[email protected]> * * This driver allows to early upgrade microcode on Intel processors * belonging to IA-32 family - PentiumPro, Pentium II,
@@ -17,6 +18,7 @@* 2 of the License, or (at your option) any later version. */ #include <linux/module.h> +#include <linux/firmware.h> #include <asm/microcode.h> #include <asm/microcode_intel.h> #include <asm/microcode_amd.h>
@@ -43,9 +45,29 @@ static bool __init check_loader_disabled_bsp(void)return *res; } +extern struct builtin_fw __start_builtin_fw[]; +extern struct builtin_fw __end_builtin_fw[]; + +bool get_builtin_firmware (struct cpio_data *cd,const char *name) +{ +#ifdef CONFIG_FW_LOADER +struct builtin_fw *b_fw; + +for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) { +if (!strcmp (name, b_fw->name)) { + cd->size = b_fw->size; + cd->data = b_fw->data; +return true; + } + } +#endif +return false; +} +void __init load_ucode_bsp (void ) { -int vendor, family; +int vendor; +unsigned int family;if (check_loader_disabled_bsp ())return ;
@@ -63,7 +85,7 @@ void __init load_ucode_bsp(void)break ;case X86_VENDOR_AMD :if (family >=0x10 ) -load_ucode_amd_bsp (); +load_ucode_amd_bsp (family);break ;default :break ;
arch/x86/kernel/cpu/microcode/intel.c +9 -70
97 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel_early.c +32 -10
77 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel_lib.c +25 -20
76 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/