Received: by 10.223.185.116 with SMTP id b49csp6091756wrg; Thu, 8 Mar 2018 01:28:06 -0800 (PST) X-Google-Smtp-Source: AG47ELvI2oW3uVhBqgiZV7/sRc3ueQ0LrKLB7WEsyzD1WEAJO7OlGt9XO5eJ6WCcBZV4shbA9tMd X-Received: by 10.98.56.131 with SMTP id f125mr25781069pfa.190.1520501286573; Thu, 08 Mar 2018 01:28:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520501286; cv=none; d=google.com; s=arc-20160816; b=UDiAlAMgr484Qa2ztP5mFd/rJUFPlSA4eDzKZBriDAAHpzbViDrWbHJL1z9JRo05uz XpLNiSNommtNOaykj6GbOfcsC1t1GUfmWh3hQHHTh2rs9oUT3o88qcVnVs6ML7mtJKaI e5zNlrrnmholFiNJ3KhpwT9fRDFAjN/A2EDyYw8pV46hKlbOOIp5K5g/gRlTpIPpF9HO T5NQZy8038AaC8VSijgew1wTtrnFBpPixd9Y03LiJHuoQYXcwza7r9AsV145zoq9Na+J 6a3WDd2kJCTrAH83vlUIcqTqlaeb02BT/xUNJdT3v+vqRauygPLMlieweMsMLyZPB1OH OMNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=apACTovCNJF04Yn1AgGj05xmtRwSxiO/1DrF2Pp0qJo=; b=gxEVzfAiynyT0ueLRTfXA4D47FG7eIV3Ua3yB2fR519mMeo7AofCXp3YG6SjbSrWrl pZEEG2iPkWW/dpWvJTBTLLXe4IqyaJIVO/kGugrnNm3YfuzTYRGECRZnmCbmupM4u2m2 +4FVvQbGTQohA71dkZp9gs+YdY9fkgDkr1Jr8M/CKC2kIIC7ImPyl3mjaE5e4ZFyhCtd rovgsCgGopWJaOOboTiUSxuwC6Pv4JF8XiDGlsXL9l04dXApG/ZOAOcYJU38J/ZMr+AL ai7rdsKDESOGC3+QjWznPtE3YcvjxVyu35BXeTNvJazofn4PLWfM1TgoDOezXLaGVOsf Fedg== 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 9-v6si14596250plc.173.2018.03.08.01.27.52; Thu, 08 Mar 2018 01:28:06 -0800 (PST) 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 S1755576AbeCHJ0Z (ORCPT + 99 others); Thu, 8 Mar 2018 04:26:25 -0500 Received: from terminus.zytor.com ([198.137.202.136]:45497 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754883AbeCHJ0X (ORCPT ); Thu, 8 Mar 2018 04:26:23 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w289QE8q027375; Thu, 8 Mar 2018 01:26:14 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w289QE0E027372; Thu, 8 Mar 2018 01:26:14 -0800 Date: Thu, 8 Mar 2018 01:26:14 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Ashok Raj Message-ID: Cc: hpa@zytor.com, thomas.lendacky@amd.com, mingo@kernel.org, tglx@linutronix.de, bp@suse.de, arjan.van.de.ven@intel.com, linux-kernel@vger.kernel.org, ashok.raj@intel.com Reply-To: bp@suse.de, linux-kernel@vger.kernel.org, arjan.van.de.ven@intel.com, ashok.raj@intel.com, hpa@zytor.com, thomas.lendacky@amd.com, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <20180228102846.13447-4-bp@alien8.de> References: <1519352533-15992-3-git-send-email-ashok.raj@intel.com> <20180228102846.13447-4-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/microcode/intel: Writeback and invalidate caches before updating microcode Git-Commit-ID: 91df9fdf51492aec9fed6b4cbd33160886740f47 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 91df9fdf51492aec9fed6b4cbd33160886740f47 Gitweb: https://git.kernel.org/tip/91df9fdf51492aec9fed6b4cbd33160886740f47 Author: Ashok Raj AuthorDate: Wed, 28 Feb 2018 11:28:42 +0100 Committer: Thomas Gleixner CommitDate: Thu, 8 Mar 2018 10:19:25 +0100 x86/microcode/intel: Writeback and invalidate caches before updating microcode 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 --- arch/x86/kernel/cpu/microcode/intel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 87bd6dc94081..e2864bc2d575 100644 --- 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 ucode_cpu_info *uci, bool early) 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_intel(int cpu) 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);