Commit-ID: fe055896c040df571e4ff56fb196d6845130057b
Gitweb: http://git.kernel.org/tip/fe055896c040df571e4ff56fb196d6845130057b
Author: Borislav Petkov
AuthorDate: Tue, 20 Oct 2015 11:54:45 +0200
Committer: Ingo Molnar
CommitDate: Wed, 21 Oct 2015 11:22:12 +0200
x86/microcode: Merge the early microcode loader
Merge the early loader functionality into the driver proper. The
diff is huge but logically, it is simply moving code from the
_early.c files into the main driver.
Signed-off-by: Borislav Petkov
Cc: Andy Lutomirski
Cc: Arjan van de Ven
Cc: Borislav Petkov
Cc: Brian Gerst
Cc: Dave Jones
Cc: Denys Vlasenko
Cc: H. Peter Anvin
Cc: Len Brown
Cc: Linus Torvalds
Cc: Peter Zijlstra
Cc: Rafael J. Wysocki
Cc: Thomas Gleixner
Cc: Tony Luck
Link: http://lkml.kernel.org/r/1445334889-300-3-git-send-email...@alien8.de
Signed-off-by: Ingo Molnar
---
arch/x86/Kconfig| 19 +-
arch/x86/include/asm/microcode.h| 19 +-
arch/x86/include/asm/microcode_amd.h| 2 +-
arch/x86/include/asm/microcode_intel.h | 10 +-
arch/x86/kernel/cpu/microcode/Makefile | 3 -
arch/x86/kernel/cpu/microcode/amd.c | 446 ++-
arch/x86/kernel/cpu/microcode/amd_early.c | 444 ---
arch/x86/kernel/cpu/microcode/core.c| 160 +-
arch/x86/kernel/cpu/microcode/core_early.c | 170 --
arch/x86/kernel/cpu/microcode/intel.c | 788 ++-
arch/x86/kernel/cpu/microcode/intel_early.c | 808
arch/x86/kernel/head_32.S | 5 +-
arch/x86/mm/init.c | 2 -
13 files changed, 1399 insertions(+), 1477 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fdf1f0c..255ea22 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1126,6 +1126,7 @@ config MICROCODE
bool "CPU microcode loading support"
default y
depends on CPU_SUP_AMD || CPU_SUP_INTEL
+ depends on BLK_DEV_INITRD
select FW_LOADER
---help---
@@ -1167,24 +1168,6 @@ config MICROCODE_OLD_INTERFACE
def_bool y
depends on MICROCODE
-config MICROCODE_INTEL_EARLY
- bool
-
-config MICROCODE_AMD_EARLY
- bool
-
-config MICROCODE_EARLY
- bool "Early load microcode"
- depends on MICROCODE && 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
- at the beginning of initrd image. The data tells kernel to load
- 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 X86_MSR
tristate "/dev/cpu/*/msr - Model-specific register support"
---help---
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index d1ff724f..9f953f7 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -81,7 +81,6 @@ static inline struct microcode_ops * __init
init_amd_microcode(void)
static inline void __exit exit_amd_microcode(void) {}
#endif
-#ifdef CONFIG_MICROCODE_EARLY
#define MAX_UCODE_COUNT 128
#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) << 24))
@@ -156,22 +155,18 @@ static inline unsigned int x86_model(unsigned int sig)
return model;
}
+#ifdef CONFIG_MICROCODE
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) {}
-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;
-}
+static inline void __init load_ucode_bsp(void) { }
+static inline void load_ucode_ap(void) { }
+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 */
diff --git a/arch/x86/include/asm/microcode_amd.h
b/arch/x86/include/asm/microcode_amd.h
index d3e86cf..adfc847 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -64,7 +64,7 @@ extern enum ucode_state load_microcode_amd(int cpu, u8
family, const u8 *data, s
#define PATCH_MAX_SIZE PAGE_SIZE
extern u8 amd_ucode_patch[PATCH_MAX_SIZE];
-#ifdef CONFIG_MICROCODE_AMD_EARLY
+#ifdef