Received: by 10.192.165.156 with SMTP id m28csp60147imm; Tue, 10 Apr 2018 16:23:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/VzH46H9tDAqWqtde2bX0mn/S05AZQSJEa0fsXWsXSb2vsq5LeRMIUohnADiiNPiEDN1Z X-Received: by 10.99.95.214 with SMTP id t205mr1688241pgb.145.1523402588123; Tue, 10 Apr 2018 16:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402588; cv=none; d=google.com; s=arc-20160816; b=PgiPHJ/u7xo5qd7jM2qtloRlPiS9Mv6brF/0ydiSzDq9cKlWAS1iZoc4tLJXsWS//5 BVz/eIRBIL5ALEt0+8mIIGpinQenfRhcYuhVSRcL5zPRzYrU8PYAnefW8QE/OjMYXitd cLDtyEPjxgs2ksjAavkw5zSzMbfCsyiYj2W9VOTPvNsvbV9nddh1H+OTpEzso8AfHnNi rDctn+JJSA5vt2lR8d/ucf0Sk1SWXIj+zbjRBZT95T9B5RCSsS3buT24D4Th2TrNjBVg RS68jw9SJBcSEMUHotcjtKOJYddTf86lNyp087cRSgb3XsxBWO+MDSAHdI7lj2Xjhpr1 hMIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Qm37D2WnSLtTLp1HNU9LgtncwGt2P/smL95K8StWTzg=; b=Wi1unQn3vyeEJSoZBN3N8khMUeYRBna+MdBLLk6tEZTN5u4BsOBxfY0lCJYLOIWYUS RnUHgPzj4myyNDTvfbYp2eeEdSAgmPgdx0sjaaSgwFtrDTndvfe48fc+iei+RsFwFnCs 32K9/vNXay/Jy6mLwQou6RRhNFB2UsatUFkTzpR7seGlO2qGsKLTg4WL/fTTsf+c8Zel SXRK9S3rAFeczpb6V/1gsCC3XPYtSqmNFHaoKu7sCSfcIFxNr2DMeD0nIKDZ613Fvrxy 2nHKPvHAP61c0EC1r6JGPp+wukuBp2mvvBuB0jTKeD+HneZXbtC8rUuBlm1huxg1s/cL 7B2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si3583967ple.629.2018.04.10.16.22.31; Tue, 10 Apr 2018 16:23:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755331AbeDJXQA (ORCPT + 99 others); Tue, 10 Apr 2018 19:16:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40740 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754870AbeDJWbx (ORCPT ); Tue, 10 Apr 2018 18:31:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 84227907; Tue, 10 Apr 2018 22:31:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Thomas Gleixner , Tom Lendacky , Ashok Raj , Arjan Van De Ven Subject: [PATCH 4.15 117/168] x86/microcode: Request microcode on the BSP Date: Wed, 11 Apr 2018 00:24:19 +0200 Message-Id: <20180410212805.503854342@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Borislav Petkov commit cfb52a5a09c8ae3a1dafb44ce549fde5b69e8117 upstream. ... 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 Signed-off-by: Thomas Gleixner Tested-by: Tom Lendacky Tested-by: Ashok Raj Reviewed-by: Tom Lendacky Cc: Arjan Van De Ven Link: https://lkml.kernel.org/r/20180228102846.13447-7-bp@alien8.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- 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, µcode_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 devic 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 devic if (val != 1) return size; + tmp_ret = microcode_ops->request_microcode_fw(bsp, µcode_pdev->dev, true); + if (tmp_ret != UCODE_OK) + return size; + get_online_cpus(); ret = check_online_cpus();