The branch main has been updated by olivier:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e4c50d86796d07cf90e6a683234e1c0e9ca5e03c

commit e4c50d86796d07cf90e6a683234e1c0e9ca5e03c
Author:     Olivier Cochard <[email protected]>
AuthorDate: 2026-06-26 19:20:30 +0000
Commit:     Olivier Cochard <[email protected]>
CommitDate: 2026-06-26 19:56:17 +0000

    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 <[email protected]>
    Reviewed by:    kevans
    Approved by:    kevans
    Differential Revision:  https://reviews.freebsd.org/D57841
---
 sys/dev/tpm/tpm_tis_core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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;

Reply via email to