summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2020-06-18 09:09:04 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-18 22:23:45 +0000
commit0c649ba01ab555e84ab030b7f1a38c48b294bbe2 (patch)
tree3015e0a1340a540d7e001feb3e373c8d91e0924d
parent08b1e22d83bd1d6c07619065fded9d0496f90e58 (diff)
downloadchrome-ec-0c649ba01ab555e84ab030b7f1a38c48b294bbe2.tar.gz
trng: adjust TRNG timeout to reduce TRNG resets
Time it takes for TRNG to come-up with 32-bit of randomness varies, and once TRNG started to use 1-bit alphabet, it's average increased. We handle this timeout by resetting TRNG and writing record in the flash log. With current setting of EMPTY_COUNT set to 400 it's almost never happens under normal use, and is harmless, but adds unnecessary records in the log under heavy use like TRNG health tests. Adjusting EMPTY_COUNT to higher value reduce probability of TRNG reset when value is just delayed, but TRNG is not stalled yet. BUG=b:138578157 TEST=tpmtest -t0 Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: Ic0152da05934a70dd16b3e4178361bfcefbdda26 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2252481 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: William Wesson <wesson@google.com> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--chip/g/trng.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/g/trng.c b/chip/g/trng.c
index b64c3c7dbe..e817034937 100644
--- a/chip/g/trng.c
+++ b/chip/g/trng.c
@@ -33,10 +33,10 @@
/**
* Attempts to read TRNG_EMPTY before reporting a stall.
- * Practically data should be available in less than 400
+ * Practically data should be available in less than 777
* cycles under normal conditions.
*/
-#define TRNG_EMPTY_COUNT 400
+#define TRNG_EMPTY_COUNT 777
void init_trng(void)
{