Message ID | 20221227-ux500-stm32-hash-v3-4-32ee12cd6f06@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp10040wrn; Tue, 24 Jan 2023 16:24:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvQVDK1DE+sZAieCql4JNDm6jeGYdDcVnmsPkP1tQ4EqwoiLW1scGVhUU0r+bEyJ/qeqvSp X-Received: by 2002:a05:6a20:b71c:b0:b4:f66a:99a9 with SMTP id fg28-20020a056a20b71c00b000b4f66a99a9mr27656332pzb.60.1674606254619; Tue, 24 Jan 2023 16:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674606254; cv=none; d=google.com; s=arc-20160816; b=p8/kgKvTjGufwl/LWofwj5oNJCxlUcUVceT38VUx0Ls77k0gAkUxyJJTWMgLxP1Ra6 uTTIgzSLv5mZKNJ3aIs3OJBTQqbZ0tHoBGFWXKgDSqAAWYHUqDb0GP9VWg0lCIQy0T/D a+yuIYkAebvnfHBgFL8FQYMqKhbM0bDWGpwlUtBuIwwkhYOq8/gG5/ZgrI6Cz1nCGOyT XiaxhS0cQHnhxxJZcIKWGXlNkisrwHaYWInzofbSs91n6ZxJ2zqz4LFMqhms/Sshf+EE 10kE5/vk/r6Ns+R2RAfaeOvme/WKvOvf9EELxpEzglhAxpCaqkK/sFPAzlHwE6FxEfiu cFpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XtSwGpV2j0nQXiZ+LcNdnpcv1hVjkJ1W08Bggr7Cjy0=; b=aoxDEUmSlfyNI+cYjFsXOmIkAqB5vYpMoY/EvFSSRf6ADd8VSIBUTnhV2rUhAYweU2 RaYGvcALxQxUeg2se8qpZ/dL3O5Dp+KpTC7+EDpbTpS+vaNtyMDD/6zm9RJgFxQfWSpm nhZJBKRVdyIAMkpSda/7THHxj+of8MqZUPn/zdAEHiej0pkcj4w/kGKdLloTbTg/2hhM ZM30jtJ7581v2ZLGIv3Px+V+UkrxsExSEL9GQQ8dVPDs20k/xhJZGfmi8eEiMHRZbEXp Bo71cj8ZeZNeaK7u/VhAFyIdbsltJXLwwyzzUi4zbIB2sxmWHVuxPVxDguoqHnKhQp/O aOqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIneo37B; 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 a9-20020a637049000000b004b6578f3355si3506200pgn.773.2023.01.24.16.24.02; Tue, 24 Jan 2023 16:24:14 -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=TIneo37B; 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 S234393AbjAYAXg (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 19:23:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234171AbjAYAX2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 19:23:28 -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 A388F4DBFF for <linux-kernel@vger.kernel.org>; Tue, 24 Jan 2023 16:23:25 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id bk15so43433389ejb.9 for <linux-kernel@vger.kernel.org>; Tue, 24 Jan 2023 16:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XtSwGpV2j0nQXiZ+LcNdnpcv1hVjkJ1W08Bggr7Cjy0=; b=TIneo37BFcCoCvPMeBd+WYwoMRhtkaoPCmdy6r3Ws0YPEw99fpwL9/3Z9uvGBE8G5I J0pATloRutbCl+kMFdBctuX/JUuWrbwmXJqt0ZIKbXvl7cfejdjxN0iGJojYnm0HawTY +Pk9+qH+/lIxmXXnq7Iqzbfl3chdCfS7pl6Zw8sfTy99Ez9YeHDDZtnR/8UxtIMQJpvl 88AJ+ATsMy51AlyxKQeUZjZIO7qOp1rNA9txjGTgCxfK6LtYcawgt68/Xu/YTlTQ7Lzt qB4+3/1iG6jrEY+Fs3ZJLGVFvwtVrxbJxaqyEmQrEFShhadwx4/8EKqUefbFNUlelut9 M2wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XtSwGpV2j0nQXiZ+LcNdnpcv1hVjkJ1W08Bggr7Cjy0=; b=s6luloXAanDEm3/UrPBj1V5zbzGaSiBG/Aag94exK55caQjXCNcuYWjnMnQp+dZhIe cu6chistenYInMLH10Xg6a8sbIx7AWoMsF8AEQ5cWVE44AB9GFc2P5HR04jp1MRbvzo/ xdGuuh3Lya1NlNdECR/hTwlbYxY9MBy1KoBPSW1Wm/YVmwNC9P6f920k6WgY6HeBtLS1 XG8ln0CJ2ojciIHDsrBwQdfMRTlfHvqVuuB2fqGfG2Xl3Q3w0FXGCh/6EfLadpcjsEca XDgnX35Al0lnUz9fDqn9GYMpNRL/HaOkN/xQHSAmSxadn+ZT55P175Q2k/BW9MZ3H+4d w6Ag== X-Gm-Message-State: AFqh2krLpVgtWTf7UFmxdWwpu24vy4IRNdn29L+xKP7CkbePlONAhJ3s sXSHVHjvwiRY+ZUBUqlEor/4Jg== X-Received: by 2002:a17:906:8298:b0:86d:be0:607d with SMTP id h24-20020a170906829800b0086d0be0607dmr32534825ejx.70.1674606204058; Tue, 24 Jan 2023 16:23:24 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 16:23:23 -0800 (PST) From: Linus Walleij <linus.walleij@linaro.org> Date: Wed, 25 Jan 2023 01:23:09 +0100 Subject: [PATCH v3 4/6] crypto: stm32/hash: Wait for idle before final CPU xmit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20221227-ux500-stm32-hash-v3-4-32ee12cd6f06@linaro.org> References: <20221227-ux500-stm32-hash-v3-0-32ee12cd6f06@linaro.org> In-Reply-To: <20221227-ux500-stm32-hash-v3-0-32ee12cd6f06@linaro.org> To: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Lionel Debieve <lionel.debieve@foss.st.com> 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 <linus.walleij@linaro.org>, Rob Herring <robh@kernel.org> 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=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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755951928163108636?= X-GMAIL-MSGID: =?utf-8?q?1755951928163108636?= |
Series |
crypto: stm32 hash - reuse for Ux500
|
|
Commit Message
Linus Walleij
Jan. 25, 2023, 12:23 a.m. UTC
When calculating the hash using the CPU, right before the final hash calculation, heavy testing on Ux500 reveals that it is wise to wait for the hardware to go idle before calculating the final hash. The default test vectors mostly worked fine, but when I used the extensive tests and stress the hardware I ran into this problem. Acked-by: Lionel Debieve <lionel.debieve@foss.st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v2->v3: - No changes ChangeLog v1->v2: - Pick up Lionel's ACK --- drivers/crypto/stm32/stm32-hash.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index cc0a4e413a82..d4eefd8292ff 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -362,6 +362,9 @@ static int stm32_hash_xmit_cpu(struct stm32_hash_dev *hdev, stm32_hash_write(hdev, HASH_DIN, buffer[count]); if (final) { + if (stm32_hash_wait_busy(hdev)) + return -ETIMEDOUT; + stm32_hash_set_nblw(hdev, length); reg = stm32_hash_read(hdev, HASH_STR); reg |= HASH_STR_DCAL;