Skip to contentSkip to conversation

x86/microcode: Merge the early loader

PATCH In review Borislav Petkov 4 participants 17 messages Oct 20, 2015 – Nov 9, 2015

Subsystems (3)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

cover x86/microcode: Merge the early loader

From: Borislav Petkov <[email protected]>

Hi all,

so this basically codifies what we're already doing in practice anyway:
the early loader is enabled and the microcode functionality is built-in. So we can make this official and remove all that additional Kconfig complexity of keeping the early and the late loader separate and we can remove the module code glue because it is almost never used as a module.

We still have the unfortunately-named "dis_ucode_ldr" chicken bit to disable it all, if needed.

More details in the individual commit messages.

Borislav Petkov (6):
x86/microcode: Unmodularize driver x86/microcode: Merge early loader
x86/microcode: Remove modularization leftovers x86/microcode/amd: Remove maintainers from comments x86/microcode/intel: Move ifdef DEBUG inside the function
MAINTAINERS: Unify microcode driver section

 MAINTAINERS                                 |  16 +-
 arch/x86/Kconfig                            |  22 +-
 arch/x86/include/asm/microcode.h            |  26 +-
 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         | 457 +++++++++++++++-
 arch/x86/kernel/cpu/microcode/amd_early.c   | 444 ---------------
 arch/x86/kernel/cpu/microcode/core.c        | 232 +++++---
 arch/x86/kernel/cpu/microcode/core_early.c  | 170 ------
 arch/x86/kernel/cpu/microcode/intel.c       | 791 ++++++++++++++++++++++++++-
 arch/x86/kernel/cpu/microcode/intel_early.c | 808 ----------------------------
 arch/x86/kernel/cpu/microcode/intel_lib.c   |   1 -
 arch/x86/kernel/head_32.S                   |   5 +-
 arch/x86/kernel/setup.c                     |   3 +
 arch/x86/mm/init.c                          |   2 -
 16 files changed, 1425 insertions(+), 1567 deletions(-)
 delete mode 100644 arch/x86/kernel/cpu/microcode/amd_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/core_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/intel_early.c
Signature · 1 line
2.3.5
author maintainer
#1 lore raw

PATCH 1/6 x86/microcode: Unmodularize driver

From: Borislav Petkov <[email protected]>

Make it a bool. It was practically a bool already anyway since early loader was forcing it to =y. Regardless, there's no real reason to have something be a module which gets built-in on the majority of installations out there. And its not like there's noticeable change in functionality - we still can load late microcode - just the module glue disappears.

---
 arch/x86/Kconfig                      |  5 +++--
 arch/x86/include/asm/microcode.h      |  6 ++++++
 arch/x86/kernel/cpu/microcode/amd.c   |  2 +-
 arch/x86/kernel/cpu/microcode/core.c  | 36 ++---------------------------------
 arch/x86/kernel/cpu/microcode/intel.c |  2 +-
 arch/x86/kernel/setup.c               |  3 +++
 6 files changed, 16 insertions(+), 38 deletions(-)
arch/x86/Kconfig +3 -2
index 96d058a87100..fdf1f0cdf6b6 100644
@@ -1123,7 +1123,8 @@ config X86_REBOOTFIXUPS
 	  Say N otherwise.
 
 config MICROCODE
-	tristate "CPU microcode loading support"
+	bool "CPU microcode loading support"
+	default y
 	depends on CPU_SUP_AMD || CPU_SUP_INTEL
 	select FW_LOADER
 	---help---
@@ -1174,7 +1175,7 @@ config MICROCODE_AMD_EARLY
 
 config MICROCODE_EARLY
 	bool "Early load microcode"
-	depends on MICROCODE=y && BLK_DEV_INITRD
+	depends on MICROCODE && BLK_DEV_INITRD
 	select MICROCODE_INTEL_EARLY if MICROCODE_INTEL
 	select MICROCODE_AMD_EARLY if MICROCODE_AMD
 	default y
arch/x86/include/asm/microcode.h +6 -0
index 9e6278c7140e..d1ff724f352b 100644
@@ -55,6 +55,12 @@ struct ucode_cpu_info {
 };
 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
+
 #ifdef CONFIG_MICROCODE_INTEL
 extern struct microcode_ops * __init init_intel_microcode(void);
 #else
