From: Nicholas Piggin <npiggin@gmail.com>
To: Evgeny Voevodin <evvoevod@tenstorrent.com>
Cc: opensbi@lists.infradead.org
Subject: Re: [PATCH] lib: sbi: Apply budget restriction when polling Zkr CSR state transition
Date: Mon, 25 May 2026 20:36:25 -0700 [thread overview]
Message-ID: <ahUPSS8uvDvH4fBs@lima-default> (raw)
In-Reply-To: <20260519225014.244672-1-evvoevod@tenstorrent.com>
On Tue, May 19, 2026 at 10:50:14PM +0000, Evgeny Voevodin wrote:
> Zkr architecture doesn't define a time limit on state transitions
> which results in hanging on unresponsive or event-driven platforms.
> To prevent this, we need to limit polling iterations and fall back
> in case the budget is over, and stack guard keeps its initial value.
> The budget is configurable with CONFIG_SBI_INIT_ZKR_POLL_BUDGET,
> defaulting to 1000 iterations.
> Successful reads do not consume a try.
>
> Signed-off-by: Evgeny Voevodin <evvoevod@tenstorrent.com>
> ---
> lib/sbi/Kconfig | 12 ++++++++++++
> lib/sbi/sbi_init.c | 12 +++++++++---
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/lib/sbi/Kconfig b/lib/sbi/Kconfig
> index c6cc04bc..a11f788c 100644
> --- a/lib/sbi/Kconfig
> +++ b/lib/sbi/Kconfig
> @@ -6,6 +6,18 @@ config CONSOLE_EARLY_BUFFER_SIZE
> int "Early console buffer size (bytes)"
> default 256
>
> +config SBI_INIT_ZKR_POLL_BUDGET
> + int "Zkr seed polling budget (iterations)"
> + default 1000
> + help
> + Maximum number of iterations to poll CSR_SEED when initializing
> + the stack guard variable. The Zkr specification doesn't define
> + a time limit on transitioning to ES16 between polls, which
> + makes it impossible to tell whether entropy is being
> + accumulated slowly or the entropy source is not functioning.
If entropy source is not functioning it should return DEAD, surely.
Specifications always require a "reasonable" performance, whether that
is explicit or not. That's open to interpretation and application, but
if a word of entropy at boot causes a responsiveness problem, I don't
know if that's a reasonable expectation in the spec that needs to be
accounted for.
So I think a bit more information would be good. If if this is a
workaround for a particular platform that might be okay but I think it
should be framed as such.
Thanks,
Nick
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-05-26 3:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 22:50 [PATCH] lib: sbi: Apply budget restriction when polling Zkr CSR state transition Evgeny Voevodin
2026-05-26 3:36 ` Nicholas Piggin [this message]
2026-05-27 17:19 ` Evgeny Voevodin
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=ahUPSS8uvDvH4fBs@lima-default \
--to=npiggin@gmail.com \
--cc=evvoevod@tenstorrent.com \
--cc=opensbi@lists.infradead.org \
/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