mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
79ca6f74da
The Atmel TPM 1.2 chips crash with error `tpm_try_transmit: send(): error -62` since kernel 4.14. It is observed from the kernel log after running `tpm_sealdata -z`. The error thrown from the command is as follows ``` $ tpm_sealdata -z Tspi_Key_LoadKey failed: 0x00001087 - layer=tddl, code=0087 (135), I/O error ``` The issue was reproduced with the following Atmel TPM chip: ``` $ tpm_version T0 TPM 1.2 Version Info: Chip Version: 1.2.66.1 Spec Level: 2 Errata Revision: 3 TPM Vendor ID: ATML TPM Version: 01010000 Manufacturer Info: 41544d4c ``` The root cause of the issue is due to the TPM calls to msleep() were replaced with usleep_range() [1], which reduces the actual timeout. Via experiments, it is observed that the original msleep(5) actually sleeps for 15ms. Because of a known timeout issue in Atmel TPM 1.2 chip, the shorter timeout than 15ms can cause the error described above. A few further changes in kernel 4.16 [2] and 4.18 [3, 4] further reduced the timeout to less than 1ms. With experiments, the problematic timeout in the latest kernel is the one for `wait_for_tpm_stat`. To fix it, the patch reverts the timeout of `wait_for_tpm_stat` to 15ms for all Atmel TPM 1.2 chips, but leave it untouched for Ateml TPM 2.0 chip, and chips from other vendors. As explained above, the chosen 15ms timeout is the actual timeout before this issue introduced, thus the old value is used here. Particularly, TPM_ATML_TIMEOUT_WAIT_STAT_MIN is set to 14700us, TPM_ATML_TIMEOUT_WAIT_STAT_MIN is set to 15000us according to the existing TPM_TIMEOUT_RANGE_US (300us). The fixed has been tested in the system with the affected Atmel chip with no issues observed after boot up. References: [1] |
||
---|---|---|
.. | ||
eventlog | ||
st33zp24 | ||
Kconfig | ||
Makefile | ||
tpm-chip.c | ||
tpm-dev-common.c | ||
tpm-dev.c | ||
tpm-dev.h | ||
tpm-interface.c | ||
tpm-sysfs.c | ||
tpm.h | ||
tpm1-cmd.c | ||
tpm2-cmd.c | ||
tpm2-space.c | ||
tpm_atmel.c | ||
tpm_atmel.h | ||
tpm_crb.c | ||
tpm_ftpm_tee.c | ||
tpm_ftpm_tee.h | ||
tpm_i2c_atmel.c | ||
tpm_i2c_infineon.c | ||
tpm_i2c_nuvoton.c | ||
tpm_ibmvtpm.c | ||
tpm_ibmvtpm.h | ||
tpm_infineon.c | ||
tpm_nsc.c | ||
tpm_ppi.c | ||
tpm_tis.c | ||
tpm_tis_core.c | ||
tpm_tis_core.h | ||
tpm_tis_i2c_cr50.c | ||
tpm_tis_spi.h | ||
tpm_tis_spi_cr50.c | ||
tpm_tis_spi_main.c | ||
tpm_tis_synquacer.c | ||
tpm_vtpm_proxy.c | ||
tpmrm-dev.c | ||
xen-tpmfront.c |