[PATCH v2] tpm: use a map for tpm2_calc_ordinal_duration()
Jarkko Sakkinen
jarkko at kernel.org
Thu Sep 18 19:37:24 UTC 2025
On Thu, Sep 18, 2025 at 10:30:18PM +0300, Jarkko Sakkinen wrote:
> 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.
>
> Cc: Frédéric Jouen <fjouen at sealsq.com>
> Signed-off-by: Jarkko Sakkinen <jarkko at kernel.org>
> ---
> v2:
> - Add the missing msec_to_jiffies() calls.
> - Drop redundant stuff.
Run also through kselftest.
BR, Jarkko
More information about the Linux-security-module-archive
mailing list