From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD5B4EE49AD for ; Wed, 23 Aug 2023 05:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OmruoXSfR9GTI0srfBgxtaZuHqnoJZVcNK4hvWksK4I=; b=Xa5uUwFDePTAJa GxQceSJ0amwdPxZwUjpmwrccYV1b/alVw2Adj8I8Te8DbIYPsXIpRZhf8nfjWmb0faFSP0k2FOqnC H8uXQjX0igcKWcour0q1LorehSwpTTT67kXPeJRU+6Z7ZEER7v+uU3FjObrg+XtqpZWrtsLXGp+R5 HHGat8hre6v6HeYqO1rQm3DwFOkwknKstzU30u3nwBKEpFEmudu3eL/4nVS7tQTRu14EPhfMKmmk1 3YSXfJR7k5J4kfTiqyOM2SfTfT8VLeVfMzKplX3bd5E4PFuxNJKha6zLfNqD9hiuNLOBXi4N8Yf7P xV7pNxbd+eEGtrZzf0Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYgLG-00HHaT-1M; Wed, 23 Aug 2023 05:23:42 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYgLC-00HHZN-2t for linux-arm-kernel@lists.infradead.org; Wed, 23 Aug 2023 05:23:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1692768218; x=1724304218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z8gFBF0mu3Kl0VGNPxlN8F2BAekuhDcZB1/KPbYzabM=; b=nZLXU4/JT0lifcluFSruXXhTtrfS4CpCWao1XxxENOfmrZxdMg1tRjpd InYdriy8M8ORHGia0TxiFEt9oFp+mSMt4rRRCjIVZ1bjBamgUTXPh36Gb 84Up9mviYNbkHrBF5RHD9ffqpGHJB4Z47HE+gonvOwyPGBX8laRlGZobp QmZrQMt4rGNgGxsTD1lXBpsdizey80EHuebOzEZ7/6e1Pxx1LQKD868Kp hWYSGGyoTmpzNdZqP19dMI81PMzv32yZMl6DNEgEgKJQmGgHfGTFbyJzs y1knvTdDyPP6GBFuI7pNgJBPEGbsg95deRL4xXxO2bsrC1lkZ4Icikbn1 w==; X-IronPort-AV: E=Sophos;i="6.01,194,1684792800"; d="scan'208";a="32575038" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 23 Aug 2023 07:23:33 +0200 Received: from steina-w.localnet (steina-w.tq-net.de [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id E82C3280075; Wed, 23 Aug 2023 07:23:32 +0200 (CEST) From: Alexander Stein To: Herbert Xu , linux-arm-kernel@lists.infradead.org Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser , Martin Kaiser Subject: Re: [PATCH 1/3] hwrng: imx-rngc - use polling to detect end of self test Date: Wed, 23 Aug 2023 07:23:32 +0200 Message-ID: <3503619.mvXUDI8C0e@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230822152553.190858-2-martin@kaiser.cx> References: <20230822152553.190858-1-martin@kaiser.cx> <20230822152553.190858-2-martin@kaiser.cx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_222339_332314_940EBFEC X-CRM114-Status: GOOD ( 18.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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? Unless probe_type =3D PROBE_PREFER_ASYNCHRONOUS is set of course. Best regards, Alexander > Signed-off-by: Martin Kaiser > --- > drivers/char/hw_random/imx-rngc.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > = > diff --git a/drivers/char/hw_random/imx-rngc.c > b/drivers/char/hw_random/imx-rngc.c index e4b385b01b11..85207535fd12 1006= 44 > --- a/drivers/char/hw_random/imx-rngc.c > +++ b/drivers/char/hw_random/imx-rngc.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > = > #define RNGC_VER_ID 0x0000 > @@ -101,21 +102,19 @@ static inline void imx_rngc_irq_unmask(struct imx_r= ngc > *rngc) > = > static int imx_rngc_self_test(struct imx_rngc *rngc) > { > - u32 cmd; > + u32 cmd, status; > int ret; > = > - imx_rngc_irq_unmask(rngc); > - > /* run self test */ > cmd =3D readl(rngc->base + RNGC_COMMAND); > writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND); > = > - ret =3D wait_for_completion_timeout(&rngc->rng_op_done, > msecs_to_jiffies(RNGC_TIMEOUT)); - imx_rngc_irq_mask_clear(rngc); > - if (!ret) > - return -ETIMEDOUT; > + ret =3D readl_poll_timeout(rngc->base + RNGC_STATUS, status, > + status & RNGC_STATUS_ST_DONE, 1000, = RNGC_TIMEOUT * 1000); > + if (ret < 0) > + return ret; > = > - return rngc->err_reg ? -EIO : 0; > + return readl(rngc->base + RNGC_ERROR) ? -EIO : 0; > } > = > static int imx_rngc_read(struct hwrng *rng, void *data, size_t max, bool > wait) -- = TQ-Systems GmbH | M=FChlstra=DFe 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht M=FCnchen, HRB 105018 Gesch=E4ftsf=FChrer: Detlef Schneider, R=FCdiger Stahl, Stefan Schneider http://www.tq-group.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel