]> Gentwo Git Trees - linux/.git/commit
tpm: use a map for tpm2_calc_ordinal_duration()
authorJarkko Sakkinen <jarkko@kernel.org>
Thu, 18 Sep 2025 19:30:18 +0000 (22:30 +0300)
committerJarkko Sakkinen <jarkko@kernel.org>
Fri, 10 Oct 2025 05:21:45 +0000 (08:21 +0300)
commit207696b17f38e869e59889b44d395ab24bb678d3
treeae570eb47560cc138ffccfbc70245ab7bcf34f13
parent8a81236f2cb0882c7ea6c621ce357f7f3f601fe5
tpm: use a map for tpm2_calc_ordinal_duration()

The current shenanigans for duration calculation introduce too much
complexity for a trivial problem, and further the code is hard to patch and
maintain.

Address these issues with a flat look-up table, which is easy to understand
and patch. If leaf driver specific patching is required in future, it is
easy enough to make a copy of this table during driver initialization and
add the chip parameter back.

'chip->duration' is retained for TPM 1.x.

As the first entry for this new behavior address TCG spec update mentioned
in this issue:

https://github.com/raspberrypi/linux/issues/7054

Therefore, for TPM_SelfTest the duration is set to 3000 ms.

This does not categorize a as bug, given that this is introduced to the
spec after the feature was originally made.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm2-cmd.c
include/linux/tpm.h