mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] tpm: Handle transient NitroTPM unavailability
@ 2026-09-23 14:28 Surendran Kanagaraj
  2026-09-23 14:28 ` [PATCH 1/2] tpm: Add per-chip timeout for transient unavailability Surendran Kanagaraj
  2026-09-23 14:28 ` [PATCH 2/2] tpm_crb: Raise timeouts for Amazon NitroTPM Surendran Kanagaraj
  0 siblings, 2 replies; 3+ messages in thread
From: Surendran Kanagaraj @ 2026-09-23 14:28 UTC (permalink / raw)
  To: Jarkko Sakkinen, Peter Huewe, Jason Gunthorpe
  Cc: linux-integrity, linux-kernel, nh-open-source, Alexander Graf,
	Gunnar Kudrjavets, Josh Levinson

TPM commands need to complete within the duration defined in the
TPM2 spec or keep answering TPM2_RC_RETRY for at most TPM2_DURATION_LONG
(2s).

Devices that have different timeout requirements than the TPM2 spec
can either exhaust the retry budget or delay the command completion.
NitroTPM can very rarely enter a mode where it either sends
TPM2_RC_RETRY for more than 2s or completes the command late.

When this happens in tpm2_load_null() during auth session start, the
driver sets TPM_CHIP_FLAG_DISABLE and fails all subsequent TPM requests.

    tpm tpm0: in retry loop
    tpm tpm0: tpm2_load_context: failed with a TPM error 0x0922

Add chip->busy_timeout_ms to support devices that have this
unavailability window (patch 1). It raises the TPM2_RC_RETRY budget and
the per command duration to at least that value. The CRB driver reads
the vendor ID from the interface ID register and sets 30s for
NitroTPM (patch 2)

Tested on an EC2 instance with NitroTPM by inducing unavailability
windows under HMAC session workloads, and in QEMU with swtpm by holding
the TPM in TPM2_RC_RETRY and stalling command completion past 2s.

Surendran Kanagaraj (2):
  tpm: Add per-chip timeout for transient unavailability
  tpm_crb: Raise timeouts for Amazon NitroTPM

 drivers/char/tpm/tpm-interface.c | 11 +++++--
 drivers/char/tpm/tpm.h           |  2 +-
 drivers/char/tpm/tpm2-cmd.c      | 17 +++++++---
 drivers/char/tpm/tpm_crb.c       | 54 ++++++++++++++++++++++++++++++++
 include/linux/tpm.h              |  7 +++++
 5 files changed, 82 insertions(+), 9 deletions(-)


base-commit: ab411db3c3b1fd0c70a36fb32c96b2c60175210b
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-23 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 14:28 [PATCH 0/2] tpm: Handle transient NitroTPM unavailability Surendran Kanagaraj
2026-09-23 14:28 ` [PATCH 1/2] tpm: Add per-chip timeout for transient unavailability Surendran Kanagaraj
2026-09-23 14:28 ` [PATCH 2/2] tpm_crb: Raise timeouts for Amazon NitroTPM Surendran Kanagaraj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®