stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ashok Raj <ashok.raj@intel.com>
To: gregkh@linuxfoundation.org, tglx@linutronix.de
Cc: Ashok Raj <ashok.raj@intel.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org, bp@suse.de,
	thomas.lendacky@amd.com, arjan.van.de.ven@intel.com,
	asit.k.mallick@intel.com
Subject: [4.15 & 4.14 stable 06/12] x86/microcode/intel: Writeback and invalidate caches before updating microcode
Date: Fri,  6 Apr 2018 11:30:20 -0700	[thread overview]
Message-ID: <1523039426-3938-7-git-send-email-ashok.raj@intel.com> (raw)
In-Reply-To: <1523039426-3938-1-git-send-email-ashok.raj@intel.com>

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 <ashok.raj@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Tested-by: Ashok Raj <ashok.raj@intel.com>
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Asit K Mallick <asit.k.mallick@intel.com>
Cc: stable@vger.kernel.org
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 87bd6dc..e2864bc 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);
 
-- 
2.7.4

  parent reply	other threads:[~2018-04-06 18:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 18:30 [4.15 & 4.14 stable 00/12] Series to update microcode loading Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 01/12] x86/microcode: Propagate return value from updating functions Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 02/12] x86/CPU: Add a microcode loader callback Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 03/12] x86/CPU: Check CPU feature bits after microcode upgrade Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 04/12] x86/microcode: Get rid of struct apply_microcode_ctx Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 05/12] x86/microcode/intel: Check microcode revision before updating sibling threads Ashok Raj
2018-04-06 18:30 ` Ashok Raj [this message]
2018-04-06 18:30 ` [4.15 & 4.14 stable 07/12] x86/microcode: Do not upload microcode if CPUs are offline Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 08/12] x86/microcode/intel: Look into the patch cache first Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 09/12] x86/microcode: Request microcode on the BSP Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 10/12] x86/microcode: Synchronize late microcode loading Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 11/12] x86/microcode: Attempt late loading only when new microcode is present Ashok Raj
2018-04-06 18:30 ` [4.15 & 4.14 stable 12/12] x86/microcode: Fix CPU synchronization routine Ashok Raj
2018-04-10 15:47 ` [4.15 & 4.14 stable 00/12] Series to update microcode loading Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523039426-3938-7-git-send-email-ashok.raj@intel.com \
    --to=ashok.raj@intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=bp@suse.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).