Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4517227ybp; Mon, 14 Oct 2019 06:02:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM47peyyaK6F0G1oxa+r7l5a+NQZpdfD/jT6qemB2DuArbTM1hrg8KvpEyRhf0i0bDomcB X-Received: by 2002:a05:6402:1b8a:: with SMTP id cc10mr28090568edb.202.1571058141932; Mon, 14 Oct 2019 06:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571058141; cv=none; d=google.com; s=arc-20160816; b=J+f9VP5YbML/0JFSkElptRUYsnw/XIYZKCIAAaii+z5yIA+6tGYfnNxz39/FwKGPvJ sjviiy0eGSlFXAlWZVAG1TiPMPTtM96NRh4P+3D9IdxGioXj/y9oOxQAtGBlUyQ5SfNa azj5QO+wkDbabTgrpWosRDg3K1QcBBAsJSB56XInWJxTTKRw992698sCA0QznZ/OLSuk CyJxoYkQ2Xf1JbuDMzTo70sRS8FfMpl8eNW0rYumn6Z5Y1M5nWMV2RPpdiFTnmoLZity j4O0THCT5mLtx1wI6RnDcAnDGWP7JAQz/tfXz2BqQsoh6WOAaoWAPzD4zsgZPDuEt7nm gUBA== 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:dkim-signature; bh=74yP2FxtDtG0Yd27NaPGtt7r14yMghW+Jf1gUnHQp+s=; b=QBZoPIeIchde2OcPZX2OoZuprkRbc5a6qxtHGT5elFwN7U0bdTTkBZ7vo3+o92oqKC luDOHL/9NqU8Sd/1DFZlTkjnzxmuLHAzU9TbwuChdDUGyjjI1lz/u1KCEEppNaPPR3Ov SMhCfupa0h74GWkECSOd/Ez1NHXBZl2LKxCR628+EKu/wtKys6/soot8mgOqCw03MCLF 3QbRnvpbiyU9rhevyYb8qpOGclDfjGP5m0SypHSvbSgxcXPWB3prch1sBccSaMym9nRH W5QMTUnDhPk6Vs1PIbMlhGFvPXi1Zbwc6kMyFRSSjI+msu9vGH9HEuUIg6fTrQi+T37a bfKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tCsg8/BI"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w26si11137262eda.438.2019.10.14.06.01.56; Mon, 14 Oct 2019 06:02:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tCsg8/BI"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730430AbfJNM1j (ORCPT + 99 others); Mon, 14 Oct 2019 08:27:39 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45872 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730398AbfJNM1j (ORCPT ); Mon, 14 Oct 2019 08:27:39 -0400 Received: by mail-wr1-f65.google.com with SMTP id r5so19456517wrm.12 for ; Mon, 14 Oct 2019 05:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=74yP2FxtDtG0Yd27NaPGtt7r14yMghW+Jf1gUnHQp+s=; b=tCsg8/BIBUlbpsqZtroC38Z3Xjzi5BfqfCZK8nUVkrfZgMA0s9XJgV+XCKUHQmJjOS 8Pre32L6bDLw6peIdTPsF58olTmJjhfivaBr++af5pNg/9+qjNmqfFEsf+IQ1VVBGLTp 3vu3ao5P8ytuIY5jSQ9X092ZW907OQbpp12cVZE27MDFNsIU6zZ83XWUif/2BtXIthew dqIuGlLkB08XeQhgPsQGDzuyuThKrY+xZTnpQJWnRnTvGZUQpERVY9XUJWusSXhKRreX kB/QTrjqhDPHiAUIfDeBzC+yW3dlxPfbX7x3X9572K/XH0SqNvjTaqEVlmdnNy2Z6KXR YNBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=74yP2FxtDtG0Yd27NaPGtt7r14yMghW+Jf1gUnHQp+s=; b=od95dtGbZL+fdGa1uWVfror5RN9HBKxkHl6DLQsdkEK2qGNOvZIuLBsF0sfX6gbjfj TDxFkTwCinAqk9ivWkLud3tDQ26w63M1phix9xXuBb84f1wyZ++PXrVWkx6Go34RNDCM 0VuVf6DTjdo4n4WaWN9z8sKeuQj+t0LigcxeqCl3Q5ajhRQjYuJjAQWjpHGR0ErXK4mF 53E+j8oU3H5oVBoR4GPibJWKB+yU9l42P74M0ZTyBmjjAF4vhlYdiPhiqHnbzfbVswxp ui5QsrCm1Ll0onM+4lLWEB5CmloM1LusQEbtymqC9sBP1/WV+o2DCiTBs58ytw6KaJji bSuQ== X-Gm-Message-State: APjAAAU/axDKu5K3kBtDccVtA+LeZqogd7tpiw30vjZWk2Y3U18Atqt+ gLHJFQeDy8r5+KdXbaQxsKAaKw== X-Received: by 2002:a5d:4c85:: with SMTP id z5mr25686239wrs.384.1571056055517; Mon, 14 Oct 2019 05:27:35 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id u26sm18054666wrd.87.2019.10.14.05.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:27:34 -0700 (PDT) Date: Mon, 14 Oct 2019 13:27:32 +0100 From: Daniel Thompson To: Sumit Garg Cc: linux-crypto@vger.kernel.org, dsaxena@plexity.net, herbert@gondor.apana.org.au, mpm@selenic.com, romain.perier@free-electrons.com, arnd@arndb.de, gregkh@linuxfoundation.org, ralph.siemsen@linaro.org, milan.stevanovic@se.com, ryan.harkin@linaro.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] hwrng: omap - Fix RNG wait loop timeout Message-ID: <20191014122732.d6ow5tbko5xdwd7g@holly.lan> References: <1571054565-6991-1-git-send-email-sumit.garg@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571054565-6991-1-git-send-email-sumit.garg@linaro.org> User-Agent: NeoMutt/20180716 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Oct 14, 2019 at 05:32:45PM +0530, Sumit Garg wrote: > Existing RNG data read timeout is 200us but it doesn't cover EIP76 RNG > data rate which takes approx. 700us to produce 16 bytes of output data > as per testing results. So configure the timeout as 1000us to also take > account of lack of udelay()'s reliability. What "lack of udelay()'s reliability" are you concerned about? Daniel. > > Fixes: 383212425c92 ("hwrng: omap - Add device variant for SafeXcel IP-76 found in Armada 8K") > Cc: > Signed-off-by: Sumit Garg > --- > drivers/char/hw_random/omap-rng.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c > index b27f396..e329f82 100644 > --- a/drivers/char/hw_random/omap-rng.c > +++ b/drivers/char/hw_random/omap-rng.c > @@ -66,6 +66,13 @@ > #define OMAP4_RNG_OUTPUT_SIZE 0x8 > #define EIP76_RNG_OUTPUT_SIZE 0x10 > > +/* > + * EIP76 RNG takes approx. 700us to produce 16 bytes of output data > + * as per testing results. And to account for the lack of udelay()'s > + * reliability, we keep the timeout as 1000us. > + */ > +#define RNG_DATA_FILL_TIMEOUT 100 > + > enum { > RNG_OUTPUT_0_REG = 0, > RNG_OUTPUT_1_REG, > @@ -176,7 +183,7 @@ static int omap_rng_do_read(struct hwrng *rng, void *data, size_t max, > if (max < priv->pdata->data_size) > return 0; > > - for (i = 0; i < 20; i++) { > + for (i = 0; i < RNG_DATA_FILL_TIMEOUT; i++) { > present = priv->pdata->data_present(priv); > if (present || !wait) > break; > -- > 2.7.4 >