Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp752740rdh; Wed, 23 Aug 2023 14:00:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0cP9BaRvRwBXho38Ep2xbArUVsX6D+FLmOnh4Fy4cjZhIAhYtGlHmu8bdr+QIzQzHnlgw X-Received: by 2002:aa7:d843:0:b0:523:95e:c2c0 with SMTP id f3-20020aa7d843000000b00523095ec2c0mr9009256eds.42.1692824415603; Wed, 23 Aug 2023 14:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692824415; cv=none; d=google.com; s=arc-20160816; b=SdIU2vCqLp41ZVlPAXJYNOIqpR7jAF5yOZE/eDWclQQ2AIG0SEXPUc3Ql9l3NpqSYK ieSqGMwNCyUT/rBYCXLPjNNzgy7uG6UVbDBqKXUjmNZaMyk2TwvAAUuasUUBJB2K7orx bj7mkF/WjKHZHyvEpdPqbgbbjLCTHnrXS2K+J/cQ67UYmVxqWjgJ/GKBKu4gzEbarGXQ WxCm0fB+Uy1t2V9vOYv7aHZ5CdEUkXOenoDwInVQB4YyDZhoTOXlMsT9DANohq2fXhyc yMUpdVIBq4sVB2BLZFvc1AOtkGJQdYfJt3SvQURnWRZuaszV7Janmk7eERF+8TI3beCf K3Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xAgZFu3Lx+9gtLpdMn9hxs5RIbcV27Y5fxWZrzRTJfE=; fh=Z9+sVswiyhz+zC1duoCMQiqmNPIgNJgY+W6oklTqWNM=; b=BmBwyenZf3lLmQIgcRH1PfTc/9/VcLEOxKA5+InbGozrfaq3Vl2FlnoFlvchUI4nHf Vceo6/oSa+xm0WOZj0+OdS0nKFfJvXeaF2cKqlUDHAjUIbMZo+0aIEEkoJFj3K+m2DtR DgR5EqRGw3TbJZvMgBPgnenvfWya7SxLCTPmGMfzEpBZlR1q0CXw1z3zlvyHALCXaUba Ggclv4B2hMHZVddtvt09Zu7Dj+ZRHah5FbCtlBy86ysAClEBEJFak6m70KaQAQd5fMdY tPiUJ5Wp+R13sRX6FyUO+2kW+WBjpQqQcQ4hcgPw8Wbx2fvfo6767aC1rdD+2aytFu8i S97w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020aa7d34a000000b0052548800d54si9144250edr.265.2023.08.23.13.59.46; Wed, 23 Aug 2023 14:00:15 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234292AbjHWLHu (ORCPT + 99 others); Wed, 23 Aug 2023 07:07:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbjHWLHs (ORCPT ); Wed, 23 Aug 2023 07:07:48 -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 640A6CEF; Wed, 23 Aug 2023 04:07:46 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1qYli7-0006dD-2j; Wed, 23 Aug 2023 13:07:39 +0200 Date: Wed, 23 Aug 2023 13:07:39 +0200 From: Martin Kaiser To: Alexander Stein Cc: Herbert Xu , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] hwrng: imx-rngc - use polling to detect end of self test Message-ID: <20230823110739.4oqyhjca7ratf5sx@viti.kaiser.cx> References: <20230822152553.190858-1-martin@kaiser.cx> <20230822152553.190858-2-martin@kaiser.cx> <3503619.mvXUDI8C0e@steina-w> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3503619.mvXUDI8C0e@steina-w> User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser 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-kernel@vger.kernel.org Hi Alexander, thanks for reviewing the patches. Alexander Stein (alexander.stein@ew.tq-group.com) wrote: > Am Dienstag, 22. August 2023, 17:25:51 CEST schrieb Martin Kaiser: > > Use polling to detect the end of the rngc self test. This is much simpler > > than using an interrupt and a completion. > > Active waiting is no disadvantage here. The self test is run during > > probe, there's nothing we could do in parallel at this time. > If this driver is built-in you are stalling the boot process while > polling, no? According to the manual, "The self test takes approximately 29,000 cycles to complete." On my system, the rngb peripheral clock runs at 66.5MHz, i.e. the self test takes 436us. A poll interval of 480us and a timeout of 1.5ms are more appropriate than the current values (1ms poll interval, 3sec timeout). I'll fix this in v2. If it is unacceptable for a probe function to run for 1.5ms, we could probably move the self test to the init function. It's called when the rng is selected as the active rng. > Unless probe_type = PROBE_PREFER_ASYNCHRONOUS is set of > course. This does not work for drivers that use module_platform_driver_probe. We could switch to module_platform_driver. I'd prefer fixing the timing or moving the self test to init, though. Best regards, Martin