diff options
| author | Olivier Cochard <olivier@FreeBSD.org> | 2026-06-26 19:20:30 +0000 |
|---|---|---|
| committer | Olivier Cochard <olivier@FreeBSD.org> | 2026-06-26 19:56:17 +0000 |
| commit | e4c50d86796d07cf90e6a683234e1c0e9ca5e03c (patch) | |
| tree | c704a2125fd32b3e5d9b0887a1a3bae68ac88921 | |
| parent | dcc684ddccd60d1079eefec06266de04641e319b (diff) | |
tpm_tis: release TPM resources after reading response
Per TIS 1.3 section 5.6.12, write commandReady to TPM_STS after reading the
response so the TPM can free its ReadFIFO and other internal resources.
The subsequent tpmtis_go_ready() provides the second write the spec describes
and waits for the state transition.
PR: 295103
Reported by: Benoit Sansoni <benoit.sansoni@gmail.com>
Reviewed by: kevans
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D57841
| -rw-r--r-- | sys/dev/tpm/tpm_tis_core.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/dev/tpm/tpm_tis_core.c b/sys/dev/tpm/tpm_tis_core.c index f49a1f982e82..95e914fa570b 100644 --- a/sys/dev/tpm/tpm_tis_core.c +++ b/sys/dev/tpm/tpm_tis_core.c @@ -474,6 +474,16 @@ tpmtis_transmit(device_t dev, struct tpm_priv *priv, size_t length) "Failed to read response\n"); return (EIO); } + + /* + * Per TIS 1.3 section 5.6.12, write commandReady after reading the + * response so the TPM can free the ReadFIFO and other internal + * resources. The next tpmtis_go_ready() provides the second + * write the spec mentions, and waits for the state transition, + * so no wait is needed here. + */ + TPM_WRITE_4(sc->dev, TPM_STS, TPM_STS_CMD_RDY); + TPM_WRITE_BARRIER(sc->dev, TPM_STS, 4); tpmtis_relinquish_locality(sc); priv->offset = 0; priv->len = bytes_available; |
