* [PATCH] tpm: tpm_tis: add settle delay after releasing locality
@ 2026-06-15 4:48 Daniel Golle
2026-06-15 12:15 ` Jarkko Sakkinen
2026-06-15 12:17 ` Jarkko Sakkinen
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Golle @ 2026-06-15 4:48 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, Chen Jun,
linux-integrity, linux-kernel
tpm_tis_core_init() releases locality 0 then immediately reclaims it via
tpm_chip_start(); some TPMs (e.g. Nuvoton NPCT, TPM 2.0) need a few ms
before granting it again, so probe fails with -1. This back-to-back
release/request was added with the locality claim around TPM_INT_ENABLE.
Wait for the chip to settle after releasing the locality. A delay of
TPM_TIMEOUT (5 ms) in __tpm_tis_relinquish_locality() is reliable; values
below 3 ms are not.
Fixes: 0ef333f5ba7f ("tpm: add request_locality before write TPM_INT_ENABLE")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/char/tpm/tpm_tis_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 21d79ad3b164..6b90ff50c78d 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -171,6 +171,8 @@ static int __tpm_tis_relinquish_locality(struct tpm_tis_data *priv, int l)
{
tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
+ tpm_msleep(TPM_TIMEOUT);
+
return 0;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] tpm: tpm_tis: add settle delay after releasing locality
2026-06-15 4:48 [PATCH] tpm: tpm_tis: add settle delay after releasing locality Daniel Golle
@ 2026-06-15 12:15 ` Jarkko Sakkinen
2026-06-15 12:17 ` Jarkko Sakkinen
1 sibling, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2026-06-15 12:15 UTC (permalink / raw)
To: Daniel Golle
Cc: Peter Huewe, Jason Gunthorpe, Chen Jun, linux-integrity,
linux-kernel
On Mon, Jun 15, 2026 at 05:48:43AM +0100, Daniel Golle wrote:
> tpm_tis_core_init() releases locality 0 then immediately reclaims it via
> tpm_chip_start(); some TPMs (e.g. Nuvoton NPCT, TPM 2.0) need a few ms
> before granting it again, so probe fails with -1. This back-to-back
> release/request was added with the locality claim around TPM_INT_ENABLE.
>
> Wait for the chip to settle after releasing the locality. A delay of
> TPM_TIMEOUT (5 ms) in __tpm_tis_relinquish_locality() is reliable; values
> below 3 ms are not.
>
> Fixes: 0ef333f5ba7f ("tpm: add request_locality before write TPM_INT_ENABLE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> drivers/char/tpm/tpm_tis_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 21d79ad3b164..6b90ff50c78d 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -171,6 +171,8 @@ static int __tpm_tis_relinquish_locality(struct tpm_tis_data *priv, int l)
> {
> tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
>
> + tpm_msleep(TPM_TIMEOUT);
> +
> return 0;
> }
>
> --
> 2.54.0
>
I think this is totally fine.
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] tpm: tpm_tis: add settle delay after releasing locality
2026-06-15 4:48 [PATCH] tpm: tpm_tis: add settle delay after releasing locality Daniel Golle
2026-06-15 12:15 ` Jarkko Sakkinen
@ 2026-06-15 12:17 ` Jarkko Sakkinen
2026-06-15 12:50 ` Daniel Golle
1 sibling, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2026-06-15 12:17 UTC (permalink / raw)
To: Daniel Golle
Cc: Peter Huewe, Jason Gunthorpe, Chen Jun, linux-integrity,
linux-kernel
On Mon, Jun 15, 2026 at 05:48:43AM +0100, Daniel Golle wrote:
> tpm_tis_core_init() releases locality 0 then immediately reclaims it via
> tpm_chip_start(); some TPMs (e.g. Nuvoton NPCT, TPM 2.0) need a few ms
> before granting it again, so probe fails with -1. This back-to-back
> release/request was added with the locality claim around TPM_INT_ENABLE.
>
> Wait for the chip to settle after releasing the locality. A delay of
> TPM_TIMEOUT (5 ms) in __tpm_tis_relinquish_locality() is reliable; values
> below 3 ms are not.
>
> Fixes: 0ef333f5ba7f ("tpm: add request_locality before write TPM_INT_ENABLE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> drivers/char/tpm/tpm_tis_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 21d79ad3b164..6b90ff50c78d 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -171,6 +171,8 @@ static int __tpm_tis_relinquish_locality(struct tpm_tis_data *priv, int l)
> {
> tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
>
> + tpm_msleep(TPM_TIMEOUT);
> +
> return 0;
> }
>
> --
> 2.54.0
>
Can rebase to my for-next-tpm and resend v2?
BR, Jarkko
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] tpm: tpm_tis: add settle delay after releasing locality
2026-06-15 12:17 ` Jarkko Sakkinen
@ 2026-06-15 12:50 ` Daniel Golle
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Golle @ 2026-06-15 12:50 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: Peter Huewe, Jason Gunthorpe, Chen Jun, linux-integrity,
linux-kernel
On Mon, Jun 15, 2026 at 03:17:43PM +0300, Jarkko Sakkinen wrote:
> On Mon, Jun 15, 2026 at 05:48:43AM +0100, Daniel Golle wrote:
> > tpm_tis_core_init() releases locality 0 then immediately reclaims it via
> > tpm_chip_start(); some TPMs (e.g. Nuvoton NPCT, TPM 2.0) need a few ms
> > before granting it again, so probe fails with -1. This back-to-back
> > release/request was added with the locality claim around TPM_INT_ENABLE.
> >
> > Wait for the chip to settle after releasing the locality. A delay of
> > TPM_TIMEOUT (5 ms) in __tpm_tis_relinquish_locality() is reliable; values
> > below 3 ms are not.
> >
> > Fixes: 0ef333f5ba7f ("tpm: add request_locality before write TPM_INT_ENABLE")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
>
> Can rebase to my for-next-tpm and resend v2?
I figured the fix is already in place in your tree, added by
34bc0fabf166 ("tpm: tpm_tis: Add settle time for some TPMs")
device_id 0x00FE, vendor_id 0x1050 exactly matches my TPM as well,
so please drop my patch.
Sorry for the noise...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-15 12:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 4:48 [PATCH] tpm: tpm_tis: add settle delay after releasing locality Daniel Golle
2026-06-15 12:15 ` Jarkko Sakkinen
2026-06-15 12:17 ` Jarkko Sakkinen
2026-06-15 12:50 ` Daniel Golle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox