Page MenuHomeFreeBSD

tpm: Restore TPM 1.2 TIS state after resume
AcceptedPublic

Authored by kbowling on Wed, Aug 26, 11:13 AM.

Details

Summary
Firmware restores the state saved by TPM_ORD_SaveState, but the TIS
interrupt, locality, and command FIFO state are not guaranteed to
survive S3.  The legacy driver previously treated resume as a no-op.

Revalidate the interface and device identity, disable and acknowledge
stale interrupts, restore the configured interrupt vector, reacquire
locality zero, and return the FIFO to command-ready state.  Also disable
TIS interrupts during initial setup when the device uses polling so
firmware settings cannot leave an unhandled interrupt enabled.

TIS 1.3 Table 22 makes the interrupt control registers locality
protected.  Acquire locality before disabling or programming them during
initial setup and resume rather than relying on probe retaining
locality.

Keep TPM self-test outside the resume critical path.  It can take a
while on some TPM 1.2 devices and is not required to restore the
transport state.

The two-commit suspend and resume series completed two consecutive S3
cycles on a ThinkPad T440p with its STMicro TPM 1.2 Security Chip
enabled.  PCR 0 was readable with the same value before and after each
cycle, and no SaveState or TIS restoration errors were logged.

The locality ordering completed another two consecutive S3 cycles on a
ThinkPad T430 with coreboot/EDK2 and TPM in polling mode.  PCR 0 again
remained stable, and TPM access recovered without errors after each resume.

PR:             291067
MFC after:      2 weeks

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped