Received: by 10.192.165.156 with SMTP id m28csp61064imm; Tue, 10 Apr 2018 16:24:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/6rEEkFqEBJfK7WpSzAmfmEvNCCNzQ2DyUWgQ0gwbToe4aWXoKEe9G+78BMCG4IWPzupF X-Received: by 10.98.210.7 with SMTP id c7mr1951191pfg.92.1523402665479; Tue, 10 Apr 2018 16:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402665; cv=none; d=google.com; s=arc-20160816; b=wbJb+4H5zjE1XT32UlTh9droIPKSiIj7M/6ri8f0Czgla9S25ZPIBshRVZLy49/gmA aQS5Tho4lbmZ6AIlqVb8CPlprInaFuLt0XWUkPb+xHbfT7yf+gcG+VCe94jNIFGhnyOc dvH7ZfJdm+hRe92gfjCN4wqkssyP9r5yIjhw2k9KfnNMolUgvnu/J6OGqgGz/e2TKaHS eS1C+IXeobsQgfWZBI+nMAkhBSLFPVOSc5RJT5sN076NheGCHwaPtrcKJS5WWFASO8Gx hR43TsqMMkZ4htDfrotl24dERf7Q13zXpjXiHoGldfwT/RDn2jfmiokfOsPyF76AStBa XuPQ== 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=vDraaTi7ZRa7xGlWLEe28qagsUCKuMGmYemv5Va3q+g=; b=TeM8ISQ8ia+MiDHaZ/kFgkmyHh+3XcW8G53aJxHAe0bwapLyO75YBpiuPJrZ7NpI89 vKeZezPAdC2DjNY2LmAIjiIXBvpKIK9SPVH8bNg074GIwK/a1tv5tCo+KRVehwbHz7eH h4ldtHC+xf6/9rfu/0TkJw9v4Dd2who4eu/k0bTSMQNRfLrzFOuN3ghevUXTAARb71Qt +DdbriBjRSnvc0M7Vs5FXpSHrcNBhYZujWV0CZppfy+be1T/CNK7mTXjnWQHhOFFOicK eFiETE5Bi4457G/dYdfwdTAPH+UzLP0ZGrmhTodlLkCx19Qrzs9o8kcLSAVF4d8DULOE 71nQ== 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 f1si2388437pgq.806.2018.04.10.16.23.48; Tue, 10 Apr 2018 16:24:25 -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 S1755467AbeDJXSx (ORCPT + 99 others); Tue, 10 Apr 2018 19:18:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40318 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754769AbeDJWbS (ORCPT ); Tue, 10 Apr 2018 18:31:18 -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 42359DE0; Tue, 10 Apr 2018 22:31:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashok Raj , Borislav Petkov , Thomas Gleixner , Tom Lendacky , Arjan Van De Ven Subject: [PATCH 4.15 114/168] x86/microcode/intel: Writeback and invalidate caches before updating microcode Date: Wed, 11 Apr 2018 00:24:16 +0200 Message-Id: <20180410212805.280595107@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: Ashok Raj commit 91df9fdf51492aec9fed6b4cbd33160886740f47 upstream. Updating microcode is less error prone when caches have been flushed and depending on what exactly the microcode is updating. For example, some of the issues around certain Broadwell parts can be addressed by doing a full cache flush. [ Borislav: Massage it and use native_wbinvd() in both cases. ] Signed-off-by: Ashok Raj Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Tested-by: Tom Lendacky Tested-by: Ashok Raj Cc: Arjan Van De Ven Link: http://lkml.kernel.org/r/1519352533-15992-3-git-send-email-ashok.raj@intel.com Link: https://lkml.kernel.org/r/20180228102846.13447-4-bp@alien8.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/intel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -600,6 +600,12 @@ static int apply_microcode_early(struct return UCODE_OK; } + /* + * Writeback and invalidate caches before updating microcode to avoid + * internal issues depending on what the microcode is updating. + */ + native_wbinvd(); + /* write microcode via MSR 0x79 */ native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits); @@ -816,6 +822,12 @@ static enum ucode_state apply_microcode_ return UCODE_OK; } + /* + * Writeback and invalidate caches before updating microcode to avoid + * internal issues depending on what the microcode is updating. + */ + native_wbinvd(); + /* write microcode via MSR 0x79 */ wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);