[PATCH] x86/microcode: Remove useless code after early microcode support added

From: Zhenzhong Duan
Date: Tue Apr 02 2019 - 04:45:01 EST


After early microcode update was added, microcode couldn't be configured
as a module, microcode update happens at early bootup and cpu hotplug
stage. This made the microcode update code in module loading stage
useless.

This patch remove the useless code.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: Srinivas Eeda <srinivas.eeda@xxxxxxxxxx>
---
arch/x86/kernel/cpu/microcode/core.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 5260185..7f05bcb 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -710,10 +710,6 @@ static enum ucode_state microcode_init_cpu(int cpu, bool refresh_fw)
if (collect_cpu_info(cpu))
return UCODE_ERROR;

- /* --dimm. Trigger a delayed update? */
- if (system_state != SYSTEM_RUNNING)
- return UCODE_NFOUND;
-
ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev, refresh_fw);
if (ustate == UCODE_NEW) {
pr_debug("CPU%d updated upon init\n", cpu);
@@ -738,21 +734,14 @@ static enum ucode_state microcode_update_cpu(int cpu)

static int mc_device_add(struct device *dev, struct subsys_interface *sif)
{
- int err, cpu = dev->id;
+ int cpu = dev->id;

if (!cpu_online(cpu))
return 0;

pr_debug("CPU%d added\n", cpu);

- err = sysfs_create_group(&dev->kobj, &mc_attr_group);
- if (err)
- return err;
-
- if (microcode_init_cpu(cpu, true) == UCODE_ERROR)
- return -EINVAL;
-
- return err;
+ return sysfs_create_group(&dev->kobj, &mc_attr_group);
}

static void mc_device_remove(struct device *dev, struct subsys_interface *sif)
--
1.8.3.1