Hi Ilias, On Thu, 1 Jun 2023 at 00:21, Ilias Apalodimas <ilias.apalodi...@linaro.org> wrote: > > For a TPM device to be operational we need to initialize it and > perform its startup sequence. The 'tpm init' command currently calls > tpm_init() which ends up calling the ->open() per-device callback and > performs the initial hardware configuration as well as requesting > locality 0 for the caller. There no code that currently calls > tpm_init() without following up with a tpm_startup() and tpm_self_test_full() > or tpm_continue_self_test(). > > So let's add a 'tpm init' command and call tpm_auto_start() which > leaves the device in an operational state. > > It's worth noting that calling tpm_init() only, doesn't allow a someone > to use the TPM since the startup sequence is mandatory. We always > repeat the pattern of calling > - tpm_init() > - tpm_startup() > - tpm_self_test_full() or tpm_continue_self_test() > > Signed-off-by: Ilias Apalodimas <ilias.apalodi...@linaro.org> > --- > cmd/tpm-common.c | 16 ++++++++++++++++ > cmd/tpm-user-utils.h | 1 + > cmd/tpm-v1.c | 6 +++++- > cmd/tpm-v2.c | 6 ++++++ > 4 files changed, 28 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <s...@chromium.org> You could add a doc/ if you have time, at least for the new subcommand Regards, Simon