Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp223601rdb; Mon, 22 Jan 2024 18:42:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5zdkNP2qnaLExXFmsxpQ7FgNzgfEE8tgO4qv6NMGJ9K6HWM5JkTeUwbhx9/t9r65s1yxv X-Received: by 2002:a05:6214:2242:b0:681:7709:610d with SMTP id c2-20020a056214224200b006817709610dmr295339qvc.20.1705977762149; Mon, 22 Jan 2024 18:42:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705977762; cv=pass; d=google.com; s=arc-20160816; b=VB3Fl9Xvk0tgNhzcNVGUVhZs0B6eVDPeFe2A2ZFfE3JXCTVYift2uMYkEQ3BF2E9fZ 7Jhfs6Ghu3Pu2xBUQi1flnsCz5zr161cvJU83EpYRDgdH/DP9GhAp4j4rCzO4VKWrWLu wEJsIUX9SA7eZOTOrmC9RF8w4UIz78ktvRY8WjcD2uZbE6VmeDHKIM2d3+Xkq/Q6zpSR 6rIuox8QUJ54Q0ngvn4cNtOoB6z5/P6zw8DHImc66S6HuzJbZZFfwXaANU/CE/QeKFvJ yPh3g/tjn2yaleiI39APmth719CSsLOggeco8iY9EMSI0V/wDKN5bd+FE/RBTe9NVJms VXPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=wfhzoUPk2qzhjYRViSOiDzA4YkxOWD/TlJWo5Z4f3b4=; fh=yMYn5hXX5rf03P9T0ztrpP9dXlJ2aHKtm4twulcMDMw=; b=gQdEht3w0nxn+mMgnKklb9Fg2wnmZCmCfT143FgexSdc+cIFbcYGBVlbUjrwPAM4yB jeoUM1/ZgZIYnto/ioNVqB+mXtJh4H43qGtkQeKW0SgY4PIYRiZoOLZ12KrYYsXwH+hZ D8TBeS8b8X8hBBZitNN5PKKdlFoZvMxzDRDp3GcXW2VLmG3QDh+zHCwcwQh9YRvfg2c4 kR/2OCLMyaqGb9J/UNL/axeOXdhjF8gNvspt72BwTezMOAvl+U1xLDfwQMfgHGdEjBMB rummRxvcubtFb6wK505J44ynS7OLQTffHNPqLdeUO22AKckt6kQsWX+5FFoiPIdemaC8 JMNA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zhaoxin.com); spf=pass (google.com: domain of linux-crypto+bounces-1540-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1540-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u4-20020a0c8dc4000000b006816cb52973si7161452qvb.504.2024.01.22.18.42.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 18:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-1540-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zhaoxin.com); spf=pass (google.com: domain of linux-crypto+bounces-1540-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1540-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D61B11C2A77C for ; Tue, 23 Jan 2024 02:42:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FDD642A8C; Tue, 23 Jan 2024 02:29:07 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0874E29424 for ; Tue, 23 Jan 2024 02:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.110.167.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705976947; cv=none; b=YEG1nkE5+sMvjC47Adz3hCBVexBa/33wbCrcCOEmHnNmvsNxHiYyxGgkvgVc9kMTaQoK7WRinVf1NDT0pplrHyJwGgB1EooiVBdgz9+NtMS2n3ufxXIH1gMwZLwwTHTfbIAd9dXLVOcUr/HRFqkTxACgoah6t6KG1r3dcCcqyig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705976947; c=relaxed/simple; bh=TYytRoBRPO460xz7ymBTlU+vkWrppd7xtwrj5lYa8s8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=txGuhWF6BSzdIk4Tq03JfNWC3jkxcrdD3+ICXl4wJRE+Tt5uVtCEtBNcRMMeXGE32bMkNMUG9ALC3hZYoAD0TddVz30Sv1CD1yYoQ9Y6U6e+IUFYDpT9539kXt1tgBexchFkBiNr8vEbfOH357a5LhICChuY2gKvRuTjQauu+To= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com; spf=pass smtp.mailfrom=zhaoxin.com; arc=none smtp.client-ip=203.110.167.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zhaoxin.com X-ASG-Debug-ID: 1705976935-1eb14e0c7f272d0001-Xm9f1P Received: from ZXSHMBX2.zhaoxin.com (ZXSHMBX2.zhaoxin.com [10.28.252.164]) by mx2.zhaoxin.com with ESMTP id zsstOb7ku2RIE6lw (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 23 Jan 2024 10:28:55 +0800 (CST) X-Barracuda-Envelope-From: TonyWWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHMBX2.zhaoxin.com (10.28.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 23 Jan 2024 10:28:54 +0800 Received: from localhost.localdomain (10.32.65.162) 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.2507.27; Tue, 23 Jan 2024 10:28:52 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 From: Tony W Wang-oc X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.163 To: , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH v2 0/3] Add Zhaoxin hardware engine driver support for SHA Date: Tue, 23 Jan 2024 10:28:49 +0800 X-ASG-Orig-Subj: [PATCH v2 0/3] Add Zhaoxin hardware engine driver support for SHA Message-ID: <20240123022852.2475-1-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Barracuda-Connect: ZXSHMBX2.zhaoxin.com[10.28.252.164] X-Barracuda-Start-Time: 1705976935 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 3585 X-Barracuda-BRTS-Status: 0 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.119809 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Zhaoxin CPUs have implemented the SHA(Secure Hash Algorithm) as its CPU instructions, including SHA1, SHA256, SHA384 and SHA512, which conform to the Secure Hash Algorithms specified by FIPS 180-3. With the help of implementation of SHA in hardware instead of software, can develop applications with higher performance, more security and more flexibility. Below table gives a summary of test using the driver tcrypt with different crypt algorithm drivers on Zhaoxin KH-40000 platform: --------------------------------------------------------------------------- tcrypt driver 16* 64 256 1024 2048 4096 8192 --------------------------------------------------------------------------- zhaoxin** 442.80 1309.21 3257.53 5221.56 5813.45 6136.39 6264.50*** 403:SHA1 generic** 341.44 813.27 1458.98 1818.03 1896.60 1940.71 1939.06 ratio 1.30 1.61 2.23 2.87 3.07 3.16 3.23 --------------------------------------------------------------------------- zhaoxin 451.70 1313.65 2958.71 4658.55 5109.16 5359.08 5459.13 404:SHA256 generic 202.62 463.55 845.01 1070.50 1117.51 1144.79 1155.68 ratio 2.23 2.83 3.50 4.35 4.57 4.68 4.72 --------------------------------------------------------------------------- zhaoxin 350.90 1406.42 3166.16 5736.39 6627.77 7182.01 7429.18 405:SHA384 generic 161.76 654.88 979.06 1350.56 1423.08 1496.57 1513.12 ratio 2.17 2.15 3.23 4.25 4.66 4.80 4.91 --------------------------------------------------------------------------- zhaoxin 334.49 1394.71 3159.93 5728.86 6625.33 7169.23 7407.80 406:SHA512 generic 161.80 653.84 979.42 1351.41 1444.14 1495.35 1518.43 ratio 2.07 2.13 3.23 4.24 4.59 4.79 4.88 --------------------------------------------------------------------------- *: The length of each data block to be processed by one complete SHA sequence, namely one INIT, multi UPDATEs and one FINAL. **: Crypt algorithm driver used by tcrypt, "zhaoxin" represents zhaoxin-sha while "generic" represents the generic software SHA driver. ***: The speed of each crypt algorithm driver processing different length of data blocks, unit is Mb/s. The ratio in the table implies the performance of SHA implemented by zhaoxin-sha driver is much higher than the ones implemented by the generic software driver of sha1/sha256/sha384/sha512. In order to support Zhaoxin-sha driver, make padlock-sha driver matches the CENTAUR CPUs with Family == 6 and add two Zhaoxin Hash Engine cpufeatures. --- v2: - Make Zhaoxin SHA depends on X86 && !UML - Update MAINTAINERS for Zhaoxin SHA Tony W Wang-oc (3): crypto: padlock-sha: Matches CPU with Family with 6 explicitly x86/cpufeatures: Add CPU feature flags for Zhaoxin Hash Engine crypto: Zhaoxin: Hardware Engine Driver for SHA1/256/384/512 MAINTAINERS | 6 + arch/x86/include/asm/cpufeatures.h | 4 +- drivers/crypto/Kconfig | 16 + drivers/crypto/Makefile | 1 + drivers/crypto/padlock-sha.c | 2 +- drivers/crypto/zhaoxin-sha.c | 500 +++++++++++++++++++++++ drivers/crypto/zhaoxin-sha.h | 17 + tools/arch/x86/include/asm/cpufeatures.h | 4 +- 8 files changed, 547 insertions(+), 3 deletions(-) create mode 100644 drivers/crypto/zhaoxin-sha.c create mode 100644 drivers/crypto/zhaoxin-sha.h -- 2.25.1