Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Surendran Kanagaraj <surenkj@amazon.com>
To: <jarkko@kernel.org>
Cc: <corbet@lwn.net>, <graf@amazon.de>, <gunnarku@amazon.com>,
	<jgg@ziepe.ca>, <joshlev@amazon.com>, <leitao@debian.org>,
	<linux-doc@vger.kernel.org>, <linux-integrity@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <nh-open-source@amazon.com>,
	<noodles@earth.li>, <peterhuewe@gmx.de>, <rdunlap@infradead.org>,
	<skhan@linuxfoundation.org>
Subject: Re: [RFC PATCH v4 1/8] tpm: Add a single table for all TPM wait limits
Date: Wed, 25 Nov 2026 23:00:34 +0000	[thread overview]
Message-ID: <20261125230034.24726-1-surenkj@amazon.com> (raw)
In-Reply-To: <20261118073852.81107-2-surenkj@amazon.com>

Hi Jarkko,

On Wed, Nov 18, 2026 at 07:38:45AM +0000, Surendran Kanagaraj wrote:
> +static const u32 tpm2_defaults[TPM_NR_LIMITS] = {
> +	[TPM_LIMIT_A]		= TPM2_TIMEOUT_A * USEC_PER_MSEC,
> +	[TPM_LIMIT_B]		= TPM2_TIMEOUT_B * USEC_PER_MSEC,
> +	[TPM_LIMIT_C]		= TPM2_TIMEOUT_C * USEC_PER_MSEC,
> +	[TPM_LIMIT_D]		= TPM2_TIMEOUT_D * USEC_PER_MSEC,
> +
> +	[TPM_LIMIT_SHORT]	= 750 * USEC_PER_MSEC,
> +	[TPM_LIMIT_MEDIUM]	= 2000 * USEC_PER_MSEC,
> +	[TPM_LIMIT_LONG]	= 3000 * USEC_PER_MSEC,
> +	[TPM_LIMIT_LONG_LONG]	= TPM2_DURATION_LONG_LONG * USEC_PER_MSEC,
> +	[TPM_LIMIT_DEFAULT]	= TPM2_DURATION_DEFAULT * USEC_PER_MSEC,
> +};

The TPM2_SelfTest duration bump [1] made me realize that mapping the
TPM 2.0 durations into these TPM 1.x style classes may not hold up long
term. A spec update to a single command turns into a change that
affects all commands under the class. I think it is better to keep the
existing maps as they are and let the driver modify the map if needed.
This is also what you suggested in commit 207696b17f38 ("tpm: use a
map for tpm2_calc_ordinal_duration()"): keep a per-chip copy of the
map and let the leaf driver patch it.

At a high level, the series would become:

1) Set default interface timeouts and duration at chip allocation.
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[]
3) update_durations() now gets the union which TPM1.x and TPM2
   drivers can adjust.
4) Show the durations sysfs file for TPM 2.0 chips.

With this, I would drop the limits table, poll APIs and tpm.limits=
parameter for now and keep the series focused on duration handling.

Does this sound reasonable to you?

[1] https://lore.kernel.org/linux-integrity/20261125182251.19360-1-surenkj@amazon.com/

Thanks,
Surendran

  parent reply	other threads:[~2026-11-25 23:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  7:38 [RFC PATCH v4 0/8] tpm: Rework timeout and duration handling Surendran Kanagaraj
2026-11-18  7:38 ` [RFC PATCH v4 1/8] tpm: Add a single table for all TPM wait limits Surendran Kanagaraj
2026-11-20 12:19   ` Jarkko Sakkinen
2026-11-25 23:00   ` Surendran Kanagaraj [this message]
2026-11-26 19:02     ` Jarkko Sakkinen
2026-11-18  7:38 ` [RFC PATCH v4 2/8] tpm: Wire the timing setup to the limits table Surendran Kanagaraj
2026-11-18  7:38 ` [RFC PATCH v4 3/8] tpm: Take command durations from " Surendran Kanagaraj
2026-11-18  7:38 ` [RFC PATCH v4 4/8] tpm: Bound core and CRB waits by " Surendran Kanagaraj
2026-11-20 12:22   ` Jarkko Sakkinen
2026-11-24 20:49     ` Surendran Kanagaraj
2026-11-18  7:49 ` [RFC PATCH v4 5/8] tpm: Drop the jiffies timing fields from struct tpm_chip Surendran Kanagaraj
2026-11-18  7:49 ` [RFC PATCH v4 6/8] tpm: Add the tpm.limits= parameter Surendran Kanagaraj
2026-11-18  7:49 ` [RFC PATCH v4 7/8] tpm: Show timeouts and durations for TPM 2.0 chips Surendran Kanagaraj
2026-11-18  7:49 ` [RFC PATCH v4 8/8] tpm_crb: Raise the limits for Amazon NitroTPM Surendran Kanagaraj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125230034.24726-1-surenkj@amazon.com \
    --to=surenkj@amazon.com \
    --cc=corbet@lwn.net \
    --cc=graf@amazon.de \
    --cc=gunnarku@amazon.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=joshlev@amazon.com \
    --cc=leitao@debian.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nh-open-source@amazon.com \
    --cc=noodles@earth.li \
    --cc=peterhuewe@gmx.de \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox