From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1C43C33CB1 for ; Wed, 15 Jan 2020 08:19:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 858972187F for ; Wed, 15 Jan 2020 08:19:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbgAOITm (ORCPT ); Wed, 15 Jan 2020 03:19:42 -0500 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:46583 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726088AbgAOITm (ORCPT ); Wed, 15 Jan 2020 03:19:42 -0500 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Wed, 15 Jan 2020 16:04:36 +0800 Received: from tony-HX002EA.zhaoxin.com (10.32.64.11) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Wed, 15 Jan 2020 16:04:32 +0800 From: Tony W Wang-oc To: , , , , , CC: , , , Subject: [PATCH] x86/cpu: clear X86_BUG_SPECTRE_V2 on Zhaoxin family 7 CPUs Date: Wed, 15 Jan 2020 16:05:00 +0800 Message-ID: <1579075500-7065-1-git-send-email-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.32.64.11] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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