Received: by 10.223.176.5 with SMTP id f5csp2939259wra; Mon, 29 Jan 2018 06:31:53 -0800 (PST) X-Google-Smtp-Source: AH8x224a902+kolnZbz46sKBrIa3PzHEAgFrK34u2RPLZ4TaW5CunNcAdTRwU7P0c0NtdYFGoNgt X-Received: by 2002:a17:902:b7c3:: with SMTP id v3-v6mr12574189plz.307.1517236313081; Mon, 29 Jan 2018 06:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517236313; cv=none; d=google.com; s=arc-20160816; b=EjVF5P0danyZL7ecgNXIOLLO06QRDR35ClmDG7ofSjPj0l0Ws8SLPKlnSSYfnbZQlH VxOuMZKwGwlx1TQ/4EjE5c8/xwKf5sBhevdL6ywtQg8arVOLmEcrL6uoU5pTgV/6RdQb 1F2IxCBzu+dCa6MxxScUJtd3QiPaD3dE8EjL07pZ21k2iT6RETfp/hR89jJDH3myA0lV UC0jTMeXmvntyqc76xSCYRaUoOGv1qLmJq18al0AMYtyLtf5yM/xtTxiE1kWnzNdlZKT PYjjGcGQDCbu2+7kViWHyLQMNVk7RQaAf4XtsrTZz52JiIJVWx77GolbEQxKB5l5SrXB TLcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=DKL889d3bjz4lLF+yUWaaYY3lFfhILGNm2b5ynKVjS4=; b=CtWpX4FjJJd2tokjQx7GHfmXc65f1vdmMjv4bpi4WKkzBWQA5k4APDZZkCx5fKHQ4+ cZvgn0ktvKTb9LcjZcTImunXOkQ/qxNObkROIIvK4c09/8uxPhhkh5mNyAunuFhae41w t9oUxezsB5Twg2O1kkZx61DY6nwKgBm0KMXKxABBBOwfNNa3uapFB4HlP24+M98IN2Xd 9we9VinhYhl/ac/ApZED9o20NauXBBNbWQRLYdIUMULoHSRTRCNeH/rRlGsJGyCSZcXc R0FYpSXUADRZFtMtbNct6RigQsCefFPVskih5mF1RubdA2CQ/BMdEkJ/uQ7jJ3n89ECm rFqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si9395954plb.218.2018.01.29.06.31.38; Mon, 29 Jan 2018 06:31:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027AbeA2Oah (ORCPT + 99 others); Mon, 29 Jan 2018 09:30:37 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:42534 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbeA2O37 (ORCPT ); Mon, 29 Jan 2018 09:29:59 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w0TETEKM016705; Mon, 29 Jan 2018 15:29:32 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2ft0sq9ry8-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 29 Jan 2018 15:29:32 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id ECD693A; Mon, 29 Jan 2018 14:29:31 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CBB9B2944; Mon, 29 Jan 2018 14:29:31 +0000 (GMT) Received: from lmecxl0602.lme.st.com (10.75.127.46) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 29 Jan 2018 15:29:30 +0100 From: Lionel Debieve To: Herbert Xu , "David S . Miller" , Maxime Coquelin , Alexandre Torgue , , , CC: Benjamin Gaignard , Fabien Dessenne , Ludovic Barre , Lionel Debieve Subject: [PATCH 2/3] crypto: stm32/hash: fix performance issues Date: Mon, 29 Jan 2018 15:28:10 +0100 Message-ID: <20180129142811.13273-3-lionel.Debieve@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180129142811.13273-1-lionel.Debieve@st.com> References: <20180129142811.13273-1-lionel.Debieve@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG3NODE3.st.com (10.75.127.9) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-29_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lionel Debieve Fixing bugs link to stress tests. Bad results are detected during testmgr selftests executing in a faster environment. bufcnt value may be resetted and false IT are sometimes detected. Signed-off-by: Lionel Debieve --- drivers/crypto/stm32/stm32-hash.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 73cdc3b4dca8..d8444aeb6609 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -743,13 +743,15 @@ static int stm32_hash_final_req(struct stm32_hash_dev *hdev) struct ahash_request *req = hdev->req; struct stm32_hash_request_ctx *rctx = ahash_request_ctx(req); int err; + int buflen = rctx->bufcnt; + + rctx->bufcnt = 0; if (!(rctx->flags & HASH_FLAGS_CPU)) err = stm32_hash_dma_send(hdev); else - err = stm32_hash_xmit_cpu(hdev, rctx->buffer, rctx->bufcnt, 1); + err = stm32_hash_xmit_cpu(hdev, rctx->buffer, buflen, 1); - rctx->bufcnt = 0; return err; } @@ -1096,6 +1098,8 @@ static irqreturn_t stm32_hash_irq_handler(int irq, void *dev_id) reg &= ~HASH_SR_OUTPUT_READY; stm32_hash_write(hdev, HASH_SR, reg); hdev->flags |= HASH_FLAGS_OUTPUT_READY; + /* Disable IT*/ + stm32_hash_write(hdev, HASH_IMR, 0); return IRQ_WAKE_THREAD; } -- 2.15.1