mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Rik van Riel <riel@redhat.com>, Andi Kleen <ak@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jiri Kosina <jikos@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
	Kees Cook <keescook@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linux-foundation.org>,
	David Woodhouse <dwmw@amazon.co.uk>, Paul Turner <pjt@google.com>
Subject: [PATCH v1 2/2] x86/cpu/AMD: Clear RETPOLINE_AMD if LFENCE is not serializing
Date: Tue, 09 Jan 2018 16:37:45 -0600	[thread overview]
Message-ID: <20180109223745.29322.30862.stgit@tlendack-t1.amdoffice.net> (raw)
In-Reply-To: <20180109223723.29322.59126.stgit@tlendack-t1.amdoffice.net>

During early boot, spectre_v2_check_boottime_disable() sets the
RETPOLINE_AMD feature for AMD hardware (before init_amd() is called).
Since the RETPOLINE_AMD feature uses LFENCE to perform speculation
control, it can only be used if LFENCE is serializing.  Clear the
RETPOLINE_AMD feature if the MSR write to make LFENCE serializing
is not successful.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 arch/x86/kernel/cpu/amd.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index ea831c8..8a0076b 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -13,6 +13,7 @@
 #include <asm/smp.h>
 #include <asm/pci-direct.h>
 #include <asm/delay.h>
+#include <asm/nospec-branch.h>
 
 #ifdef CONFIG_X86_64
 # include <asm/mmconfig.h>
@@ -854,6 +855,9 @@ static void init_amd(struct cpuinfo_x86 *c)
 		} else {
 			/* MFENCE stops RDTSC speculation */
 			set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC);
+
+			/* Don't use the LFENCE-based retpoline support */
+			retpoline_amd_disable();
 		}
 	}
 

      parent reply	other threads:[~2018-01-09 22:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 22:37 [PATCH v1 0/2] x86/retpoline: " Tom Lendacky
2018-01-09 22:37 ` [PATCH v1 1/2] x86/retpoline: Add a function to clear the RETPOLINE_AMD feature Tom Lendacky
2018-01-09 22:46   ` Thomas Gleixner
2018-01-09 23:01     ` Tom Lendacky
2018-01-09 23:09       ` Thomas Gleixner
2018-01-09 23:38         ` Tom Lendacky
2018-01-09 23:43           ` Thomas Gleixner
2018-01-10  0:22             ` Tom Lendacky
2018-01-09 22:37 ` Tom Lendacky [this message]

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=20180109223745.29322.30862.stgit@tlendack-t1.amdoffice.net \
    --to=thomas.lendacky@amd.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=gregkh@linux-foundation.org \
    --cc=jikos@kernel.org \
    --cc=keescook@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®