diff options
author | Vadim Bendebury <vbendeb@google.com> | 2018-02-06 17:14:03 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-07 15:04:13 -0800 |
commit | 41a308abcb02474e3883a5be7c3001738c020789 (patch) | |
tree | d0f1155db9a009465ee9ceb7636f40e7afe9e4bc | |
parent | 824351c839001019214ad907fd2c027fad98db95 (diff) | |
download | chrome-ec-41a308abcb02474e3883a5be7c3001738c020789.tar.gz |
tpm: set waiting task ID earlier.
The TPM task is running on a higher priority than the hook task
invoking TPM reset for RMA purposes. The waiting task ID value needs
to be set before TPM task is signaled to reset.
BRANCH=cr50, cr50-mp
BUG=b:37952913
TEST=with the corresponding ccd_config.c changes fully verified RMA
process (not just generating and processing the challenge).
Change-Id: Id112d59ae0c3fd31a32e652c6a043fc3fd3bbe07
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905925
Commit-Ready: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | common/tpm_registers.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index fab6616f54..06eb7ee638 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -768,6 +768,13 @@ int tpm_reset_request(int wait_until_done, int wipe_nvmem_first) /* We can't change our minds about wiping. */ wipe_requested |= wipe_nvmem_first; + if (wait_until_done) + /* + * Completion could take a while, if other things have + * higher priority. + */ + waiting_for_reset = task_get_current(); + /* Ask the TPM task to reset itself */ task_set_event(TASK_ID_TPM, TPM_EVENT_RESET, 0); @@ -775,11 +782,11 @@ int tpm_reset_request(int wait_until_done, int wipe_nvmem_first) return EC_SUCCESS; if (in_interrupt_context() || - task_get_current() == TASK_ID_TPM) + task_get_current() == TASK_ID_TPM) { + waiting_for_reset = TASK_ID_INVALID; return EC_ERROR_BUSY; /* Can't sleep. Clown'll eat me. */ + } - /* Completion could take a while, if other things have priority */ - waiting_for_reset = task_get_current(); evt = task_wait_event_mask(TPM_EVENT_RESET, 5 * SECOND); /* We were notified of completion */ |