From patchwork Wed Jan 25 00:23:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 4486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp9818wrn; Tue, 24 Jan 2023 16:23:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXs2pVMjuA0v9QPc0FY9vpw7o/5U9w3sZbp3KUpjeOiiqpWdQzKUP+35GeTBLc/uck3rdvhB X-Received: by 2002:a17:902:a514:b0:194:476b:1af0 with SMTP id s20-20020a170902a51400b00194476b1af0mr28910793plq.65.1674606222764; Tue, 24 Jan 2023 16:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674606222; cv=none; d=google.com; s=arc-20160816; b=CZXCUjRLmBM5SuMrIJbYX6XlM1rghzLI5YbAAbt/N+Co48npqr912T28KoQ39QTMWX wy/DxD1vYfEjadFM7C8PGcjyD4RLMoxdepbrBb+bW11wl2CpQ+OCpFp6pEAEMY9QfHc2 55LWOeYGJztRRZFgpybssyllpWSlbomu/LJSWLyXifkeKokhiGuiZ7O88ZVPXML6XIBq 1B8KIvT5QDzzYZ13uTLua5cvpccjRE+R3PnnNgm6pFG7Uffg0YWvrSqtu1mBmxxF7kuR zthEzvBmBxEX6Xlg2n/oxRDJ52hky0mzp4eXgFrqL2Qbj9zBnV3SGoGIT6URTWlcqi4B WDPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=9qmjL5YE1HyeJVsvTfsUWFKz+T/3Ixilqwo6/hu6Qzo=; b=P6bb6Mp40q6z1IwkIE29VFaWmSpGuO3hvq9dA48JWph1MungH/dzXLdMn2bZSfdEp2 dhxKvrismkarcE7wKC83Td3rsbTbmrXIi9/tseGgftPRyGxeb1QIal0elETkAWFuqjc7 UchfXbTFRjiW8qK+r1PG0L0MpY+qDErcSpYlHN7dl4MtCXtJ7pPevlXMLLqOapxHdqyd LW2BCdaCWCkQj8Yb7FlaDd1TwvwjV3ar/ugrO5cDG+bsA80kQKb8xdC0sqOB2hj3X33A M/26sYLIu/Timfd0gALCOA+ZjdRrencA+Q0ybx5WIE6xZ1pbFKZPNK/L6zZXj41Q+IeV BtZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ehG+o244; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o20-20020a639214000000b0049069de0f5bsi3735132pgd.216.2023.01.24.16.23.30; Tue, 24 Jan 2023 16:23:42 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=ehG+o244; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234037AbjAYAXW (ORCPT + 99 others); Tue, 24 Jan 2023 19:23:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbjAYAXV (ORCPT ); Tue, 24 Jan 2023 19:23:21 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD62F4B899 for ; Tue, 24 Jan 2023 16:23:19 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id rl14so40187388ejb.2 for ; Tue, 24 Jan 2023 16:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=9qmjL5YE1HyeJVsvTfsUWFKz+T/3Ixilqwo6/hu6Qzo=; b=ehG+o2447r6Td9RR2+nlur6qkPp25WNZ5VRULzjwSQnqXWt2MCg7k78WBPyeu45jwG NOdpFnBuzpDSS1OdTfsIl3z3WdQ15/+Y3RR4TPn2qjpDBQXWqz+0SJlGzXcdKhYVYFYV f+b9LPEusuXHwVWllUUPlJJiAnus4nITRAsSN2iBT5ACFqsfC/xiJ/m/2set+UOC4dIR vHtEv9QW7w8O3v7pcBGdyUd+cTZZPxPcoJg+YkGVVfzvnvhgqGJqzHk5dew4FSyJEmP3 0HenwMS/nh+xF7VYGNpLE7wxnRKlybsHnHVvw7WRcJfHkOuune3yXsNkiSSUXA5z2CCT HOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9qmjL5YE1HyeJVsvTfsUWFKz+T/3Ixilqwo6/hu6Qzo=; b=RFTH6B1FCMLB+K57iriIDAV/4BO1OOUgfIGimWDC4bZ/cn/6uUA/Yz2b+5wHJnZms7 Pt0Lt6+LcK6QIpz0g3Rw/H1l2ZqefLFbbioP2dWIQTneeL0x8C2ctlYxbYh7Xrei2d1/ d0QfKyq53akzfdjWIJJcnjK6q1VDq1+8tvskmiwbj1+0d60a2CYbxNeGPVJRYnnQ6rxL r9wc2D+jFARswo7JwAFK8aG8nDfvfD+2pJSUy09Of3ywnXSVV1g65Y5M0OHXgXuEANPU 5z4pisMnYSf+2HwHox77brDhq0Xg5uaymhvfrPcnrAD6026oXc2fTmWHbeyNFWbgvTIE GnWg== X-Gm-Message-State: AFqh2krGt+L8ifLu65Rwns2me3QQwZ1s5511iJD1azwMMQ3Vpcliym9F HFUBO+ZXB5l84K8oW5/lUc14yw== X-Received: by 2002:a17:906:cd1f:b0:84d:4a2b:73b9 with SMTP id oz31-20020a170906cd1f00b0084d4a2b73b9mr32449420ejb.59.1674606198366; Tue, 24 Jan 2023 16:23:18 -0800 (PST) Received: from fedora.local (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id if10-20020a170906df4a00b00738795e7d9bsm1584606ejc.2.2023.01.24.16.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 16:23:17 -0800 (PST) From: Linus Walleij Subject: [PATCH v3 0/6] crypto: stm32 hash - reuse for Ux500 Date: Wed, 25 Jan 2023 01:23:06 +0100 Message-Id: <20221227-ux500-stm32-hash-v3-0-32ee12cd6f06@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAGt20GMC/4WOwQ6CMBBEf4X07JqyraCe/A/joZSFNlFK2kogh H+XohcvetlkNjNvZmaBvKXAztnMPA02WNetQuwypo3qWgJbr5ohR8wRS3iOB84hxIdAMCoYOBFh cRQST9iwNVapQFB51WmTgm9/pBA/Ie2nPvl6T40dt+rrbdXGhuj8tC0Z8vT9UTrkwKEqRKm01LX i+eVuO+Xd3vmWJdqA/wiYCFpKkY5W8ouwLMsL/cdYQBsBAAA= To: Herbert Xu , "David S. Miller" , Rob Herring , Krzysztof Kozlowski , Maxime Coquelin , Alexandre Torgue , Lionel Debieve Cc: linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij , Rob Herring X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1755951894303085290?= X-GMAIL-MSGID: =?utf-8?q?1755951894303085290?= By taking some small portions of the Ux500 HASH driver and adding to the STM32 driver, it turns out we can support both platforms with the more modern STM32 driver. The STM32 driver is more modern and compact thanks to using things like the crypto engine. We add a polled mode since the Ux500 does not have any interrupt. Incidentally, this could perhaps be re-used to implement synchronous mode, if this is desireable. To: Herbert Xu To: "David S. Miller" To: Rob Herring To: Krzysztof Kozlowski To: Maxime Coquelin To: Alexandre Torgue To: Lionel Debieve Cc: linux-crypto@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Linus Walleij --- Changes in v3: - Allocate the synchronous fallback algorithm in .cra_init() and free it in .cra_exit(). - Pick up some review tags. - Link to v2: https://lore.kernel.org/r/20221227-ux500-stm32-hash-v2-0-bc443bc44ca4@linaro.org Changes in v2: - Use an else-clause in the DT bindings. - Fix up issues pointed out by Lionel in the driver extension. - Dropped the patch converting dma_mode to a bool after Lionel explained how this works. - Link to v1: https://lore.kernel.org/r/20221227-ux500-stm32-hash-v1-0-b637ac4cda01@linaro.org --- Linus Walleij (6): dt-bindings: crypto: Let STM32 define Ux500 HASH crypto: stm32/hash: Simplify code crypto: stm32/hash: Use existing busy poll function crypto: stm32/hash: Wait for idle before final CPU xmit crypto: stm32/hash: Support Ux500 hash crypto: ux500/hash - delete driver .../devicetree/bindings/crypto/st,stm32-hash.yaml | 23 +- drivers/crypto/Kconfig | 10 - drivers/crypto/Makefile | 1 - drivers/crypto/stm32/stm32-hash.c | 266 ++- drivers/crypto/ux500/Kconfig | 22 - drivers/crypto/ux500/Makefile | 7 - drivers/crypto/ux500/hash/Makefile | 11 - drivers/crypto/ux500/hash/hash_alg.h | 398 ---- drivers/crypto/ux500/hash/hash_core.c | 1966 -------------------- 9 files changed, 249 insertions(+), 2455 deletions(-) --- base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2 change-id: 20221227-ux500-stm32-hash-9ee26834292f Best regards,