Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7351915ybl; Wed, 15 Jan 2020 21:11:52 -0800 (PST) X-Google-Smtp-Source: APXvYqznx6dnw06af3xrj46Uq+TrC0UWMwW6rs+DsbnaCaOeC3r9nAjW2ZSfDHBxtNFA05dnrz5W X-Received: by 2002:a54:4f8d:: with SMTP id g13mr2708840oiy.43.1579151512855; Wed, 15 Jan 2020 21:11:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579151512; cv=none; d=google.com; s=arc-20160816; b=a5slkylAAfYltlj7I/dI3siSrMaNfexY1jpa4zdFRy9Wf6B6yotSAg+qohdIBq0zSA uQPRd1HYCmmq7wLJptfuLOQ8RIymj+P5Zn4rfahfiawM8LWgSYzDB+95Z34+UmLgdyoL s+76dqzGsSjQifcBpeOu40LdPk7KjQKUaiurQwQ0feQTJI6umdOskOwM2wCUpVU1E3U1 Ds7Wwn2z874iwYptJsu2gJ784u/v6v86UudXgmyAUwYhjnNMOZYsgwjFWQJLU9VrnyFH 98XVJzqOXTB0EBb/hlUOHavOIEihHzs+djdwwAuNdIdi3GwyRgrbYh18nCQajXocliQT zjQw== 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=B1q/hRtveZ/zewnWVMhxWbaRqqDkqz0W/5vUdqXwmcs=; b=vS4NUnajLGoEIN77sbhCYJ1/xOKTLPBUptpuiVV1nluDnTWELqe2WgsPIggfF/TddL KZ0UxCP2Dy4eLx9ylu5cusMfCRLvvGK+BYW2vCiSgzx9YbQcg448lh2G+fi7TmdtpzTP FLL5IjcgMLUB6y4X2cRpuwVy50wITUWI0ZyuCVbccnMoakaWDmSWs9ptIdS1VMB4NskV qwEVy5EqeuHJhRv3kbhyVx6dh0XkoJbW1Z2iLzO3b4sFHHavRDIBUUr3IwhuhWH351qF zuyR1bIu49mYeZVo5sPJNiQGmmDj2kN+VKzpQf3EcBlyDO9V77tipbyEqdMbmdQlOmE+ LKgQ== 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 c19si13258170oto.129.2020.01.15.21.11.40; Wed, 15 Jan 2020 21:11:52 -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 S1730433AbgAPDqu (ORCPT + 99 others); Wed, 15 Jan 2020 22:46:50 -0500 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:25834 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730397AbgAPDqu (ORCPT ); Wed, 15 Jan 2020 22:46:50 -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; Thu, 16 Jan 2020 11:46:48 +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; Thu, 16 Jan 2020 11:46:46 +0800 From: Tony W Wang-oc To: , , , , , , , , , , CC: , , , Subject: [PATCH] x86/speculation/spectre_v2: Exclude Zhaoxin CPUs from SPECTRE_V2 Date: Thu, 16 Jan 2020 11:47:14 +0800 Message-ID: <1579146434-2668-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 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