Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp85416pxu; Wed, 6 Jan 2021 22:21:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnx2yh0vw8ePlg2aTeEWfF1IM6O7mpb6aFZuypSNV3G9QY6ndZO5xKMvBfMMIkVlslInNg X-Received: by 2002:a50:9e8b:: with SMTP id a11mr507505edf.276.1610000462654; Wed, 06 Jan 2021 22:21:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610000462; cv=none; d=google.com; s=arc-20160816; b=I5TAY0S7CakGS2dFPYE7wRu929RXBhm05YCAx8GQ40bI8uHS5CIRiwJHkVUaOHkHHR HokD559Ie92Jaub51xDZO/6PiAM365irFV6X7hgFdCi2r5A89/zqRwErgm2foYRrYhfE NVNQE9UzJ4msGq51J0iyidR7tIRq3d/b0wqbNQWRpcNfWj3o1GUpaFoXeXFpz1CYQeVS e6YSc/HWsl+BuAt2Bm61S9ywn/fUGpOYPXoCU1fnnnANMMP0Ny1sfkPzGuPc0usIv3R/ UXmzppNpXu2wmTtKsdxImvAD7ZvKeeJEd73zMmEp9+o0TRGi63WxiYzTaerjtQnyHqXM gOzg== 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=xS+6bmzjoKgrlrDG4Mg2SEmenYr8CNleqHO5OCufw38=; b=BrUuYiCkiqqCDD0DjBrA7cXAqD2lYQr7C2jaDwVQUIRQlZtKUz5Br1YU1WxzHWFRz8 z4WRMWnKNVVsp5L4yt6qMPbMR7UF+Ban5a2NIieqbF4ABn/38OIJt/Qxx3IFOJOF3Ws9 F00MIoBanMBJxnoF3ICh9n8pplf5U0561iZljsJidNywhu+hu/btvGA2f4eP6Mx/XpzK VOSDsaLwDgxX/VjcgsJ0esAhYmpt3M3dsOZfIwLl7C61dChvjaip9nht3udzg9j8wJOo U8rFi/bEstv4cnChRBcJybIXeZ7CpZnW38caEdDao5dq5u9Dlr2qFfdQAhXaBRvzb6k+ WKng== 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 u26si1776107ejg.642.2021.01.06.22.20.43; Wed, 06 Jan 2021 22:21:02 -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 S1726272AbhAGGUg (ORCPT + 99 others); Thu, 7 Jan 2021 01:20:36 -0500 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:52908 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbhAGGUg (ORCPT ); Thu, 7 Jan 2021 01:20:36 -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.1979.3; Thu, 7 Jan 2021 14:19:20 +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:17 +0800 From: Tony W Wang-oc To: , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , Subject: [PATCH v1 2/3] x86/cpu: Set low performance CRC32C flag on some Zhaoxin CPUs Date: Thu, 7 Jan 2021 14:19:07 +0800 Message-ID: <1610000348-17316-3-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 Some Zhaoxin CPUs declare support SSE4.2 instruction sets but having a CRC32C instruction implementation that not working as intended. Set low performance CRC32C flag on these CPUs for later use. Signed-off-by: Tony W Wang-oc --- arch/x86/kernel/cpu/centaur.c | 7 +++++++ arch/x86/kernel/cpu/zhaoxin.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index 345f7d9..13e6fbe 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c @@ -109,6 +109,13 @@ static void early_init_centaur(struct cpuinfo_x86 *c) set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); } + + /* + * These CPUs declare support SSE4.2 instruction sets but + * having low performance CRC32C instruction implementation. + */ + if (c->x86 == 0x6 || (c->x86 == 0x7 && c->x86_model <= 0x3b)) + set_cpu_cap(c, X86_FEATURE_CRC32C); } static void init_centaur(struct cpuinfo_x86 *c) diff --git a/arch/x86/kernel/cpu/zhaoxin.c b/arch/x86/kernel/cpu/zhaoxin.c index 05fa4ef..837ec65 100644 --- a/arch/x86/kernel/cpu/zhaoxin.c +++ b/arch/x86/kernel/cpu/zhaoxin.c @@ -79,6 +79,12 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c) c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff); } + /* + * These CPUs declare support SSE4.2 instruction sets but + * having low performance CRC32C instruction implementation. + */ + if (c->x86 == 0x6 || (c->x86 == 0x7 && c->x86_model <= 0x3b)) + set_cpu_cap(c, X86_FEATURE_CRC32C); } static void init_zhaoxin(struct cpuinfo_x86 *c) -- 2.7.4