Skip to content

Commit cfb52a5

Browse files
suryasaimadhuKAGA-KOKO
authored andcommitted
x86/microcode: Request microcode on the BSP
... so that any newer version can land in the cache and can later be fished out by the application functions. Do that before grabbing the hotplug lock. Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Tom Lendacky <[email protected]> Tested-by: Ashok Raj <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Cc: Arjan Van De Ven <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent d8c3b52 commit cfb52a5

File tree

1 file changed

+5
-6
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,22 @@ static int check_online_cpus(void)
499499
static enum ucode_state reload_for_cpu(int cpu)
500500
{
501501
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
502-
enum ucode_state ustate;
503502

504503
if (!uci->valid)
505504
return UCODE_OK;
506505

507-
ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev, true);
508-
if (ustate != UCODE_OK)
509-
return ustate;
510-
511506
return apply_microcode_on_target(cpu);
512507
}
513508

514509
static ssize_t reload_store(struct device *dev,
515510
struct device_attribute *attr,
516511
const char *buf, size_t size)
517512
{
513+
int cpu, bsp = boot_cpu_data.cpu_index;
518514
enum ucode_state tmp_ret = UCODE_OK;
519515
bool do_callback = false;
520516
unsigned long val;
521517
ssize_t ret = 0;
522-
int cpu;
523518

524519
ret = kstrtoul(buf, 0, &val);
525520
if (ret)
@@ -528,6 +523,10 @@ static ssize_t reload_store(struct device *dev,
528523
if (val != 1)
529524
return size;
530525

526+
tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev, true);
527+
if (tmp_ret != UCODE_OK)
528+
return size;
529+
531530
get_online_cpus();
532531

533532
ret = check_online_cpus();

0 commit comments

Comments
 (0)