Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp85379pxu; Wed, 6 Jan 2021 22:20:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMmaqee/kJbS3QrmZ5zCvpvJBqgJaVG66w8aWaYL2lKt9fYlFEblkQsCdfc+dZpL5MTia+ X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr5006337ejy.62.1610000458026; Wed, 06 Jan 2021 22:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610000458; cv=none; d=google.com; s=arc-20160816; b=Wkrs8s2suyXO/YsfdNrbmEnm1vJKncAy3iqkQGKc/gNZ0JwLBwnnJLRXVcgF2t0ixs IVI5pUpf7J+QelZn4aWbCaER+zuAQ+oLsbbMrDWScn/9YBaXl5YYK2ydFPwHt/aNaPJ3 RVOM5jFCXqmRufLtbSrsaeC+gUCcSv9KC7sEE2wmDJt+s1p6xz64ViUQmGd4ZaZIy3ZA kcP7b1rjRHp9hs18EG4p0Ln4tqWNAP2zFEDB2amlLknwt7NShRq4ApCZfS3znu9lKcUd 5mu2714W7aWOp3pKM60mPo6oFIEliueLvgrajbpL+bJgC6vD5l6bOuwkhTUqfVjhzK/J mj6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=r4FrPYul2MJEcI8VTPlSqvrj5pDu5xSXB1tLWvt9gtA=; b=NIZbFVCcDP3yKQLGdUauYCr3XYKZOpSftsV6goqyVdOohyDySgmghL3yJ0+83wXjSp PnpWAMz6K3GFiW4Riwd/hkVq4dkKJL69VMtUhNlJwsYaWTlD3s2ixIl9riGeSJDSpYGg oS2SCAOfXiM/RvAxv2Zl8NsfztJK8NDCHSoCSlON1C+nj0F9vxA6YDZtVivBSdOu8+/+ jtNnFjBvncsuTjNBLbHqhBW6wu3iXMkitg4EvU79Jv4b0bSchdvA+rIGbrtzck/ks67c 6VGsx0PNzkosGLlW623k+mCiLVsMlhlqfocjSNTU2nr+JU3+mvb3xR1DEn9PKP0KcO5p y2Cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si1773642ejb.632.2021.01.06.22.20.39; Wed, 06 Jan 2021 22:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725306AbhAGGUC (ORCPT + 99 others); Thu, 7 Jan 2021 01:20:02 -0500 Received: from ZXSHCAS2.zhaoxin.com ([203.148.12.82]:46034 "EHLO ZXSHCAS2.zhaoxin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbhAGGUB (ORCPT ); Thu, 7 Jan 2021 01:20:01 -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.1979.3; Thu, 7 Jan 2021 14:19:17 +0800 Received: from tony-HX002EA.zhaoxin.com (10.32.56.37) 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.1979.3; Thu, 7 Jan 2021 14:19:14 +0800 From: Tony W Wang-oc To: , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v1 1/3] x86/cpufeatures: Add low performance CRC32C instruction CPU feature Date: Thu, 7 Jan 2021 14:19:06 +0800 Message-ID: <1610000348-17316-2-git-send-email-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610000348-17316-1-git-send-email-TonyWWang-oc@zhaoxin.com> References: <1610000348-17316-1-git-send-email-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.32.56.37] X-ClientProxiedBy: ZXSHCAS1.zhaoxin.com (10.28.252.161) To zxbjmbx1.zhaoxin.com (10.29.252.163) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org SSE4.2 on Zhaoxin CPUs are compatible with Intel. The presence of CRC32C instruction is enumerated by CPUID.01H:ECX.SSE4_2[bit 20] = 1. Some Zhaoxin CPUs declare support SSE4.2 instruction sets but their CRC32C instruction are working with low performance. Add a synthetic CPU flag to indicates that the CRC32C instruction is not working as intended. This low performance CRC32C instruction flag is depend on X86_FEATURE_XMM4_2. Signed-off-by: Tony W Wang-oc --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/kernel/cpu/cpuid-deps.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 84b8878..9e8151b 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -292,6 +292,7 @@ #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */ #define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */ #define X86_FEATURE_PER_THREAD_MBA (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */ +#define X86_FEATURE_CRC32C (11*32+ 8) /* "" Low performance CRC32C instruction */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */ diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index 42af31b6..7d7fca7 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -72,6 +72,7 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW }, { X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES }, { X86_FEATURE_PER_THREAD_MBA, X86_FEATURE_MBA }, + { X86_FEATURE_CRC32C, X86_FEATURE_XMM4_2 }, {} }; -- 2.7.4