summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2023-03-28 20:10:51 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-07 22:05:52 +0000
commitc1c637bb53eaa9de9ead652dc9908eef6c15b8a5 (patch)
tree4f3819fa24c0841d90144fd4b80a111a8c5a41b7
parent12c5484d936f22b04ad383869c65e796782f951f (diff)
downloadchrome-ec-c1c637bb53eaa9de9ead652dc9908eef6c15b8a5.tar.gz
cr50: improve logging of dcrypto failures
1. Increase timeout from 700ms to 1000ms as we saw some timeouts of unknown origin. 2. INT_STATE wasn't collected for timeouts, change when we get it. 3. Add address of function to log so we can identify source of failure. BUG=b:273935442 TEST=make CRYPTO_TEST=1; tpm_test Change-Id: Ifbb1ea5d52662a71d944baa9a7a189224529d85e Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4380209 Reviewed-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Code-Coverage: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
-rw-r--r--board/cr50/dcrypto/dcrypto_runtime.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/board/cr50/dcrypto/dcrypto_runtime.c b/board/cr50/dcrypto/dcrypto_runtime.c
index da1f854c68..7ed1add4f3 100644
--- a/board/cr50/dcrypto/dcrypto_runtime.c
+++ b/board/cr50/dcrypto/dcrypto_runtime.c
@@ -86,7 +86,7 @@ void dcrypto_unlock(void)
}
#ifndef DCRYPTO_CALL_TIMEOUT_US
-#define DCRYPTO_CALL_TIMEOUT_US (700 * 1000)
+#define DCRYPTO_CALL_TIMEOUT_US (1000 * 1000)
#endif
/*
* When running on Cr50 this event belongs in the TPM task event space. Make
@@ -108,6 +108,7 @@ uint32_t dcrypto_call(uint32_t adr)
event = fips_vtable->task_wait_event_mask(TASK_EVENT_DCRYPTO_DONE,
DCRYPTO_CALL_TIMEOUT_US);
+ state = GREG32(CRYPTO, INT_STATE);
/* TODO(ngm): switch return value to an enum. */
switch (event) {
case TASK_EVENT_DCRYPTO_DONE:
@@ -117,7 +118,6 @@ uint32_t dcrypto_call(uint32_t adr)
* all other bits are indicative of error.
* Except for MOD_OPERAND_OUT_OF_RANGE, which is noise.
*/
- state = GREG32(CRYPTO, INT_STATE);
if ((state &
~(GC_CRYPTO_INT_STATE_MOD_OPERAND_OUT_OF_RANGE_MASK |
GC_CRYPTO_INT_STATE_HOST_CMD_RECV_MASK)) == 0)
@@ -126,9 +126,13 @@ uint32_t dcrypto_call(uint32_t adr)
default:
dcrypto_reset_and_wipe();
#ifdef CONFIG_FLASH_LOG
+ /* dcrypto status is only 12 bits, but for analysis we
+ * add dcrypto function address in top 16 bits.
+ */
+ state |= (adr << 16);
/* State value of zero indicates event timeout. */
fips_vtable->flash_log_add_event(FE_LOG_DCRYPTO_FAILURE,
- sizeof(state), &state);
+ sizeof(state), &state);
#endif
return 1;
}