Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2634688rdb; Tue, 12 Sep 2023 07:48:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQZIBmUft4ebaBjUfmLhoGg/aNG/Od6qcmArLl86qlioKs/XD67U45zOyK0Gf2/5SacQaY X-Received: by 2002:a17:90b:38d1:b0:268:2523:652c with SMTP id nn17-20020a17090b38d100b002682523652cmr11396702pjb.31.1694530107397; Tue, 12 Sep 2023 07:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694530107; cv=none; d=google.com; s=arc-20160816; b=oOXfIAJSspv7K6Z4B8Dm++Xnuk94ePhGulK9Q/Pq/ihU/I2iN16HvXXnkbxu51IfY2 TN2Oft1S7Q1yM78xu3U1eIZg8PkmiH3O7kSXNlPpsxnuuWtqNrvP0GTMDS7g+xZ3yL39 9zk14Zs1j8FdcfLieXlMDejQh94UijmkBgwEoDxnAkXIL+DYSOAurP+t3MAQ44Vhzwi8 jcXo4Sb8pyCzGaCaubbCeBglDkbq5Q8ZA5iZCuO7AQTqT2u6dKpvYhWZlEP05X7HPzXB ffXbN71cunef9n9YOfpDbUsDKrmZ5clNCvaoOLEuvclFClw01gUt2L8P1KyhIZBylFrO +eTg== 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=eBML06wzieRCT46r7BIzYmwH/lYIn9PmgTZqGbe9rzA=; fh=SqCs7KZ8ytcbnkiRESvNRChZIthYOwhcUjFjEDfWP4k=; b=in9GI/qRqU2RVf6KofScOngt13fxyFc7OaB84wTEGiU0l/N9SPlkOBlWQXkhkUX0KI 68mIjPoxbPIHaNjwfLLqAuD4n3b0usm29n7/kPhTxH3H/kVzvi4BmwVm2c50ExE+PHQw vDgJxtiFhrJqRlervwRHQXftLVktBvB6ytSOd2nN5twjqLc91O0Ml8q6/ZTzkoWrHf2O e9O6f8UeFOdhM/axkUyXyrUEEHdKBWMvjuDth/+Vp5K6BCV/sIq7Z0TCagh9aff3MJm+ U30OIdoG3aAKeSyoyVt8YgmtKfB5cj2zDUv3d3VxE8UZ2AwIQrDTUrwB0rTt8DfwMBEZ /law== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g8-20020a17090a640800b00263d559dbf1si8067019pjj.55.2023.09.12.07.48.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 07:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 817138182387; Tue, 12 Sep 2023 07:35:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236040AbjILOer (ORCPT + 99 others); Tue, 12 Sep 2023 10:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236033AbjILOeq (ORCPT ); Tue, 12 Sep 2023 10:34:46 -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 E7688CCC; Tue, 12 Sep 2023 07:34:42 -0700 (PDT) Received: from dslb-178-004-201-190.178.004.pools.vodafone-ip.de ([178.4.201.190] 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 1qg4TQ-0005wr-0k; Tue, 12 Sep 2023 16:34:40 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/2] hwrng: imx-rngc - reasonable timeout for selftest Date: Tue, 12 Sep 2023 16:31:17 +0200 Message-Id: <20230912143117.55965-2-martin@kaiser.cx> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230912143117.55965-1-martin@kaiser.cx> References: <20230912143117.55965-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Sep 2023 07:35:18 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 pete.vger.email Set a more reasonable timeout for the rngc selftest. According to the reference manual, "The self test takes approximately 29,000 cycles to complete." The lowest possible frequency of the rngc peripheral clock is 33.25MHz, the selftest would then take about 872us. 2.5ms should be enough for the selftest timeout. Signed-off-by: Martin Kaiser --- 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..127c292dfbbf 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 2500 /* 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