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-08-11 23:38:51 +0000
commit05ded4288d733a36335ecc5bdef7e6bc4a093fe8 (patch)
tree479b20cf372edfb813b6041689d42af579806ea3
parentdeabc8588f6fef7522175b31757aa749bc62b54f (diff)
downloadchrome-ec-05ded4288d733a36335ecc5bdef7e6bc4a093fe8.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> (cherry picked from commit 0c649ba01ab555e84ab030b7f1a38c48b294bbe2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2311236 Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit 581f4c663dfeb2e67993346ecf55d6357f5ebd55) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2350284
-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)
{