store_cpu_caps(&prev_info);
ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
+
+ if (microcode_ops->finalize_late_load)
+ microcode_ops->finalize_late_load(ret);
+
if (!ret) {
pr_info("Reload succeeded, microcode revision: 0x%x -> 0x%x\n",
old, boot_cpu_data.microcode);
/* Current microcode patch used in early patching on the APs. */
static struct microcode_intel *ucode_patch_va __read_mostly;
+static struct microcode_intel *ucode_patch_late __read_mostly;
/* last level cache size per core */
static unsigned int llc_size_per_core __ro_after_init;
if (WARN_ON(raw_smp_processor_id() != cpu))
return UCODE_ERROR;
- mc = ucode_patch_va;
- if (!mc) {
- mc = uci->mc;
- if (!mc)
- return UCODE_NFOUND;
- }
+ mc = ucode_patch_late;
+ if (!mc)
+ return UCODE_NFOUND;
/*
* Save us the MSR write below - which is a particular expensive
if (!new_mc)
return UCODE_NFOUND;
- /* Save for CPU hotplug */
- save_microcode_patch((struct microcode_intel *)new_mc);
- uci->mc = ucode_patch_va;
-
- vfree(new_mc);
-
- pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
- cpu, cur_rev, uci->cpu_sig.rev);
-
+ ucode_patch_late = (struct microcode_intel *)new_mc;
return UCODE_NEW;
}
return ret;
}
+static void finalize_late_load(int result)
+{
+ if (!result)
+ save_microcode_patch(ucode_patch_late);
+
+ vfree(ucode_patch_late);
+ ucode_patch_late = NULL;
+}
+
static struct microcode_ops microcode_intel_ops = {
.request_microcode_fw = request_microcode_fw,
.collect_cpu_info = collect_cpu_info,
.apply_microcode = apply_microcode_intel,
+ .finalize_late_load = finalize_late_load,
};
static __init void calc_llc_size_per_core(struct cpuinfo_x86 *c)