Page MenuHomeFreeBSD

tpm_tis: Restore validated interrupts after resume
AcceptedPublic

Authored by kbowling on Wed, Aug 26, 11:47 AM.
Tags
None
Referenced Files
F169370293: D59197.diff
Tue, Sep 1, 8:37 AM
F169342190: D59197.id.diff
Tue, Sep 1, 6:10 AM
Unknown Object (File)
Sun, Aug 30, 8:31 AM
Unknown Object (File)
Sun, Aug 30, 8:15 AM
Unknown Object (File)
Sun, Aug 30, 6:20 AM
Unknown Object (File)
Fri, Aug 28, 1:18 PM
Unknown Object (File)
Fri, Aug 28, 12:41 PM
Unknown Object (File)
Fri, Aug 28, 8:58 AM
Subscribers

Details

Summary
TIS interrupt routing and enable registers may lose their state across
S3, while the driver retains its software indication that interrupts
work.  A subsequent locality or command wait can then sleep for an
interrupt that cannot arrive.

Remember whether interrupts worked before suspend and restore the
vector, pending status, and enable mask before TPM2_Startup.  Put the
transport in polling mode first; the interrupt handler promotes it back
to interrupt waits only after observing an interrupt from the restored
configuration.  If register restoration fails, Startup and subsequent
commands continue using polling.

Preserve the initial interrupt-enable mask, including the firmware's
trigger and polarity selection proven by the attach-time interrupt test,
and restore that exact mask rather than accepting post-S3 defaults.

Program the same safe baseline for polling devices during attach and
resume.  Acquire locality, disable global interrupt delivery, and
acknowledge pending status so firmware cannot leave interrupts armed
without a handler.

Use the same register-programming helper during attach and resume, and
stop trying to configure interrupts after a locality acquisition
failure.

Three consecutive device suspend and resume cycles completed on a Lenovo
TPM2 FIFO device without an IRQ resource.  GetRandom succeeded after
each resume, and module detach completed without errors.

MFC after:      2 weeks

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped