linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<hpa@zytor.com>, <x86@kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <DavidWang@zhaoxin.com>, <CooperYan@zhaoxin.com>,
	<QiyuanWang@zhaoxin.com>, <HerryYang@zhaoxin.com>
Subject: [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs
Date: Wed, 15 Jan 2020 16:05:00 +0800	[thread overview]
Message-ID: <1579075500-7065-1-git-send-email-TonyWWang-oc@zhaoxin.com> (raw)

These CPUs are not affected by spectre_v2, so clear spectre_v2 bug flag
in their specific initialization code.

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
---
 arch/x86/kernel/cpu/centaur.c | 5 +++++
 arch/x86/kernel/cpu/zhaoxin.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index b98529e..3567560 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -250,6 +250,11 @@ static void init_centaur(struct cpuinfo_x86 *c)
 
 	if (cpu_has(c, X86_FEATURE_VMX))
 		centaur_detect_vmx_virtcap(c);
+
+	if (c->x86 == 7) {
+		setup_clear_cpu_cap(X86_BUG_SPECTRE_V2);
+		clear_bit(X86_BUG_SPECTRE_V2, (unsigned long *)cpu_caps_set);
+	}
 }
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpu/zhaoxin.c b/arch/x86/kernel/cpu/zhaoxin.c
index 452fd0a..ea7c52f 100644
--- a/arch/x86/kernel/cpu/zhaoxin.c
+++ b/arch/x86/kernel/cpu/zhaoxin.c
@@ -141,6 +141,11 @@ static void init_zhaoxin(struct cpuinfo_x86 *c)
 
 	if (cpu_has(c, X86_FEATURE_VMX))
 		zhaoxin_detect_vmx_virtcap(c);
+
+	if (c->x86 == 7) {
+		setup_clear_cpu_cap(X86_BUG_SPECTRE_V2);
+		clear_bit(X86_BUG_SPECTRE_V2, (unsigned long *)cpu_caps_set);
+	}
 }
 
 #ifdef CONFIG_X86_32
-- 
2.7.4


             reply	other threads:[~2020-01-15  8:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  8:05 Tony W Wang-oc [this message]
2020-01-15 22:19 ` [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs Thomas Gleixner
2020-01-16  3:51   ` Tony W Wang-oc

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=1579075500-7065-1-git-send-email-TonyWWang-oc@zhaoxin.com \
    --to=tonywwang-oc@zhaoxin.com \
    --cc=CooperYan@zhaoxin.com \
    --cc=DavidWang@zhaoxin.com \
    --cc=HerryYang@zhaoxin.com \
    --cc=QiyuanWang@zhaoxin.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --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;
as well as URLs for NNTP newsgroup(s).