HomeFreeBSD

tpm: Remove Giant from the TPM 1.2 driver

Description

tpm: Remove Giant from the TPM 1.2 driver

Serialize TPM 1.2 commands, character-device methods, and power
transitions with an sx lock, following the command ownership model used
by the TPM 2.0 driver. Reject new operations once detach starts and
drain the character device before releasing transport resources.

Giant also closed the interrupt race between the final TIS status check
and tsleep. Replace that implicit dependency with a mutex and condition
variable, use an absolute deadline across unrelated wakeups, and make
the interrupt handler MPSAFE.

Create the device node atomically with its softc and finish failed write
transactions so every command path releases its transport state.

The polling path was validated on ThinkPad T430 and T440p systems with
their STMicro TPM 1.2 devices enabled. Exclusive-open behavior, 100
consecutive PCR reads, and module unload and reload completed without
errors on both systems. Two consecutive S3 cycles on each system
preserved PCR values and command access, including another 100 PCR reads
after resume, without lock or TPM diagnostics.

Reviewed by: kevans, seuros
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59211

(cherry picked from commit 799e14aa60d81aa9eed1985e4683e12f6851ecfd)

Details

Provenance
Kevin Bowling <kbowling@FreeBSD.org>Authored on Aug 27 2026, 11:51 AM
Reviewer
kevans
Differential Revision
D59211: tpm: Remove Giant from the TPM 1.2 driver
Parents
rG74f94f11dd69: tpm: Restore TPM 1.2 TIS state after resume
Branches
Unknown
Tags
Unknown

Event Timeline