Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6210433ybl; Wed, 15 Jan 2020 00:20:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzYGk1Ic4+9hts1we9+xcD0K/3e10rgIokMSJ0h2NqJyrnoHS/tPGOJHfcIg9XOBkSefBGw X-Received: by 2002:aca:4183:: with SMTP id o125mr19084122oia.125.1579076448103; Wed, 15 Jan 2020 00:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579076448; cv=none; d=google.com; s=arc-20160816; b=kSaBYSqAGLzBuJz7cMHrONC7HWjOAZxyU3vLQrNOK7NN/UZVEVhQRSSf5ZchYGzz/V 9A5s66t5YytcOmzSElLpXtnQmrMQ5fb5DQbbNo0RpwaDiuMGqtSThrQPrhIHmk0v+4L2 ITFp7FxqxwkL2cN5fbYcuhOd5EnknFrTXlvKfwbNf4LscFB8VQmRgvDfHIXy9L5MUSh9 3bIoVJDlt41mF1kvDilz0KCHvRkcteXrrYiFiZS/TM0GWu/dNa6j3OPzu1ds4ThxhNfl zE6JYdXQPN0Tlta1dRQQeCqyME6e6/fgw9YRTjvMN/ccBf7K/Lj2IdZvvskYAzsHrcvg uLvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zabEi5042vkHQyQaKof55xRv1r5SfIfXSxKi0vum74Q=; b=E5GyJgYIisQ2xIUxE8sKrTrHXpDxDPOGHOP5IxrDeq+TnuVBOVkoJi0JpofYcYTkrI foKyIJUTJ1vBNT7/qpzAoE7A/S4rGZIYvthtO+r7+9vzk9+PaiFbcjc4z4cQoVh7Sf7A jLbfs22pQBYtSiq6zxJphw35L0EZKZNefKAFxyY/jAAHTTv3xrvrO4gXp5hzwn1I/9yQ Uv1IuWEix2W8yVou3I9wBoSf8CeiEV8aPEFG8chE3Lsm3WFFmUXBtwlKtE1Iol8Rh9d8 yOwh7F0shBShHkdp2cb5zbN01swEyhDJwuheJVhmH51XwewLw2oOMHv0ebzS1HVSREzN KdTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j19si8681596oij.51.2020.01.15.00.20.35; Wed, 15 Jan 2020 00:20:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbgAOITm (ORCPT + 99 others); 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