* [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs
@ 2020-01-15 8:05 Tony W Wang-oc
2020-01-15 22:19 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Tony W Wang-oc @ 2020-01-15 8:05 UTC (permalink / raw)
To: tglx, mingo, bp, hpa, x86, linux-kernel
Cc: DavidWang, CooperYan, QiyuanWang, HerryYang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs
2020-01-15 8:05 [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs Tony W Wang-oc
@ 2020-01-15 22:19 ` Thomas Gleixner
2020-01-16 3:51 ` Tony W Wang-oc
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2020-01-15 22:19 UTC (permalink / raw)
To: Tony W Wang-oc, mingo, bp, hpa, x86, linux-kernel
Cc: DavidWang, CooperYan, QiyuanWang, HerryYang
Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> writes:
> These CPUs are not affected by spectre_v2, so clear spectre_v2 bug flag
> in their specific initialization code.
>
> 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);
No. Please use cpu_vuln_whitelist. It exists for exactly this
purpose. You just need to extend it with a NO_SPECTRE_V2 bit.
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs
2020-01-15 22:19 ` Thomas Gleixner
@ 2020-01-16 3:51 ` Tony W Wang-oc
0 siblings, 0 replies; 3+ messages in thread
From: Tony W Wang-oc @ 2020-01-16 3:51 UTC (permalink / raw)
To: Thomas Gleixner, mingo, bp, hpa, x86, linux-kernel
Cc: DavidWang, CooperYan, QiyuanWang, HerryYang
On 16/01/2020 06:19, Thomas Gleixner wrote:
> Tony W Wang-oc <TonyWWang-oc@zhaoxin.com> writes:
>
>> These CPUs are not affected by spectre_v2, so clear spectre_v2 bug flag
>> in their specific initialization code.
>>
>> 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);
>
> No. Please use cpu_vuln_whitelist. It exists for exactly this
> purpose. You just need to extend it with a NO_SPECTRE_V2 bit.
Got, done.
Sincerely
TonyWWang-oc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-16 3:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 8:05 [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs Tony W Wang-oc
2020-01-15 22:19 ` Thomas Gleixner
2020-01-16 3:51 ` Tony W Wang-oc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.