From patchwork Mon May 15 12:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JiaJie Ho X-Patchwork-Id: 9354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6913134vqo; Mon, 15 May 2023 06:16:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CSOhEbPyp2r0NOSSEXLTBgfD13WdmqgKGK/LmwUHSMPkIBN3ZiCB/Yb34mPahI2PO4fQs X-Received: by 2002:a17:902:690b:b0:1ac:a6b0:1c87 with SMTP id j11-20020a170902690b00b001aca6b01c87mr21108961plk.48.1684156579485; Mon, 15 May 2023 06:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684156579; cv=none; d=google.com; s=arc-20160816; b=EArEAfqdPwYtr23vTu4MqnTf66VQLAAkC5oK9d3vPuruDjjFAivz7O9O0aZo9GbHj8 KaXZ9c0921r7QrYe8LyD7hc2iqrDDdhzif7F4DLjaGvGBd7nBN/HJPgHUwSfEkqHZdyx cvY+e6Ip0KaRgw05ibNldQ6PaJGxzXozAsDOiaCJpUNXiT0rHLCGgVexhEgiX+5eXc9K 8TMiukt8/mwfFpsqh8TJdOWqLBqHkCmP8HTWFzbCx5EYqPU47N/cIHu4lyS7pv3PPc2q s8F3Q3DEkPaxasjB25BznPnhp/cHdbLDp7TqO0Piun/HGsceOXaBZLqIx+n0kE32Zs25 U+Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=H7Ry3HEsySF8s9h7RfUadtLQVdoagmzbngWkdTVnC+Y=; b=NenJ+3PzSKBms8LPjoyoBml8AsPYNeLyHuKIx2kvSHjBtG94nf/Ioj08hdN62/G8AC jkfAobdoKbDXsCoVfdeK6JmA9rWAiuenU0qtVp7PntKxzsR6E7p3cR4h/bpTeG8qQVvi LaEWPIyWjiB4Gqqrc/5507eMpYmjqusrtbdok2m799hZa6zMpi8D6wBwhKtQ3mKmIpsC YMIo85/QotzMJvmRoITe82oqoRNDPGsh+uRWx4T9IdEfyXYuawSVIkwgizKljeV8CS0B L+WTs7wuFc5htPBIFKGGsut1hsCyRexGkqc6rzOCU7Lpuksxrm1Pj+63SLh+C7LvaxmE LcGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a170902ee4500b001ab0e4c0218si15883375plo.140.2023.05.15.06.16.03; Mon, 15 May 2023 06:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241998AbjEOMyN convert rfc822-to-8bit (ORCPT + 99 others); Mon, 15 May 2023 08:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238913AbjEOMyL (ORCPT ); Mon, 15 May 2023 08:54:11 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB20199F; Mon, 15 May 2023 05:54:10 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 2A28324E03C; Mon, 15 May 2023 20:54:09 +0800 (CST) Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 15 May 2023 20:54:09 +0800 Received: from ubuntu.localdomain (161.142.156.10) by EXMBX168.cuchost.com (172.16.6.78) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 15 May 2023 20:53:59 +0800 From: Jia Jie Ho To: Herbert Xu , "David S . Miller" , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Conor Dooley CC: , , , Subject: [PATCH v8 0/4] crypto: starfive - Add drivers for crypto engine Date: Mon, 15 May 2023 20:53:51 +0800 Message-ID: <20230515125355.624250-1-jiajie.ho@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [161.142.156.10] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX168.cuchost.com (172.16.6.78) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765966169371657669?= X-GMAIL-MSGID: =?utf-8?q?1765966169371657669?= This patch series adds kernel driver support for StarFive JH7110 crypto engine. The first patch adds Documentations for the device and Patch 2 adds device probe and DMA init for the module. Patch 3 adds crypto and DMA dts node for VisionFive 2 board. Patch 4 adds hash/hmac support to the module. Patch 3 needs to be applied on top of: https://lore.kernel.org/lkml/20230424135409.6648-3-xingyu.wu@starfivetech.com/ Patch 4 needs to be applied on top of: https://lore.kernel.org/linux-crypto/ZEEOXIHwqKblKfBJ@gondor.apana.org.au/T/#u Changes v7->v8 - Enable COMPILE_TEST in Kconfig (Herbert) - Fix compile_test warning on 'long unsigned int' to 'unsigned int' conversion (Herbert) Changes v6->v7 - Remove NULL assignment as struct is kzalloc()-ed (Christophe) - Do clk_disable_unprepare and assert reset if probe failed (Christophe) - Remove unnecessary null pointer check (Christophe) - Update module name in Kconfig description (Christophe) Changes v5->v6 - Remove set_crypt in export as request will have been created by init/updated calls (Herbert) - Use new helper to set statesize of crypto_ahash (Herbert) - Use crypto_ahash_blocksize instead of crypto_ahash_tfm (Herbert) - Switch to init_tfm/exit_tfm instead of cra_init/cra_exit (Herbert) Changes v4->v5 - Schedule tasklet from IRQ handler instead of using completion to sync events (Herbert) Changes v3->v4: - Use fallback for non-aligned cases as hardware doesn't support hashing piece-meal (Herbert) - Use ahash_request_set_* helpers to update members of ahash_request (Herbert) - Set callbacks for async fallback (Herbert) - Remove completion variable and use dma_callback to do the rest of processing instead. (Herbert) Changes v2->v3: - Only implement digest and use fallback for other ops (Herbert) - Use interrupt instead of polling for hash complete (Herbert) - Remove manual data copy from out-of-bound memory location as it will be handled by DMA API. (Christoph & Herbert) Changes v1->v2: - Fixed yaml filename and format (Krzysztof) - Removed unnecessary property names in yaml (Krzysztof) - Moved of_device_id table close to usage (Krzysztof) - Use dev_err_probe for error returns (Krzysztof) - Dropped redundant readl and writel wrappers (Krzysztof) - Updated commit signed offs (Conor) - Dropped redundant node in dts, module set to on in dtsi (Conor) Jia Jie Ho (4): dt-bindings: crypto: Add StarFive crypto module crypto: starfive - Add crypto engine support riscv: dts: starfive: Add crypto and DMA node for VisionFive 2 crypto: starfive - Add hash and HMAC support .../crypto/starfive,jh7110-crypto.yaml | 70 ++ MAINTAINERS | 7 + arch/riscv/boot/dts/starfive/jh7110.dtsi | 28 + drivers/crypto/Kconfig | 1 + drivers/crypto/Makefile | 1 + drivers/crypto/starfive/Kconfig | 21 + drivers/crypto/starfive/Makefile | 4 + drivers/crypto/starfive/jh7110-cryp.c | 240 +++++ drivers/crypto/starfive/jh7110-cryp.h | 127 +++ drivers/crypto/starfive/jh7110-hash.c | 892 ++++++++++++++++++ 10 files changed, 1391 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/starfive,jh7110-crypto.yaml create mode 100644 drivers/crypto/starfive/Kconfig create mode 100644 drivers/crypto/starfive/Makefile create mode 100644 drivers/crypto/starfive/jh7110-cryp.c create mode 100644 drivers/crypto/starfive/jh7110-cryp.h create mode 100644 drivers/crypto/starfive/jh7110-hash.c