mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ryan Brue <ryanbrue.dev@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>,
	Olivia Mackall <olivia@selenic.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] hwrng: mtk - wait long enough for the next word
Date: Thu, 12 Nov 2026 18:03:45 +0800	[thread overview]
Message-ID: <avWPAXUIyv3KP0hb@gondor.apana.org.au> (raw)
In-Reply-To: <20261026-rbrue-sheldon-upstreaming-mtk-rng-timeout-v1-1-551b4b6b4f86@gmail.com>

On Mon, Oct 26, 2026 at 01:47:05PM -0500, Ryan Brue wrote:
> mtk_rng_wait_ready() gives the generator 60 us to produce the next
> 32-bit word. On MT8695 it takes longer: timed over 1421 waits, the
> median was 82 us, the 99th percentile 92 us and the longest 225 us. So
> most waits time out. A read that fails on its first word returns -EIO,
> which a read from /dev/hwrng after a short idle period does more often
> than not, and longer reads come back short.
> 
> Raise the timeout to 1 ms. Generators that are faster still return as
> soon as the word is ready. On MT8695, 20 reads after idle periods all
> succeeded, and a 256 KiB read returned in full at the same 63 KB/s.
> 
> Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
> ---
> Found while bringing up mainline on the Amazon Fire TV Stick (3rd
> generation, MT8695), whose RNG uses the mediatek,mt7623-rng compatible.
> The board's devicetree is not upstream yet. The timings were taken with
> a temporary print in mtk_rng_wait_ready().
> ---
>  drivers/char/hw_random/mtk-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      parent reply	other threads:[~2026-11-12 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 18:47 Ryan Brue
2026-11-12  9:56 ` Herbert Xu
2026-11-12 10:03 ` Herbert Xu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avWPAXUIyv3KP0hb@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=olivia@selenic.com \
    --cc=ryanbrue.dev@gmail.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®