Skip to content

tpm: TEE driver for a discrete TPM owned by OP-TEE

Jorge Ramirez-Ortiz linux-integrity lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1tpm: add TEE driver for a discrete TPM behind OP-TEEMAINTAINERS drivers/char/tpm/Kconfig drivers/char/tpm/Makefile +1 more+307 -03 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] tpm: TEE driver for a discrete TPM owned by OP-TEE

This adds a TEE-bus driver for a *discrete* TPM2 that is owned by OP-TEE and exposed to the normal world through a passthrough pseudo TA. It binds the TA by UUID and relays raw TPM2 commands, presenting a standard tpm_chip, so the usual Linux TPM stack (IMA, trusted keys, tpm2-tools, the TSS) works through /dev/tpm0 unchanged.

== Why this is needed ==
The chip sits on a bus that only the secure world can reach -- e.g. a SPI SE whose controller is assigned to OP-TEE -- a deliberate hardening choice so the normal world cannot observe or interpose on TPM traffic, and the engine cannot be re-muxed to attack the chip. The normal world therefore has no path to the controller at all: there is no tpm_tis_spi for Linux to bind. OP-TEE drives the chip and this driver is the REE end of that channel.

== Relationship to tpm_ftpm_tee ==
The TEE transport shape mirrors the Microsoft fTPM driver's SUBMIT_COMMAND (memref[0] = command in, memref[1] = response in/out), but this is a distinct TA for a *real* chip, bound by its own UUID and opened with a REE-kernel login (TEE_IOCTL_LOGIN_REE_KERNEL) so user space and other TAs cannot submit raw TPM commands. Reusing the fTPM identity would conflate two different devices and collide on a platform that has both. The common transport could later be factored into a shared helper; that is left as a follow-up so it can be reviewed with the fTPM maintainer rather than in this bring-up.

== Device-tree coexistence (important) ==
On a platform where OP-TEE owns the SPI SE, the *entire* non-secure SPI controller node must be disabled in the kernel DT -- not just the tpm_tis_spi child. If the normal-world controller stays enabled it drives the same engine and corrupts OP-TEE's transfers. The Kconfig help spells this out.

== OP-TEE counterpart ==
The secure-world side (revert of the in-core TPM2 driver removal, a generic TCG PTP SPI (TIS) transport backend, and the passthrough PTA this driver talks to) is under review here:

https://github.com/OP-TEE/optee_os/pull/8155

== Testing ==
Exercised on a Qualcomm Lemans EVK with an ST discrete TPM on a QUP SPI SE owned by OP-TEE: the chip is detected and registered, and Linux drives it end to end -- TPM2 identity and PCR reads over /dev/tpm0 round-trip correctly. checkpatch --strict is clean and the module builds for arm64.

Jorge Ramirez-Ortiz (1):
tpm: add TEE driver for a discrete TPM behind OP-TEE

 MAINTAINERS                     |   6 +
 drivers/char/tpm/Kconfig        |  18 ++
 drivers/char/tpm/Makefile       |   1 +
 drivers/char/tpm/tpm_dtpm_tee.c | 282 ++++++++++++++++++++++++++++++++
 4 files changed, 307 insertions(+)
 create mode 100644 drivers/char/tpm/tpm_dtpm_tee.c

base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222

Signature · 1 line
2.55.0