Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3346954rdb; Tue, 29 Aug 2023 12:24:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHzWEz/C8LZ6BiqSszrpxWJBGdQobJuhiXFBVY0rhYK8kGj4tBiHcVpVFGH2YFw6acJgU3 X-Received: by 2002:a05:6808:2a6b:b0:3a8:8aa3:cc72 with SMTP id fu11-20020a0568082a6b00b003a88aa3cc72mr70657oib.41.1693337053521; Tue, 29 Aug 2023 12:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693337053; cv=none; d=google.com; s=arc-20160816; b=K4WbQnu9W0KrPl0CZHgIWLG2AF1DC0mHR7ROTn2EhWrI8/XnSBE11C2gDFiiICQMCH Yy3zH5wpk5a0tG0yMtJWYxMp7aGCRdIOmRVnbBlW/SzB4oUJBlqJ9UY69Ll3qLFobVQS 8Z2N1Ikg4M4Nu+W68rMIfFl/zQZXyBLN1z5p5nYYaXNP1nOfTzYstVbmO0yWndcwgw9G Qk/9RO9tFKzFlt5WbDZYR/8GNVZi0+LXg9HDfiwWAehl55ta1K17IA4Bhc+9EqPeECbb p86mOBJ54FUZ3rRc2Ca6mcgk6CLeFqE5Ue63AJmVUgMerATOISe+TukknnmrJLhMYUR+ 3p0w== 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=jkIT9/vzgDDzkkpr518rRwFkSTrYUgbqZW17Cy7Sr2o=; fh=z5MsoVc8BXfCQAzR1NVjt+ZTjadt3gsvCijoJUk9v7Y=; b=oQOFR4/Nc9dWND36nfYkOcUTQvuNbAA3AKSup/mhTf2uPloK2jPSBDuSXWWOgP9WHv 26U6u9omcx54zGDvkwSmp78y8gHiNJ5lPqAv+TQy7Fq+cyTFJNujGDflSBtV25O4gisE 0PhdsSuZV9wnmvFnFbw6K1scZEm7looEKPwB3kv/L/My1zG2Z5Ma7NdP3PQDnuKss1Vl uPaUovyNZ1+a9VptpB5C0ngGwIK9hVv6NNKvF7n9Uqjch2i0QMEvzC8gIxqxbLvXZ3CH r8GTZESYdJmDrxsaJckkZaTRBF/VQsbH8DeNG0lkmlwR4PfrD8DUxhJtQEoMTQCnb/HA 8Urg== 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 bs131-20020a632889000000b00563f74f5ce5si9601733pgb.372.2023.08.29.12.23.53; Tue, 29 Aug 2023 12:24:13 -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 S238605AbjH2S6w (ORCPT + 99 others); Tue, 29 Aug 2023 14:58:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238598AbjH2S6Y (ORCPT ); Tue, 29 Aug 2023 14:58:24 -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 99BAFFC; Tue, 29 Aug 2023 11:58:20 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1qb3un-0008OZ-I9; Tue, 29 Aug 2023 20:58:13 +0200 Date: Tue, 29 Aug 2023 20:58:13 +0200 From: Martin Kaiser To: Alexander Stein Cc: Herbert Xu , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/6] hwrng: imx-rngc - use polling to detect end of self test Message-ID: <20230829185813.odjl3zqwshbgki4m@viti.kaiser.cx> References: <20230824192059.1569591-1-martin@kaiser.cx> <20230824192059.1569591-4-martin@kaiser.cx> <8370215.EvYhyI6sBW@steina-w> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8370215.EvYhyI6sBW@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,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 Hi Alexander, Alexander Stein (alexander.stein@ew.tq-group.com) wrote: > I'm still not convinced that using polling is simpler. By using > readl_poll_timeout() you will also get an interrupt, the timer one. Why > exactly is using polling much (!) simpler? it requires much less code in the driver. > > The selftest should take approx. 450us. Keep the overhead to a minimum > > by polling every 500us. (We've already lowered the timeout to 1.5ms.) > I suppose these times only hold true for a specific peripheral clock > frequency. Is it guaranteed that this frequency is fixed? Good point. The lowest possible peripheral clock frequency is half of what I used for the calculations, i.e. 33.25MHz. That would double the durations. Should be ok for the selftest. But for the initial seed, we'd get into a region where readl_poll_timeout (usleep_range) does no longer make sense. > For using IRQ it's simpler, there is no guessing: you return once the self > test finished. The timeout is identical anyway. I've looked at other callers of readl_poll_timeout. It seems that none of them is called in a driver's probe function or uses an overall timeout of 200ms. I'll keep the interrupt + completion and resubmit the patches for adjusting the timeouts. Thanks, Martin