tpm: support devices with synchronous send()
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 20 Jun 2025 13:08:08 +0000 (15:08 +0200)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 22 Jul 2025 23:23:18 +0000 (02:23 +0300)
commit04fe47015d7726b42c34615c124697c7a3537bf0
tree4bc35429810346caaa32cdcae8d0b4d3c5c5af21
parent07d8004d6fb95cbe48918e56012f16454cfdfe89
tpm: support devices with synchronous send()

Some devices do not support interrupts and provide a single synchronous
operation to send the command and receive the response on the same buffer.

Currently, these types of drivers must use an internal buffer where they
temporarily store the response between .send() and .recv() calls.

Introduce a new flag (TPM_CHIP_FLAG_SYNC) to support synchronous send().
If that flag is set by the driver, tpm_try_transmit() will use the send()
callback to send the command and receive the response on the same buffer
synchronously. In that case send() return the number of bytes of the
response on success, or -errno on failure.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Suggested-by: Jason Gunthorpe <jgg@ziepe.ca>
Suggested-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm-interface.c
include/linux/tpm.h