Received: by 10.192.165.156 with SMTP id m28csp35984imm; Tue, 10 Apr 2018 15:52:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48nK8aq6MX35shyMwXQj8rlLAPuL2s+bl4wdvYeFSl2IoocrVtveheE8g99bJjFwZQWvAb2 X-Received: by 10.99.164.82 with SMTP id c18mr1618388pgp.101.1523400759583; Tue, 10 Apr 2018 15:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400759; cv=none; d=google.com; s=arc-20160816; b=Gtp1Tda1f0aArzVq6E86lKDveyK6H/B+QBQb00xfPr59VA410vZZbcVtN6BTKVxM0y 8n7etgvPME4iCbNa/0nUdjjnCXzrXBWq3hCV8DjxO51aSewLoExugkwp/JZjnxaU0HQK +tol5kHX5+Wtrd10uO/rZw3WUK0pIMhv4RWrGwPd9uOu3cmzQz/has9p5cBueKlvVqo5 nO+U7Bjv9708VaXOs8/5zW9RAkdv0ej/mPGJF44eQuLzYHoPl2KvX8Z7R4gLGZAqu+3e OvTW75rNVHJvYCP0X16ka26C5ebaC9QF8DkbJi5g6iIWlydVSOzK9g2KPNk5FDpNBcLp iiGw== 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=WrIppQyD2xKIFLR0yx6eSDzRhU3soszZQXfUsN/1WCk=; b=0vpCVJvpYD1rWnszLGBA/pTGVCsdFosUZ7bJTRcoK0tGn1mJxsonO6STT5QYOb9veE Q60/KA1MaW+C6lJbpTMF9hSmPZKGpEXgO4iEz6nbxDlAq27B5by5t0Hc+LRgTMLrVs6c KIUmMZWdKQH6DqGWR8XqrGvpDAkG0F1u1idGkbMQ2zwci0ZT2oMsRH05agsxxhak0iP9 Z+Mo/8d3WJKzsTdZyLX7H1efRx2dDc+6+NGoQ6Fo2Ct/O/Key3T6sGJjC+n88tz7wQuO G/Ev/WnQJlROh2APO4FFO5PMyF0YMF6DMpgmNW/XdtLRD2NfHJBvl1WtxDzsbfunJH4S 13AA== 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 e13si2732308pff.238.2018.04.10.15.52.02; Tue, 10 Apr 2018 15:52:39 -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 S1756026AbeDJWil (ORCPT + 99 others); Tue, 10 Apr 2018 18:38:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44900 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755969AbeDJWik (ORCPT ); Tue, 10 Apr 2018 18:38:40 -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 41387D0A; Tue, 10 Apr 2018 22:38:39 +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.14 093/138] x86/microcode: Request microcode on the BSP Date: Wed, 11 Apr 2018 00:24:43 +0200 Message-Id: <20180410212913.001412711@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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();