lkml.org 
[lkml]   [2018]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 6/7] x86/microcode: Request microcode on the BSP
    Date
    From: Borislav Petkov <bp@suse.de>

    ... 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>
    ---
    arch/x86/kernel/cpu/microcode/core.c | 11 +++++------
    1 file changed, 5 insertions(+), 6 deletions(-)

    diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
    index fa32cb3dcca5..5dd157d48606 100644
    --- a/arch/x86/kernel/cpu/microcode/core.c
    +++ b/arch/x86/kernel/cpu/microcode/core.c
    @@ -499,15 +499,10 @@ 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);
    }

    @@ -515,11 +510,11 @@ 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)
    @@ -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();
    --
    2.13.0
    \
     
     \ /
      Last update: 2018-02-28 11:31    [W:7.834 / U:1.544 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site