Re: [RFC PATCH v4 1/8] tpm: Add a single table for all TPM wait limits
From: Surendran Kanagaraj
Date: Fri Nov 27 2026 - 17:24:05 EST
On Thu, Nov 26, 2026 at 09:02:24PM +0200, Jarkko Sakkinen wrote:
> On Wed, Nov 25, 2026 at 11:00:34PM +0000, Surendran Kanagaraj wrote:
> > 2) Keep the chip durations in a union of TPM1.x and TPM2.0 durations.
> >
> > union tpm_durations {
> > unsigned long tpm1[TPM1_NUM_DURATIONS];
> > struct tpm2_ordinal_duration tpm2[TPM2_NUM_DURATIONS];
> > };
> >
> > struct tpm_chip holds the union tpm_durations in place of
> > chip->duration[]
>
> It isn't possible to have single struct tpm duration that is partially
> used by TPM1?
Yes, that should work. Something like this:
struct tpm_cmd_duration {
/* TPM 2.0: command code or TPM 1.x: duration class */
u32 cmd;
u32 duration; /* msecs */
};
/* in struct tpm_chip, in place of chip->duration[] */
struct tpm_cmd_duration durations[TPM_MAX_DURATIONS];
eg:
/* TPM 1.x */
chip->durations[0] = { TPM_SHORT, 750 }
/* TPM 2.0 */
chip->durations[2] = { TPM2_CC_GET_RANDOM, 2000 }
Does this match what you had in mind?
Thanks,
Surendran