Re: [RFC PATCH v4 1/8] tpm: Add a single table for all TPM wait limits

From: Surendran Kanagaraj

Date: Tue Dec 01 2026 - 10:36:55 EST


On Tue, Dec 01, 2026 at 02:41:11PM +0200, Jarkko Sakkinen wrote:
> On Tue, Dec 01, 2026 at 08:14:08AM +0000, Surendran Kanagaraj wrote:
> > On Sat, Nov 28, 2026 at 01:30:15AM +0200, Jarkko Sakkinen wrote:
> > > On Fri, Nov 27, 2026 at 10:23:47PM +0000, Surendran Kanagaraj wrote:
> > > > 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 }
> > >
> > > Hmm... in theory TPM 1.x commands could be "normalized" to have same
> > > format. Is that because of sysfs files?
> >
> > Yes partly. It's doable. I agree it would unify the format nicely. My
> > hesitation is that the per chip copy grows from 3 values to 123
> > entries just to match the format. Also the code paths which work with
> > duration class - sysfs (stable ABI), vendor overrides etc would need
> > additional logic. Would you prefer the normalized version?
>
> Memory consumption is not a concern here.

Ack. Thanks. will post the next version with this idea.

- Surendran