Skip to content

Commit b48b26f

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/microcode: Remove pointless apply() invocation
Microcode is applied on the APs during early bringup. There is no point in trying to apply the microcode again during the hotplug operations and neither at the point where the microcode device is initialized. Collect CPU info and microcode revision in setup_online_cpu() for now. This will move to the CPU hotplug callback later. [ bp: Leave the starting notifier for the following scenario: - boot, late load, suspend to disk, resume without the starting notifier, only the last core manages to update the microcode upon resume: # rdmsr -a 0x8b 10000bf 10000bf 10000bf 10000bf 10000bf 10000dc <---- This is on an AMD F10h machine. For the future, one should check whether potential unification of the CPU init path could cover the resume path too so that this can be simplified even more. tglx: This is caused by the odd handling of APs which try to find the microcode blob in builtin or initrd instead of caching the microcode blob during early init before the APs are brought up. Will be cleaned up in a later step. ] Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20231017211723.018821624@linutronix.de
1 parent b7fcd99 commit b48b26f

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

  • arch/x86/kernel/cpu/microcode

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -487,17 +487,6 @@ static void microcode_fini_cpu(int cpu)
487487
microcode_ops->microcode_fini_cpu(cpu);
488488
}
489489

490-
static enum ucode_state microcode_init_cpu(int cpu)
491-
{
492-
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
493-
494-
memset(uci, 0, sizeof(*uci));
495-
496-
microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
497-
498-
return microcode_ops->apply_microcode(cpu);
499-
}
500-
501490
/**
502491
* microcode_bsp_resume - Update boot CPU microcode during resume.
503492
*/
@@ -552,14 +541,14 @@ static int mc_cpu_down_prep(unsigned int cpu)
552541
static void setup_online_cpu(struct work_struct *work)
553542
{
554543
int cpu = smp_processor_id();
555-
enum ucode_state err;
544+
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
556545

557-
err = microcode_init_cpu(cpu);
558-
if (err == UCODE_ERROR) {
559-
pr_err("Error applying microcode on CPU%d\n", cpu);
560-
return;
561-
}
546+
memset(uci, 0, sizeof(*uci));
562547

548+
microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
549+
cpu_data(cpu).microcode = uci->cpu_sig.rev;
550+
if (!cpu)
551+
boot_cpu_data.microcode = uci->cpu_sig.rev;
563552
mc_cpu_online(cpu);
564553
}
565554

0 commit comments

Comments
 (0)