x86/microcode changes for v3.7
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: bd13178169d5fd17da3221b55ba313270393649a Merge tag 'microcode_fix_3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp into x86/microcode
The biggest changes are to AMD microcode patching: add code for caching all microcode patches which belong to the current family on which we're running, in the kernel. We look up the patch needed for each core from the cache at patch-application time instead of holding a single patch per-system.
Thanks,
Ingo
------------------>
Borislav Petkov (11):
x86, microcode: Save an indentation level in reload_for_cpu x86, microcode: Drop uci->mc check on resume path
x86, microcode: Cleanup cpu hotplug notifier callback x86, microcode: Straighten out Kconfig text
x86, microcode, AMD: Remove useless get_ucode_data wrapper x86, microcode, AMD: Check before applying a patch
x86, microcode, AMD: Read CPUID(1).EAX on the correct cpu x86, microcode: Add a refresh firmware flag to ->request_microcode_fw x86, microcode, AMD: Add reverse equiv table search
x86, microcode, AMD: Add a small, per-family patches cache x86, microcode, AMD: Rewrite patch application procedure
Dan Carpenter (1):
x86, microcode, AMD: Fix use after free in free_cache()
arch/x86/Kconfig | 20 +-- arch/x86/include/asm/microcode.h | 10 +- arch/x86/kernel/microcode_amd.c | 357 ++++++++++++++++++++++++-------------- arch/x86/kernel/microcode_core.c | 67 +++---- arch/x86/kernel/microcode_intel.c | 3 +- 5 files changed, 273 insertions(+), 184 deletions(-)
arch/x86/Kconfig +10 -10
@@ -982,25 +982,25 @@ config X86_REBOOTFIXUPS Say N otherwise. config MICROCODE - tristate "/dev/cpu/microcode - microcode support" + tristate "CPU microcode loading support" select FW_LOADER ---help--- + If you say Y here, you will be able to update the microcode on certain Intel and AMD processors. The Intel support is for the - IA32 family, e.g. Pentium Pro, Pentium II, Pentium III, - Pentium 4, Xeon etc. The AMD support is for family 0x10 and - 0x11 processors, e.g. Opteron, Phenom and Turion 64 Ultra. - You will obviously need the actual microcode binary data itself - which is not shipped with the Linux kernel. + IA32 family, e.g. Pentium Pro, Pentium II, Pentium III, Pentium 4, + Xeon etc. The AMD support is for families 0x10 and later. You will + obviously need the actual microcode binary data itself which is not + shipped with the Linux kernel. This option selects the general module only, you need to select at least one vendor specific module as well. - To compile this driver as a module, choose M here: the - module will be called microcode. + To compile this driver as a module, choose M here: the module + will be called microcode. config MICROCODE_INTEL - bool "Intel microcode patch loading support" + bool "Intel microcode loading support" depends on MICROCODE default MICROCODE select FW_LOADER
@@ -1013,7 +1013,7 @@ config MICROCODE_INTEL <http://www.urbanmyth.org/microcode/>. config MICROCODE_AMD - bool "AMD microcode patch loading support" + bool "AMD microcode loading support" depends on MICROCODE select FW_LOADER ---help---
arch/x86/include/asm/microcode.h +2 -8
@@ -15,8 +15,8 @@ struct microcode_ops {enum ucode_state (*request_microcode_user) (int cpu,const void __user *buf,size_t size); -enum ucode_state (*request_microcode_fw) (int cpu, -struct device *device); +enum ucode_state (*request_microcode_fw) (int cpu,struct device *, +bool refresh_fw);void (*microcode_fini_cpu) (int cpu);
@@ -49,12 +49,6 @@ static inline struct microcode_ops * __init init_intel_microcode(void)#ifdef CONFIG_MICROCODE_AMD extern struct microcode_ops *__init init_amd_microcode (void ); extern void __exit exit_amd_microcode(void); - -static inline void get_ucode_data (void *to,const u8 *from,size_t n) -{ -memcpy (to, from, n); -} -#else static inline struct microcode_ops *__init init_amd_microcode (void ) {
arch/x86/kernel/microcode_amd.c +225 -132
453 lines not on this page · raw message
arch/x86/kernel/microcode_core.c +34 -33
133 lines not on this page · raw message
arch/x86/kernel/microcode_intel.c +2 -1
@@ -405,7 +405,8 @@ static int get_ucode_fw(void *to, const void *from, size_t n)return 0 ; } -static enum ucode_state request_microcode_fw (int cpu,struct device *device) +static enum ucode_state request_microcode_fw (int cpu,struct device *device, +bool refresh_fw) {char name[30 ];struct cpuinfo_x86 *c = &cpu_data (cpu);
Quoted 8 lines · Ingo Molnar
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: bd13178169d5fd17da3221b55ba313270393649a Merge tag 'microcode_fix_3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp into x86/microcode
Quoted 5 lines
The biggest changes are to AMD microcode patching: add code for caching all microcode patches which belong to the current family on which we're running, in the kernel. We look up the patch needed for each core from the cache at patch-application time instead of holding a single patch per-system.
Something I forgot to mention: doing it this way is beneficial for suspend/resume and is generally the modern way of doing a self-sufficient in-kernel driver.
The natural next step will be to extend this approach to Intel CPUs (there's nothing inherently AMD specific about it) - that is still work in progress and was not ready for this merge window.
Just in case someone is wondering.
Thanks,
Ingo