Page MenuHomeFreeBSD

tpm: crb: check the error bit only after taking locality
ClosedPublic

Authored by olivier on Mon, Sep 14, 10:35 AM.
Tags
None
Referenced Files
F172523650: D59661.diff
Sat, Sep 19, 1:02 AM
Unknown Object (File)
Fri, Sep 18, 7:07 PM
Unknown Object (File)
Fri, Sep 18, 5:55 PM
Unknown Object (File)
Fri, Sep 18, 4:18 PM
Unknown Object (File)
Thu, Sep 17, 6:49 PM
Unknown Object (File)
Wed, Sep 16, 4:33 AM
Unknown Object (File)
Tue, Sep 15, 10:04 PM
Unknown Object (File)
Tue, Sep 15, 12:26 PM
Subscribers

Details

Summary

tpmcrb_transmit() read CRB_CTRL_STS before requesting locality 0. An AMD Pluton fTPM (FrameWork Desktop) using the plain CRB start method reads the control area as all-ones until locality is assigned, so bit 0 looks like a stuck tpmSts and every command failed with EIO.

With RANDOM_ENABLE_TPM the harvester retries every 10 seconds, so this printed "Device has Error bit set" forever.

Test Plan

Before:
"tpmcrb0: Device has Error bit set" every 10s, TPM unusable.

After: no messages in 20 minutes (3-4s expected before), and

tpm2_selftest --fulltest      -> rc=0
tpm2_getcap properties-fixed  -> TPM 2.0, rev 1.59
tpm2_pcrread sha256:0-7       -> all PCRs read
tpm2_getrandom --hex 32       -> distinct values per call

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olivier created this revision.

Seems to match spec as well, CRB control registers are allowed to return 00h or FFh if locality is not owned (https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2p0-v1p07_Pub.pdf Table 51)

This revision is now accepted and ready to land.Mon, Sep 14, 12:59 PM

Please set MFC to 2 weeks when you commit as I intend to pull the GENERIC change back to stable/15 in about a month barring major issues