Received: by 10.192.165.156 with SMTP id m28csp60118imm; Tue, 10 Apr 2018 16:23:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx49YNbP3MZ9LFvyXwZ3R3qcj1+ftJNYkcgluJnqKODc4s2kD4AkDprE9x4slck56WM1EZoav X-Received: by 10.99.143.75 with SMTP id r11mr1656705pgn.341.1523402583514; Tue, 10 Apr 2018 16:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402583; cv=none; d=google.com; s=arc-20160816; b=PJKDvXnHolzF1ghJVM5nEDBo63IldFesuGxzFtDR9VEWWmcM4gu009GPU8CarirZKE T4F6+0+j72QEqZV8pmYWOR4tJV/i7l4DKaE10BAnJAl8hkQLtz8c7FTXlLzLgxBpfHDQ NpssFTZy5lrnEPAcznJ/23uCUWGM9menoqa43atPs+licYFk0MEo8orgn5CNCxZ1TzYF dMRK0bfDWliZjr908M6rS39tEIJ0PSxRZhdBX9KaCS9YFWJt2J9V+bRnBRsshVIE2185 SKH8k88CoeaWTtBOyQe5r+inKM4216m1vh9IdGbZZjLplOCVso0a3R/O/YDzGLyChXQX PL1A== 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=UF4VIDUvrbwLO3+ZHyrxx3kXwCQ/HgxpdZrY2LLGkGo=; b=R4W7WLbpj8pMM7IhMQLrOscWE045DnB5Ng4VB4H8cCdpn7CewHtWcE1v8F7cy1eeJp PKQpiQQKldhfzxqKZTgeVuD9v4w0Ggz8XMitRiNEEFsYCN2ZpGs5i1VIXXaVT+sNZTOG o7MtKSk+Mi6HsA0YEXUOYe6+r5Ach1qW8oRej5GF4O9FmvW96l5KP4Tv+Jtn7L21tPbW pasDu1DfCT4+UTgcg4LLUohZsRIax96Ngv2hS8OoNcua/3hN9W4aC3ns5lVq56p890MF KfGwzXzzIxkTtBMv+NlP0JgHlaqf0/1M2bCdqnqExhAoILOLD2IHwXXXYC0OdpyQoPno btNQ== 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 z196si2459946pgz.349.2018.04.10.16.22.26; Tue, 10 Apr 2018 16:23:03 -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 S1754880AbeDJWby (ORCPT + 99 others); Tue, 10 Apr 2018 18:31:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40728 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752802AbeDJWbu (ORCPT ); Tue, 10 Apr 2018 18:31:50 -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 CEB1A720; Tue, 10 Apr 2018 22:31:49 +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 116/168] x86/microcode/intel: Look into the patch cache first Date: Wed, 11 Apr 2018 00:24:18 +0200 Message-Id: <20180410212805.443922815@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 d8c3b52c00a05036e0a6b315b4b17921a7b67997 upstream. The cache might contain a newer patch - look in there first. A follow-on change will make sure newest patches are loaded into the cache of microcode patches. Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Tested-by: Tom Lendacky Tested-by: Ashok Raj Cc: Arjan Van De Ven Link: https://lkml.kernel.org/r/20180228102846.13447-6-bp@alien8.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/intel.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -791,9 +791,9 @@ static int collect_cpu_info(int cpu_num, static enum ucode_state apply_microcode_intel(int cpu) { - struct microcode_intel *mc; - struct ucode_cpu_info *uci; + struct ucode_cpu_info *uci = ucode_cpu_info + cpu; struct cpuinfo_x86 *c = &cpu_data(cpu); + struct microcode_intel *mc; static int prev_rev; u32 rev; @@ -801,11 +801,10 @@ static enum ucode_state apply_microcode_ if (WARN_ON(raw_smp_processor_id() != cpu)) return UCODE_ERROR; - uci = ucode_cpu_info + cpu; - mc = uci->mc; + /* Look for a newer patch in our cache: */ + mc = find_patch(uci); if (!mc) { - /* Look for a newer patch in our cache: */ - mc = find_patch(uci); + mc = uci->mc; if (!mc) return UCODE_NFOUND; }