Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8610328ybl; Thu, 16 Jan 2020 20:52:11 -0800 (PST) X-Google-Smtp-Source: APXvYqznyDvrt90kOxwaa6LePsi+kDYQO6KiLCivwG3WQA+S23oJeze7FtmipYxs6LOfqPtkR0jO X-Received: by 2002:aca:ec4d:: with SMTP id k74mr2028853oih.64.1579236731435; Thu, 16 Jan 2020 20:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579236731; cv=none; d=google.com; s=arc-20160816; b=shg+eSSk+/XeBlrRQi40ITYnYUizR+wXH3ui+S7s68Rlx2JE6DJEWUbnbtILQ4vNl5 f5GeFrOWHeK2Ml35sW4mXpw2K4kqiOmQ+CjaGxhlrVmBWCe/kFb4+OwTR14N+TQOSzGE 8qn3PstnZcqmagiPxIhrmjFXIfybllM186lTIenQHCj0sazA/gfvhftc2LKYmNjf/3PA 0IUufQSDUUZF57++iG8lb8nDSINVceeO6yvw4g65krx0ttLRE8839XUidOWH76gEy5xx D1jOn+Sh8Aprco+5qSWb/0oTbed+skQe0r2cMyOk4x8ZBQX3vYXIu6wyyN0RxBjiR7Q3 7hxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=B1q/hRtveZ/zewnWVMhxWbaRqqDkqz0W/5vUdqXwmcs=; b=F3ArMfReUW9nWa8SLp0soxouj01Fwh3L4jiNB/A2/WZicOCaZtXi75Q5c4JLIxUGvw sAxkeopzbKY1X8k/cT8H9M4Mr7cI6z1sg7uawMis6iaumdcIUZQZyoPc1U3AML/jbq28 APajq6rxNC9hz1NqBv3DK2mcUPq2lNnhCX2nS9ZxtWC+uPIIYumSyzPqa0/OQuN3vlxq aAwy3AgeFdM9R+5kNIpceYD657ONLwUNA/RL1pVCx9J65CXsz4Dq1pEc0zcO60EozX6k rgm6v8oEgQNvDabVGvdttyjYsMk4cWAHioSgEkHk5FTfDPVSJ+VkMF7GSxK4tjrSJ7ks O4Yg== 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 m25si14968455otr.310.2020.01.16.20.51.59; Thu, 16 Jan 2020 20:52:11 -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 S2388466AbgAQCYL (ORCPT + 99 others); Thu, 16 Jan 2020 21:24:11 -0500 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:61840 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726726AbgAQCYK (ORCPT ); Thu, 16 Jan 2020 21:24:10 -0500 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Fri, 17 Jan 2020 10:24:06 +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; Fri, 17 Jan 2020 10:24:04 +0800 From: Tony W Wang-oc To: , , , , , , , , , , CC: , , , Subject: [PATCH v1 1/2] x86/speculation/spectre_v2: Exclude Zhaoxin CPUs from SPECTRE_V2 Date: Fri, 17 Jan 2020 10:24:31 +0800 Message-ID: <1579227872-26972-2-git-send-email-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579227872-26972-1-git-send-email-TonyWWang-oc@zhaoxin.com> References: <1579227872-26972-1-git-send-email-TonyWWang-oc@zhaoxin.com> 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 New Zhaoxin family 7 CPUs are not affected by SPECTRE_V2. So create a separate cpu_vuln_whitelist flag bit NO_SPECTRE_V2 and add these CPUs to the cpu vulnerability whitelist. Signed-off-by: Tony W Wang-oc --- arch/x86/kernel/cpu/common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 2e4d902..6048bd3 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1023,6 +1023,7 @@ static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c) #define MSBDS_ONLY BIT(5) #define NO_SWAPGS BIT(6) #define NO_ITLB_MULTIHIT BIT(7) +#define NO_SPECTRE_V2 BIT(8) #define VULNWL(_vendor, _family, _model, _whitelist) \ { X86_VENDOR_##_vendor, _family, _model, X86_FEATURE_ANY, _whitelist } @@ -1084,6 +1085,10 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = { /* FAMILY_ANY must be last, otherwise 0x0f - 0x12 matches won't work */ VULNWL_AMD(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT), VULNWL_HYGON(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT), + + /* Zhaoxin Family 7 */ + VULNWL(CENTAUR, 7, X86_MODEL_ANY, NO_SPECTRE_V2), + VULNWL(ZHAOXIN, 7, X86_MODEL_ANY, NO_SPECTRE_V2), {} }; @@ -1116,7 +1121,9 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c) return; setup_force_cpu_bug(X86_BUG_SPECTRE_V1); - setup_force_cpu_bug(X86_BUG_SPECTRE_V2); + + if (!cpu_matches(NO_SPECTRE_V2)) + setup_force_cpu_bug(X86_BUG_SPECTRE_V2); if (!cpu_matches(NO_SSB) && !(ia32_cap & ARCH_CAP_SSB_NO) && !cpu_has(c, X86_FEATURE_AMD_SSB_NO)) -- 2.7.4