[PATCH v3 0/2] tpm: add support for nonblocking operation
From: Tadeusz Struk
Date: Tue Jun 12 2018 - 13:58:32 EST
The TCG SAPI specification  defines a set of functions, which allows
applications to use the TPM device in either blocking or non-blocking fashion.
Each command defined by the specification has a corresponding
Tss2_Sys_<COMMAND>_Prepare() and Tss2_Sys_<COMMAND>_Complete() call, which
together with Tss2_Sys_ExecuteAsync() is designed to allow asynchronous
mode of operation. Currently the TPM driver supports only blocking calls,
which doesn't allow asynchronous IO operations.
This patch changes it and adds support for nonblocking write and a new poll
function to enable applications, which want to take advantage of this feature.
The new functionality can be tested using standard TPM tools implemented
in , together with modified TCTI from .
Changes in v3:
- Fixed problem reported by 0-dey kbuild test robot around __exitcall.
It complained because there is a module_exit() in another file already.
Changes in v2:
- Split the change into two separate patches. First patch adds a pointer
to the space to the struct file_priv to have access to it from the async job.
This is to avoid memory allocations on every write call. Now everything
what's needed is in the file_priv struct.
- Renamed the 'work' member of the timer to avoid confusion.
Now there are 'timeout_work' and 'async_work'.
- Removed the global wait queue and moved it to file_priv.
- Only creating the work queue when the first file is opened.
Tadeusz Struk (2):
tpm: add ptr to the tpm_space struct to file_priv
tpm: add support for nonblocking operation
drivers/char/tpm/tpm-dev-common.c | 150 +++++++++++++++++++++++++++----------
drivers/char/tpm/tpm-dev.c | 22 +++--
drivers/char/tpm/tpm-dev.h | 19 +++--
drivers/char/tpm/tpm-interface.c | 1
drivers/char/tpm/tpm.h | 1
drivers/char/tpm/tpmrm-dev.c | 31 ++++----
6 files changed, 152 insertions(+), 72 deletions(-)