]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: replace msleep() with usleep_range() in TPM 1.2/2.0 generic drivers
authorHamza Attak <hamza@hpe.com>
Mon, 14 Aug 2017 18:09:16 +0000 (19:09 +0100)
committerJames Morris <james.l.morris@oracle.com>
Sun, 24 Sep 2017 04:51:00 +0000 (21:51 -0700)
commit1aa3a9b0b6db384685b54d8c711d98e5b926a52d
treef788e5570ade80f9cb8661330f6f9ff2f2e46e0a
parent0340451d4bdadd90fc483f5e57ecae93d111c403
tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers

The patch simply replaces all msleep function calls with usleep_range calls
in the generic drivers.

Tested with an Infineon TPM 1.2, using the generic tpm-tis module, for a
thousand PCR extends, we see results going from 1m57s unpatched to 40s
with the new patch. We obtain similar results when using the original and
patched tpm_infineon driver, which is also part of the patch.
Similarly with a STM TPM 2.0, using the CRB driver, it takes about 20ms per
extend unpatched and around 7ms with the new patch.

Note that the PCR consistency is untouched with this patch, each TPM has
been tested with 10 million extends and the aggregated PCR value is
continuously verified to be correct.

As an extension of this work, this could potentially and easily be applied
to other vendor's drivers. Still, these changes are not included in the
proposed patch as they are untested.

Signed-off-by: Hamza Attak <hamza@hpe.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>
Signed-off-by: James Morris <james.l.morris@oracle.com>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm2-cmd.c
drivers/char/tpm/tpm_infineon.c
drivers/char/tpm/tpm_tis_core.c