]> asedeno.scripts.mit.edu Git - linux.git/commit
tpm2-cmd: allow more attempts for selftest execution
authorAlexander.Steffen@infineon.com <Alexander.Steffen@infineon.com>
Mon, 11 Dec 2017 16:05:25 +0000 (17:05 +0100)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 8 Jan 2018 10:58:37 +0000 (12:58 +0200)
commit0b66f2a05a8095f8b1dd30a156b971bf893cd1a9
tree5fae750a137b6c66a616eea4f65a6847938535ec
parent095531f891e627e408606f2da4008d3d53e6748a
tpm2-cmd: allow more attempts for selftest execution

Previously, if the last attempt to execute the selftest command failed with
RC_TESTING, there was still a call to tpm_msleep, even though no further
attempt would be made. This causes an unnecessary delay, therefore ensure
that if the last attempt fails the function is left immediately.

Also, instead of ensuring that the cumulated runtime of all attempts is
larger than the command duration for TPM2_SelfTest, ensure that there is at
least one attempt for which the delay is larger than the expected command
duration. This allows slow TPMs to execute all their tests in the
background, without slowing down faster TPMs that have finished their tests
earlier. If tests are still not finished even with this long delay, then
something is broken and the TPM is not used.

Fixes: 125a22105410 ("tpm: React correctly to RC_TESTING from TPM 2.0 self
tests")

Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm2-cmd.c