arch/x86/kernel/cpu/microcode/amd.c +1 -1
index da922d1e2f71..5dcce5dc39b9 100644
@@ -523,7 +523,7 @@ static struct microcode_ops microcode_amd_ops = {
 
 struct microcode_ops * __init init_amd_microcode(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
 		pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
arch/x86/kernel/cpu/microcode/core.c +2 -34
index 9e3f3c7dd5d7..15491dd3131e 100644
@@ -487,9 +487,9 @@ static struct attribute_group cpu_root_microcode_group = {
 	.attrs = cpu_root_microcode_attrs,
 };
 
-static int __init microcode_init(void)
+int __init microcode_init(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 	int error;
 
 	if (paravirt_enabled() || dis_ucode_ldr)
@@ -560,35 +560,3 @@ static int __init microcode_init(void)
 	return error;
 
 }
-module_init(microcode_init);
-
-static void __exit microcode_exit(void)
-{
-	struct cpuinfo_x86 *c = &cpu_data(0);
-
-	microcode_dev_exit();
-
-	unregister_hotcpu_notifier(&mc_cpu_notifier);
-	unregister_syscore_ops(&mc_syscore_ops);
-
-	sysfs_remove_group(&cpu_subsys.dev_root->kobj,
-			   &cpu_root_microcode_group);
-
-	get_online_cpus();
-	mutex_lock(&microcode_mutex);
-
-	subsys_interface_unregister(&mc_cpu_interface);
-
-	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
-
-	platform_device_unregister(microcode_pdev);
-
-	microcode_ops = NULL;
-
-	if (c->x86_vendor == X86_VENDOR_AMD)
-		exit_amd_microcode();
-
-	pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
-}
-module_exit(microcode_exit);
arch/x86/kernel/cpu/microcode/intel.c +1 -1
index 969dc17eb1b4..bfd6fcd242ea 100644
@@ -264,7 +264,7 @@ static struct microcode_ops microcode_intel_ops = {
 
 struct microcode_ops * __init init_intel_microcode(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
 	    cpu_has(c, X86_FEATURE_IA64)) {
arch/x86/kernel/setup.c +3 -0
index fdb7f2a2d328..ef9824fac9c3 100644
@@ -111,6 +111,7 @@
 #include <asm/mce.h>
 #include <asm/alternative.h>
 #include <asm/prom.h>
+#include <asm/microcode.h>
 
 /*
  * max_low_pfn_mapped: highest direct mapped pfn under 4GB
@@ -1234,6 +1235,8 @@ void __init setup_arch(char **cmdline_p)
 	if (efi_enabled(EFI_BOOT))
 		efi_apply_memmap_quirks();
 #endif
+
+	microcode_init();
 }
 
 #ifdef CONFIG_X86_32
Signature · 1 line
2.3.5
#2 lore raw

[tip:ras/core] x86/microcode: Unmodularize the microcode driver

x86/microcode: Unmodularize the microcode driver
Commit-ID:  9a2bc335f100a0f6ee6392b9f97ac4188d84db1d
Gitweb:     http://git.kernel.org/tip/9a2bc335f100a0f6ee6392b9f97ac4188d84db1d
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:44 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2015 11:22:11 +0200

x86/microcode: Unmodularize the microcode driver

Make CONFIG_MICROCODE a bool. It was practically a bool already anyway, since early loader was forcing it to =y.

Regardless, there's no real reason to have something be a module which gets built-in on the majority of installations out there. And its not like there's noticeable change in functionality - we still can load late microcode - just the module glue disappears.

Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 arch/x86/Kconfig                      |  5 +++--
 arch/x86/include/asm/microcode.h      |  6 ++++++
 arch/x86/kernel/cpu/microcode/amd.c   |  2 +-
 arch/x86/kernel/cpu/microcode/core.c  | 36 ++---------------------------------
 arch/x86/kernel/cpu/microcode/intel.c |  2 +-
 arch/x86/kernel/setup.c               |  3 +++
 6 files changed, 16 insertions(+), 38 deletions(-)
arch/x86/Kconfig +3 -2
index 96d058a..fdf1f0c 100644
@@ -1123,7 +1123,8 @@ config X86_REBOOTFIXUPS
 	  Say N otherwise.
 
 config MICROCODE
-	tristate "CPU microcode loading support"
+	bool "CPU microcode loading support"
+	default y
 	depends on CPU_SUP_AMD || CPU_SUP_INTEL
 	select FW_LOADER
 	---help---
@@ -1174,7 +1175,7 @@ config MICROCODE_AMD_EARLY
 
 config MICROCODE_EARLY
 	bool "Early load microcode"
-	depends on MICROCODE=y && BLK_DEV_INITRD
+	depends on MICROCODE && BLK_DEV_INITRD
 	select MICROCODE_INTEL_EARLY if MICROCODE_INTEL
 	select MICROCODE_AMD_EARLY if MICROCODE_AMD
 	default y
arch/x86/include/asm/microcode.h +6 -0
index 9e6278c..d1ff724f 100644
@@ -55,6 +55,12 @@ struct ucode_cpu_info {
 };
 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
+
 #ifdef CONFIG_MICROCODE_INTEL
 extern struct microcode_ops * __init init_intel_microcode(void);
 #else
arch/x86/kernel/cpu/microcode/amd.c +1 -1
index da922d1..5dcce5d 100644
@@ -523,7 +523,7 @@ static struct microcode_ops microcode_amd_ops = {
 
 struct microcode_ops * __init init_amd_microcode(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
 		pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
arch/x86/kernel/cpu/microcode/core.c +2 -34
index 9e3f3c7..15491dd 100644
@@ -487,9 +487,9 @@ static struct attribute_group cpu_root_microcode_group = {
 	.attrs = cpu_root_microcode_attrs,
 };
 
-static int __init microcode_init(void)
+int __init microcode_init(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 	int error;
 
 	if (paravirt_enabled() || dis_ucode_ldr)
@@ -560,35 +560,3 @@ static int __init microcode_init(void)
 	return error;
 
 }
-module_init(microcode_init);
-
-static void __exit microcode_exit(void)
-{
-	struct cpuinfo_x86 *c = &cpu_data(0);
-
-	microcode_dev_exit();
-
-	unregister_hotcpu_notifier(&mc_cpu_notifier);
-	unregister_syscore_ops(&mc_syscore_ops);
-
-	sysfs_remove_group(&cpu_subsys.dev_root->kobj,
-			   &cpu_root_microcode_group);
-
-	get_online_cpus();
-	mutex_lock(&microcode_mutex);
-
-	subsys_interface_unregister(&mc_cpu_interface);
-
-	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
-
-	platform_device_unregister(microcode_pdev);
-
-	microcode_ops = NULL;
-
-	if (c->x86_vendor == X86_VENDOR_AMD)
-		exit_amd_microcode();
-
-	pr_info("Microcode Update Driver: v" MICROCODE_VERSION " removed.\n");
-}
-module_exit(microcode_exit);
arch/x86/kernel/cpu/microcode/intel.c +1 -1
index 969dc17..bfd6fcd 100644
@@ -264,7 +264,7 @@ static struct microcode_ops microcode_intel_ops = {
 
 struct microcode_ops * __init init_intel_microcode(void)
 {
-	struct cpuinfo_x86 *c = &cpu_data(0);
+	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
 	    cpu_has(c, X86_FEATURE_IA64)) {
arch/x86/kernel/setup.c +3 -0
index 3f75297..3a89610 100644
@@ -111,6 +111,7 @@
 #include <asm/mce.h>
 #include <asm/alternative.h>
 #include <asm/prom.h>
+#include <asm/microcode.h>
 
 /*
  * max_low_pfn_mapped: highest direct mapped pfn under 4GB
@@ -1239,6 +1240,8 @@ void __init setup_arch(char **cmdline_p)
 	if (efi_enabled(EFI_BOOT))
 		efi_apply_memmap_quirks();
 #endif
+
+	microcode_init();
 }
 
 #ifdef CONFIG_X86_32
author maintainer
#3 lore raw

PATCH 2/6 x86/microcode: Merge early loader

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

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.

---
 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(-)
 delete mode 100644 arch/x86/kernel/cpu/microcode/amd_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/core_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/intel_early.c
arch/x86/Kconfig +1 -18
index fdf1f0cdf6b6..255ea22ccbec 100644
@@ -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---
arch/x86/include/asm/microcode.h +7 -12
index d1ff724f352b..9f953f7851bb 100644
@@ -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 */
arch/x86/include/asm/microcode_amd.h +1 -1
index d3e86cfd08fe..adfc847a395e 100644
@@ -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 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);
arch/x86/include/asm/microcode_intel.h +3 -7
index 7991c606125d..8559b0102ea1 100644
@@ -57,7 +57,7 @@ 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_EARLY
+#ifdef CONFIG_MICROCODE_INTEL
 extern void __init load_ucode_intel_bsp(void);
 extern void load_ucode_intel_ap(void);
 extern void show_ucode_info_early(void);
@@ -71,13 +71,9 @@ static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL;
 static inline void reload_ucode_intel(void) {}
 #endif
 
-#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
+#ifdef CONFIG_HOTPLUG_CPU
 extern int save_mc_for_early(u8 *mc);
 #else
-static inline int save_mc_for_early(u8 *mc)
-{
-	return 0;
-}
+static inline int save_mc_for_early(u8 *mc) { return 0; }
 #endif
-
 #endif /* _ASM_X86_MICROCODE_INTEL_H */
arch/x86/kernel/cpu/microcode/Makefile +0 -3
index 285c85427c32..220b1a508513 100644
@@ -2,6 +2,3 @@ microcode-y				:= core.o
 obj-$(CONFIG_MICROCODE)			+= microcode.o
 microcode-$(CONFIG_MICROCODE_INTEL)	+= intel.o intel_lib.o
 microcode-$(CONFIG_MICROCODE_AMD)	+= amd.o
-obj-$(CONFIG_MICROCODE_EARLY)		+= core_early.o
-obj-$(CONFIG_MICROCODE_INTEL_EARLY)	+= intel_early.o
-obj-$(CONFIG_MICROCODE_AMD_EARLY)	+= amd_early.o
arch/x86/kernel/cpu/microcode/amd.c +441 -5

485 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/amd_early.c deleted +0 -444

444 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/core.c +157 -3

189 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/core_early.c deleted +0 -170

170 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/intel.c +787 -1

815 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/intel_early.c deleted +0 -808

793 lines not on this page · raw message

arch/x86/kernel/head_32.S +2 -3
index 0e2d96ffd158..6bc9ae24b6d2 100644

Lines of this file are not shown. View the raw message.

arch/x86/mm/init.c +0 -2
index 1d8a83df153a..1f37cb2b56a9 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.3.5

Part of the diff is not shown here. View the raw message.

#4 lore raw

[tip:ras/core] x86/microcode: Merge the early microcode loader

x86/microcode: Merge the early microcode loader
Commit-ID:  fe055896c040df571e4ff56fb196d6845130057b
Gitweb:     http://git.kernel.org/tip/fe055896c040df571e4ff56fb196d6845130057b
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:45 +0200
Committer:  Ingo Molnar <[email protected]>
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.

Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 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(-)
arch/x86/Kconfig +1 -18
index fdf1f0c..255ea22 100644
@@ -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---
arch/x86/include/asm/microcode.h +7 -12
index d1ff724f..9f953f7 100644
@@ -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 */
arch/x86/include/asm/microcode_amd.h +1 -1
index d3e86cf..adfc847 100644
@@ -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 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);
arch/x86/include/asm/microcode_intel.h +3 -7
index 7991c60..8559b01 100644
@@ -57,7 +57,7 @@ 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_EARLY
+#ifdef CONFIG_MICROCODE_INTEL
 extern void __init load_ucode_intel_bsp(void);
 extern void load_ucode_intel_ap(void);
 extern void show_ucode_info_early(void);
@@ -71,13 +71,9 @@ static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL;
 static inline void reload_ucode_intel(void) {}
 #endif
 
-#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
+#ifdef CONFIG_HOTPLUG_CPU
 extern int save_mc_for_early(u8 *mc);
 #else
-static inline int save_mc_for_early(u8 *mc)
-{
-	return 0;
-}
+static inline int save_mc_for_early(u8 *mc) { return 0; }
 #endif
-
 #endif /* _ASM_X86_MICROCODE_INTEL_H */
arch/x86/kernel/cpu/microcode/Makefile +0 -3
index 285c854..220b1a5 100644
@@ -2,6 +2,3 @@ microcode-y				:= core.o
 obj-$(CONFIG_MICROCODE)			+= microcode.o
 microcode-$(CONFIG_MICROCODE_INTEL)	+= intel.o intel_lib.o
 microcode-$(CONFIG_MICROCODE_AMD)	+= amd.o
-obj-$(CONFIG_MICROCODE_EARLY)		+= core_early.o
-obj-$(CONFIG_MICROCODE_INTEL_EARLY)	+= intel_early.o
-obj-$(CONFIG_MICROCODE_AMD_EARLY)	+= amd_early.o
arch/x86/kernel/cpu/microcode/amd.c +441 -5

485 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/amd_early.c deleted +0 -444

444 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/core.c +157 -3

189 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/core_early.c deleted +0 -170

170 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/intel.c +787 -1

815 lines not on this page · raw message

arch/x86/kernel/cpu/microcode/intel_early.c deleted +0 -808

793 lines not on this page · raw message

arch/x86/kernel/head_32.S +2 -3
index 0e2d96f..6bc9ae2 100644

Lines of this file are not shown. View the raw message.

arch/x86/mm/init.c +0 -2
index 1d8a83d..1f37cb2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH 2/6] x86/microcode: Merge early loader

In reply to Borislav Petkov
Quoted 50 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

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.

---
 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(-)
 delete mode 100644 arch/x86/kernel/cpu/microcode/amd_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/core_early.c
 delete mode 100644 arch/x86/kernel/cpu/microcode/intel_early.c
arch/x86/Kconfig +1 -8
index fdf1f0cdf6b6..255ea22ccbec 100644
@@ -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"

arch/x86/Kconfig config MICROCODE_OLD_INTERFACE · line 1187

Quoted 10 lines
arch/x86/Kconfig +0 -10
-       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.
-

So this broke dracut. Dracut will look at the config file for the INTEL or AMD early config options being set. If it does not find them, it disables the creation of the early microcode part of the initramfs. Now that the options don't even exist, it fails.

Do we have suggestions on how to work this out going forward? I suppose we could assume the check should only be done on 4.3 or older kernels, but I'm not sure making assumptions about newer kernels is a great idea either.

josh

author maintainer
#6 lore raw

Re: [PATCH 2/6] x86/microcode: Merge early loader

Quoted 2 lines · Josh Boyer

So this broke dracut. Dracut will look at the config file for the INTEL or AMD early config options being set.

Nothing outside the kernel should depend on Kconfig symbols.

Quoted 4 lines

Do we have suggestions on how to work this out going forward? I suppose we could assume the check should only be done on 4.3 or older kernels, but I'm not sure making assumptions about newer kernels is a great idea either.

How about always adding AMD and Intel microcode always? Maybe with a switch to disable adding any microcode for testing purposes only...

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
#7 lore raw

Re: [PATCH 2/6] x86/microcode: Merge early loader

Am 06.11.2015 um 20:31 schrieb Borislav Petkov:

Quoted 6 lines · Josh Boyer
Quoted 2 lines

So this broke dracut. Dracut will look at the config file for the INTEL or AMD early config options being set.

Nothing outside the kernel should depend on Kconfig symbols.

Quoted 8 lines
Quoted 4 lines

Do we have suggestions on how to work this out going forward? I suppose we could assume the check should only be done on 4.3 or older kernels, but I'm not sure making assumptions about newer kernels is a great idea either.

How about always adding AMD and Intel microcode always? Maybe with a switch to disable adding any microcode for testing purposes only...

Will this work with kernels not supporting the microcode loading? Theoretically the old kernels would just unpack all cpios one after the other, right?

author maintainer
#8 lore raw

Re: [PATCH 2/6] x86/microcode: Merge early loader

Quoted 3 lines · Harald Hoyer

Will this work with kernels not supporting the microcode loading? Theoretically the old kernels would just unpack all cpios one after the other, right?

Well, what we should be doing is adding two paths to the initrd:

for AMD: kernel/x86/microcode/AuthenticAMD.bin
for Intel: kernel/x86/microcode/GenuineIntel.bin

I.e., the microcode blobs become part of the initrd, see Documentation/x86/early-microcode.txt. The loader goes and opens the one it needs at boot time.

You could also add a switch for convenience, something like --no-microcode or so, so that dracut doesn't add it but if one wants to not add microcode, one could also move it away from, say, /lib/firmware/ so that dracut simply doesn't find it. The --no-microcode might be more convenient though.

Kernels which don't support microcode loading would simply not look for that path.

Let me know if this doesn't make sense and if I need to test/look at patches.

Thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
author maintainer
#9 lore raw

PATCH 3/6 x86/microcode: Remove modularization leftovers

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Remove the remaining module functionality leftovers. Make "dis_ucode_ldr" an early_param and make it static again. Drop module aliases, autoloading table, description, etc.

Bump version number, while at it.

---
 arch/x86/include/asm/microcode.h          |  1 -
 arch/x86/kernel/cpu/microcode/amd.c       |  7 +-----
 arch/x86/kernel/cpu/microcode/core.c      | 36 +++++++++----------------------
 arch/x86/kernel/cpu/microcode/intel.c     |  7 +-----
 arch/x86/kernel/cpu/microcode/intel_lib.c |  1 -
 5 files changed, 12 insertions(+), 40 deletions(-)
arch/x86/include/asm/microcode.h +0 -1
index 9f953f7851bb..34e62b1dcfce 100644
@@ -27,7 +27,6 @@ struct cpu_signature {
 struct device;
 
 enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
-extern bool dis_ucode_ldr;
 
 struct microcode_ops {
 	enum ucode_state (*request_microcode_user) (int cpu,
arch/x86/kernel/cpu/microcode/amd.c +1 -6
index 20297fbb7355..6eeda7b024c3 100644
@@ -24,7 +24,7 @@
  *  Licensed under the terms of the GNU General Public
  *  License version 2. See file COPYING for details.
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/earlycpio.h>
 #include <linux/firmware.h>
@@ -32,7 +32,6 @@
 #include <linux/vmalloc.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/pci.h>
 
 #include <asm/microcode_amd.h>
@@ -42,10 +41,6 @@
 #include <asm/cpu.h>
 #include <asm/msr.h>
 
-MODULE_DESCRIPTION("AMD Microcode Update Driver");
-MODULE_AUTHOR("Peter Oruba");
-MODULE_LICENSE("GPL v2");
-
 static struct equiv_cpu_entry *equiv_cpu_table;
 
 struct ucode_patch {
arch/x86/kernel/cpu/microcode/core.c +10 -26
index 18848c7de058..7fc27f1cca58 100644
@@ -19,7 +19,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -27,7 +27,6 @@
 #include <linux/capability.h>
 #include <linux/firmware.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
@@ -41,16 +40,18 @@
 #include <asm/processor.h>
 #include <asm/cmdline.h>
 
-MODULE_DESCRIPTION("Microcode Update Driver");
-MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
-MODULE_LICENSE("GPL");
-
-#define MICROCODE_VERSION	"2.00"
+#define MICROCODE_VERSION	"2.01"
 
 static struct microcode_ops	*microcode_ops;
 
-bool dis_ucode_ldr;
-module_param(dis_ucode_ldr, bool, 0);
+static bool dis_ucode_ldr;
+
+static int __init disable_loader(char *str)
+{
+	dis_ucode_ldr = true;
+	return 1;
+}
+__setup("dis_ucode_ldr", disable_loader);
 
 /*
  * Synchronization.
@@ -364,9 +365,6 @@ static void __exit microcode_dev_exit(void)
 {
 	misc_deregister(&microcode_dev);
 }
-
-MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
-MODULE_ALIAS("devname:cpu/microcode");
 #else
 #define microcode_dev_init()	0
 #define microcode_dev_exit()	do { } while (0)
@@ -617,20 +615,6 @@ static struct notifier_block mc_cpu_notifier = {
 	.notifier_call	= mc_cpu_callback,
 };
 
-#ifdef MODULE
-/* Autoload on Intel and AMD systems */
-static const struct x86_cpu_id __initconst microcode_id[] = {
-#ifdef CONFIG_MICROCODE_INTEL
-	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, },
-#endif
-#ifdef CONFIG_MICROCODE_AMD
-	{ X86_VENDOR_AMD, X86_FAMILY_ANY, X86_MODEL_ANY, },
-#endif
-	{}
-};
-MODULE_DEVICE_TABLE(x86cpu, microcode_id);
-#endif
-
 static struct attribute *cpu_root_microcode_attrs[] = {
 	&dev_attr_reload.attr,
 	NULL
arch/x86/kernel/cpu/microcode/intel.c +1 -6
index 2e09171e5338..3f325586965e 100644
@@ -21,7 +21,7 @@
  *
  *#define DEBUG
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/earlycpio.h>
 #include <linux/firmware.h>
@@ -29,7 +29,6 @@
 #include <linux/vmalloc.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/mm.h>
@@ -40,10 +39,6 @@
 #include <asm/setup.h>
 #include <asm/msr.h>
 
-MODULE_DESCRIPTION("Microcode Update Driver");
-MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
-MODULE_LICENSE("GPL");
-
 static unsigned long mc_saved_in_initrd[MAX_UCODE_COUNT];
 static struct mc_saved_data {
 	unsigned int mc_saved_count;
arch/x86/kernel/cpu/microcode/intel_lib.c +0 -1
index 1883d252ff7d..b96896bcbdaf 100644
@@ -25,7 +25,6 @@
 #include <linux/firmware.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 
 #include <asm/microcode_intel.h>
 #include <asm/processor.h>
Signature · 1 line
2.3.5
#10 lore raw

[tip:ras/core] x86/microcode: Remove modularization leftovers

x86/microcode: Remove modularization leftovers
Commit-ID:  6b26e1bf66bb4bf1b1b9b4f27d1f324875689cf0
Gitweb:     http://git.kernel.org/tip/6b26e1bf66bb4bf1b1b9b4f27d1f324875689cf0
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:46 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2015 11:22:12 +0200

x86/microcode: Remove modularization leftovers

Remove the remaining module functionality leftovers. Make "dis_ucode_ldr" an early_param and make it static again. Drop module aliases, autoloading table, description, etc.

Bump version number, while at it.

Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 arch/x86/include/asm/microcode.h          |  1 -
 arch/x86/kernel/cpu/microcode/amd.c       |  7 +-----
 arch/x86/kernel/cpu/microcode/core.c      | 36 +++++++++----------------------
 arch/x86/kernel/cpu/microcode/intel.c     |  7 +-----
 arch/x86/kernel/cpu/microcode/intel_lib.c |  1 -
 5 files changed, 12 insertions(+), 40 deletions(-)
arch/x86/include/asm/microcode.h +0 -1
index 9f953f7..34e62b1 100644
@@ -27,7 +27,6 @@ struct cpu_signature {
 struct device;
 
 enum ucode_state { UCODE_ERROR, UCODE_OK, UCODE_NFOUND };
-extern bool dis_ucode_ldr;
 
 struct microcode_ops {
 	enum ucode_state (*request_microcode_user) (int cpu,
arch/x86/kernel/cpu/microcode/amd.c +1 -6
index 20297fb..6eeda7b 100644
@@ -24,7 +24,7 @@
  *  Licensed under the terms of the GNU General Public
  *  License version 2. See file COPYING for details.
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/earlycpio.h>
 #include <linux/firmware.h>
@@ -32,7 +32,6 @@
 #include <linux/vmalloc.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/pci.h>
 
 #include <asm/microcode_amd.h>
@@ -42,10 +41,6 @@
 #include <asm/cpu.h>
 #include <asm/msr.h>
 
-MODULE_DESCRIPTION("AMD Microcode Update Driver");
-MODULE_AUTHOR("Peter Oruba");
-MODULE_LICENSE("GPL v2");
-
 static struct equiv_cpu_entry *equiv_cpu_table;
 
 struct ucode_patch {
arch/x86/kernel/cpu/microcode/core.c +10 -26
index 18848c7..7fc27f1 100644
@@ -19,7 +19,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -27,7 +27,6 @@
 #include <linux/capability.h>
 #include <linux/firmware.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/cpu.h>
 #include <linux/fs.h>
@@ -41,16 +40,18 @@
 #include <asm/processor.h>
 #include <asm/cmdline.h>
 
-MODULE_DESCRIPTION("Microcode Update Driver");
-MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
-MODULE_LICENSE("GPL");
-
-#define MICROCODE_VERSION	"2.00"
+#define MICROCODE_VERSION	"2.01"
 
 static struct microcode_ops	*microcode_ops;
 
-bool dis_ucode_ldr;
-module_param(dis_ucode_ldr, bool, 0);
+static bool dis_ucode_ldr;
+
+static int __init disable_loader(char *str)
+{
+	dis_ucode_ldr = true;
+	return 1;
+}
+__setup("dis_ucode_ldr", disable_loader);
 
 /*
  * Synchronization.
@@ -364,9 +365,6 @@ static void __exit microcode_dev_exit(void)
 {
 	misc_deregister(&microcode_dev);
 }
-
-MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
-MODULE_ALIAS("devname:cpu/microcode");
 #else
 #define microcode_dev_init()	0
 #define microcode_dev_exit()	do { } while (0)
@@ -617,20 +615,6 @@ static struct notifier_block mc_cpu_notifier = {
 	.notifier_call	= mc_cpu_callback,
 };
 
-#ifdef MODULE
-/* Autoload on Intel and AMD systems */
-static const struct x86_cpu_id __initconst microcode_id[] = {
-#ifdef CONFIG_MICROCODE_INTEL
-	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, },
-#endif
-#ifdef CONFIG_MICROCODE_AMD
-	{ X86_VENDOR_AMD, X86_FAMILY_ANY, X86_MODEL_ANY, },
-#endif
-	{}
-};
-MODULE_DEVICE_TABLE(x86cpu, microcode_id);
-#endif
-
 static struct attribute *cpu_root_microcode_attrs[] = {
 	&dev_attr_reload.attr,
 	NULL
arch/x86/kernel/cpu/microcode/intel.c +1 -6
index 2e09171..3f32558 100644
@@ -21,7 +21,7 @@
  *
  *#define DEBUG
  */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define pr_fmt(fmt) "microcode: " fmt
 
 #include <linux/earlycpio.h>
 #include <linux/firmware.h>
@@ -29,7 +29,6 @@
 #include <linux/vmalloc.h>
 #include <linux/initrd.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/mm.h>
@@ -40,10 +39,6 @@
 #include <asm/setup.h>
 #include <asm/msr.h>
 
-MODULE_DESCRIPTION("Microcode Update Driver");
-MODULE_AUTHOR("Tigran Aivazian <[email protected]>");
-MODULE_LICENSE("GPL");
-
 static unsigned long mc_saved_in_initrd[MAX_UCODE_COUNT];
 static struct mc_saved_data {
 	unsigned int mc_saved_count;
arch/x86/kernel/cpu/microcode/intel_lib.c +0 -1
index 1883d25..b96896b 100644
@@ -25,7 +25,6 @@
 #include <linux/firmware.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 
 #include <asm/microcode_intel.h>
 #include <asm/processor.h>
author maintainer
#11 lore raw

PATCH 4/6 x86/microcode/amd: Remove maintainers from comments

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

We have the MAINTAINERS file for that. Also, Andreas doesn't have the time for this work anymore.

Cc Andreas Herrmann <[email protected]>
---
 arch/x86/kernel/cpu/microcode/amd.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +0 -4
index 6eeda7b024c3..2233f8a76615 100644
@@ -11,10 +11,6 @@
  *  Based on work by:
  *  Tigran Aivazian <[email protected]>
  *
- *  Maintainers:
- *  Andreas Herrmann <[email protected]>
- *  Borislav Petkov <[email protected]>
- *
  *  early loader:
  *  Copyright (C) 2013 Advanced Micro Devices, Inc.
  *
Signature · 1 line
2.3.5
#12 lore raw

[tip:ras/core] x86/microcode/amd: Remove maintainers from comments

x86/microcode/amd: Remove maintainers from comments
Commit-ID:  6f7fc44bf1eef6768f9dcb527c737ab24a3203ac
Gitweb:     http://git.kernel.org/tip/6f7fc44bf1eef6768f9dcb527c737ab24a3203ac
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:47 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2015 11:22:12 +0200

x86/microcode/amd: Remove maintainers from comments

We have the MAINTAINERS file for that. Also, Andreas doesn't have the time for this work anymore.

Cc Andreas Herrmann <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 arch/x86/kernel/cpu/microcode/amd.c | 4 ----
 1 file changed, 4 deletions(-)
arch/x86/kernel/cpu/microcode/amd.c +0 -4
index 6eeda7b..2233f8a 100644
@@ -11,10 +11,6 @@
  *  Based on work by:
  *  Tigran Aivazian <[email protected]>
  *
- *  Maintainers:
- *  Andreas Herrmann <[email protected]>
- *  Borislav Petkov <[email protected]>
- *
  *  early loader:
  *  Copyright (C) 2013 Advanced Micro Devices, Inc.
  *
author maintainer
#13 lore raw

PATCH 5/6 x86/microcode/intel: Move ifdef DEBUG inside the function

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

... and save us the stub.

---
 arch/x86/kernel/cpu/microcode/intel.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/microcode/intel.c +2 -6
index 3f325586965e..ce47402eb2f9 100644
@@ -389,9 +389,9 @@ static int collect_cpu_info_early(struct ucode_cpu_info *uci)
 	return 0;
 }
 
-#ifdef DEBUG
 static void show_saved_mc(void)
 {
+#ifdef DEBUG
 	int i, j;
 	unsigned int sig, pf, rev, total_size, data_size, date;
 	struct ucode_cpu_info uci;
@@ -449,12 +449,8 @@ static void show_saved_mc(void)
 		}
 
 	}
-}
-#else
-static inline void show_saved_mc(void)
-{
-}
 #endif
+}
 
 #ifdef CONFIG_HOTPLUG_CPU
 static DEFINE_MUTEX(x86_cpu_microcode_mutex);
Signature · 1 line
2.3.5
#14 lore raw

[tip:ras/core] x86/microcode/intel: Move #ifdef DEBUG inside the function

x86/microcode/intel: Move #ifdef DEBUG inside the function
Commit-ID:  c595ac2bac930ce79f336c7a7e45e1ea38abfe16
Gitweb:     http://git.kernel.org/tip/c595ac2bac930ce79f336c7a7e45e1ea38abfe16
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:48 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2015 11:22:12 +0200

x86/microcode/intel: Move #ifdef DEBUG inside the function

... and save us the stub.

Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 arch/x86/kernel/cpu/microcode/intel.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/microcode/intel.c +2 -6
index 3f32558..ce47402 100644
@@ -389,9 +389,9 @@ static int collect_cpu_info_early(struct ucode_cpu_info *uci)
 	return 0;
 }
 
-#ifdef DEBUG
 static void show_saved_mc(void)
 {
+#ifdef DEBUG
 	int i, j;
 	unsigned int sig, pf, rev, total_size, data_size, date;
 	struct ucode_cpu_info uci;
@@ -449,12 +449,8 @@ static void show_saved_mc(void)
 		}
 
 	}
-}
-#else
-static inline void show_saved_mc(void)
-{
-}
 #endif
+}
 
 #ifdef CONFIG_HOTPLUG_CPU
 static DEFINE_MUTEX(x86_cpu_microcode_mutex);
author maintainer
#15 lore raw

PATCH 6/6 MAINTAINERS: Unify microcode driver section

In reply to Borislav Petkov

From: Borislav Petkov <[email protected]>

Merge the AMD and Intel sections and generalize pattern.

---
 MAINTAINERS | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
MAINTAINERS +5 -11
index 5f467845ef72..3a39ef4b3c09 100644
@@ -654,11 +654,6 @@ F:	drivers/gpu/drm/radeon/radeon_kfd.c
 F:	drivers/gpu/drm/radeon/radeon_kfd.h
 F:	include/uapi/linux/kfd_ioctl.h
 
-AMD MICROCODE UPDATE SUPPORT
-M:	Borislav Petkov <[email protected]>
-S:	Maintained
-F:	arch/x86/kernel/cpu/microcode/amd*
-
 AMD XGBE DRIVER
 M:	Tom Lendacky <[email protected]>
 L:	[email protected]
@@ -5430,12 +5425,6 @@ W:	https://01.org/linux-acpi
 S:	Supported
 F:	drivers/platform/x86/intel_menlow.c
 
-INTEL IA32 MICROCODE UPDATE SUPPORT
-M:	Borislav Petkov <[email protected]>
-S:	Maintained
-F:	arch/x86/kernel/cpu/microcode/core*
-F:	arch/x86/kernel/cpu/microcode/intel*
-
 INTEL I/OAT DMA DRIVER
 M:	Dave Jiang <[email protected]>
 R:	Dan Williams <[email protected]>
@@ -11451,6 +11440,11 @@ L:	[email protected]
 S:	Maintained
 F:	arch/x86/kernel/cpu/mcheck/*
 
+X86 MICROCODE UPDATE SUPPORT
+M:	Borislav Petkov <[email protected]>
+S:	Maintained
+F:	arch/x86/kernel/cpu/microcode/*
+
 X86 VDSO
 M:	Andy Lutomirski <[email protected]>
 L:	[email protected]
Signature · 1 line
2.3.5
#16 lore raw

[tip:ras/core] MAINTAINERS: Unify the microcode driver section

MAINTAINERS: Unify the microcode driver section
Commit-ID:  79ebdc9536c132eb92b4bcce26daaed7f4bf359e
Gitweb:     http://git.kernel.org/tip/79ebdc9536c132eb92b4bcce26daaed7f4bf359e
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 20 Oct 2015 11:54:49 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 21 Oct 2015 11:22:13 +0200

MAINTAINERS: Unify the microcode driver section

Merge the AMD and Intel sections and generalize the file patterns.

Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Dave Jones <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Len Brown <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Tony Luck <[email protected]>
---
 MAINTAINERS | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
MAINTAINERS +5 -11
index 5f46784..3a39ef4 100644
@@ -654,11 +654,6 @@ F:	drivers/gpu/drm/radeon/radeon_kfd.c
 F:	drivers/gpu/drm/radeon/radeon_kfd.h
 F:	include/uapi/linux/kfd_ioctl.h
 
-AMD MICROCODE UPDATE SUPPORT
-M:	Borislav Petkov <[email protected]>
-S:	Maintained
-F:	arch/x86/kernel/cpu/microcode/amd*
-
 AMD XGBE DRIVER
 M:	Tom Lendacky <[email protected]>
 L:	[email protected]
@@ -5430,12 +5425,6 @@ W:	https://01.org/linux-acpi
 S:	Supported
 F:	drivers/platform/x86/intel_menlow.c
 
-INTEL IA32 MICROCODE UPDATE SUPPORT
-M:	Borislav Petkov <[email protected]>
-S:	Maintained
-F:	arch/x86/kernel/cpu/microcode/core*
-F:	arch/x86/kernel/cpu/microcode/intel*
-
 INTEL I/OAT DMA DRIVER
 M:	Dave Jiang <[email protected]>
 R:	Dan Williams <[email protected]>
@@ -11451,6 +11440,11 @@ L:	[email protected]
 S:	Maintained
 F:	arch/x86/kernel/cpu/mcheck/*
 
+X86 MICROCODE UPDATE SUPPORT
+M:	Borislav Petkov <[email protected]>
+S:	Maintained
+F:	arch/x86/kernel/cpu/microcode/*
+
 X86 VDSO
 M:	Andy Lutomirski <[email protected]>
 L:	[email protected]