Skip to content

Commit

Permalink
x86/microcode: Request microcode on the BSP
Browse files Browse the repository at this point in the history
... 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 <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Tested-by: Ashok Raj <ashok.raj@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
Link: https://lkml.kernel.org/r/20180228102846.13447-7-bp@alien8.de
  • Loading branch information
Borislav Petkov authored and Thomas Gleixner committed Mar 8, 2018
1 parent d8c3b52 commit cfb52a5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/x86/kernel/cpu/microcode/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,27 +499,22 @@ static int check_online_cpus(void)
static enum ucode_state reload_for_cpu(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
enum ucode_state ustate;

if (!uci->valid)
return UCODE_OK;

ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev, true);
if (ustate != UCODE_OK)
return ustate;

return apply_microcode_on_target(cpu);
}

static ssize_t reload_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
int cpu, bsp = boot_cpu_data.cpu_index;
enum ucode_state tmp_ret = UCODE_OK;
bool do_callback = false;
unsigned long val;
ssize_t ret = 0;
int cpu;

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

tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev, true);
if (tmp_ret != UCODE_OK)
return size;

get_online_cpus();

ret = check_online_cpus();
Expand Down

0 comments on commit cfb52a5

Please sign in to comment.