Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp512930rdb; Thu, 24 Aug 2023 12:39:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHM9Sw80Wpo1N+3bo+s6HurxKpjBJ6306Yc8Ch3NETfD7MuWjEz7BE+EktFrx4rTb7w/1si X-Received: by 2002:a05:6512:b28:b0:4ff:8f44:834f with SMTP id w40-20020a0565120b2800b004ff8f44834fmr13612232lfu.38.1692905964979; Thu, 24 Aug 2023 12:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692905964; cv=none; d=google.com; s=arc-20160816; b=VGd6zocGW0JJoee9xeslV3l59CPPQERLoynfqXPBNrOmGmVs/1zosf9DCuIVwqyzCA muYqCvtumeYcE9WzfacLll1g1hCs5qrIVIsoHtJNpBG3ZrQAGNgvoFwNsSR5M5Q2YLfZ /zs1NPXBBy2D16fofeAeJ6qPMIGhlwogbf6gQOqMj6kYXFC4sBeBn09P8j3GxZRdgL5j Qnziu1BZE/s+/GszjhiNnAazjCO9W/iMqsCmF5bhJ/6V9EW1+fxzJrhF2owfvGlFlljk J3NkwXOSj0wEON65JZ8RU7fGLz7h607R65ydqy/Qzx4h3H+7JUXwKNHVsVhrjZVR9mr/ yEYw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HeGYXB423ImhM4HDuoYzq/ZZc9H0BonXNKNtV+n0w4A=; fh=MlvSK6e3kwN+F1KP9aqWF9U5JWJ1T+e+f4RH8e/Tu2E=; b=AsGO0ld1cKWNaNY9NFw5X0GI/GhuQuUhW+z1zHXoyVqELTe4SfYGGBEVVEg3ujm3Dt um5vn8vfFzMLGM7+5ZS2mk8D7sAByM27yxP9pFjiFR7aRC5Jk8mvDl6p5PmmzDWA7B07 0pVuABhDHt1JPimfyw3kEOIvZ1maj8T9lcdtrn9L0UjEMIlTr0k60S6vFdIwI2yjTECm 1Ta6OhOAWyLQuMa6s9AAKKrlGwAyab4hEBPZGNo3IQH78n74fYBXiO2Np7NNkUyWsBSm zVzktnCN22uoFN/iA9+8ooO52bJzpe5/6uMHnYGXSIXqXvS4SZscrNJatqRVT+va5rYo qxBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa7ccc2000000b005236f5c2d74si142122edt.294.2023.08.24.12.39.00; Thu, 24 Aug 2023 12:39:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243174AbjHXTYI (ORCPT + 99 others); Thu, 24 Aug 2023 15:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242991AbjHXTXv (ORCPT ); Thu, 24 Aug 2023 15:23:51 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF95A1BE5; Thu, 24 Aug 2023 12:23:48 -0700 (PDT) Received: from dslb-188-097-211-187.188.097.pools.vodafone-ip.de ([188.97.211.187] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1qZFvi-00036P-8z; Thu, 24 Aug 2023 21:23:42 +0200 From: Martin Kaiser To: Herbert Xu Cc: Alexander Stein , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH v2 1/6] hwrng: imx-rngc - reasonable timeout for selftest Date: Thu, 24 Aug 2023 21:20:54 +0200 Message-Id: <20230824192059.1569591-2-martin@kaiser.cx> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230824192059.1569591-1-martin@kaiser.cx> References: <20230824192059.1569591-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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: X-Mailing-List: linux-crypto@vger.kernel.org Set a more reasonable timeout for the rngc selftest. According to the reference manual, "The self test takes approximately 29,000 cycles to complete." With the rngc peripheral clock running at 66.5 MHz, this would be 436us. Let's use 1.5ms insteaf of 3sec for the timeout. Signed-off-by: Martin Kaiser --- v2: - adjust timeouts before we switch to polling drivers/char/hw_random/imx-rngc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index e4b385b01b11..6024c923b67d 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -53,6 +53,7 @@ #define RNGC_TIMEOUT 3000 /* 3 sec */ +#define RNGC_SELFTEST_TIMEOUT 1500 /* us */ static bool self_test = true; module_param(self_test, bool, 0); @@ -110,7 +111,8 @@ static int imx_rngc_self_test(struct imx_rngc *rngc) cmd = readl(rngc->base + RNGC_COMMAND); writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND); - ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT)); + ret = wait_for_completion_timeout(&rngc->rng_op_done, + usecs_to_jiffies(RNGC_SELFTEST_TIMEOUT)); imx_rngc_irq_mask_clear(rngc); if (!ret) return -ETIMEDOUT; -- 2.39.2