Re: [PATCH] tpm, tpm_tis: Acquire locality in tpm_tis_gen_interrupt() and tpm_get_timeouts()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 10, 2021 at 01:35:47PM +0200, Laurent Bigonville wrote:
> # dmesg |grep -i tpm
> 
> [   13.019986] tpm_tis 00:06: 1.2 TPM (device-id 0x6871, rev-id 1)
> [   15.016198] tpm tpm0: tpm_try_transmit: send(): error -62
> [   15.016208] tpm tpm0: A TPM error (-62) occurred attempting to determine
> the timeouts
> [   15.016239] tpm_tis: probe of 00:06 failed with error -62
> [   15.053255] tpm_inf_pnp 00:06: Found TPM with ID IFX0102

If possible, can you check what happens when you apply the attached patch.
I'm not proposing it as a bug fix but it just simplifies the flow a lot,
and might help to observe something.

/Jarkko
>From 0b0dfc48b47e44d547282b20f6d8c97103fadbe6 Mon Sep 17 00:00:00 2001
From: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
Date: Thu, 10 Jun 2021 15:24:49 +0300
Subject: [PATCH] tpm_tis: Use request_locality() before calling tpm2_probe()

Avoid unnecessary round-tripping in and out of the TIS driver by calling
request_locality() directly, instead of going through tpm_chip_start(), and
for the consistency sake (other sites in initialization code work this
way).

Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
---
 drivers/char/tpm/tpm_tis_core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 69579efb247b..3b5a03f9efce 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -980,13 +980,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
 	tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
 
-	rc = tpm_chip_start(chip);
-	if (rc)
+	rc = request_locality(chip, 0);
+	if (rc < 0)
 		goto out_err;
 	rc = tpm2_probe(chip);
-	tpm_chip_stop(chip);
-	if (rc)
-		goto out_err;
+	release_locality(chip, 0);
 
 	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
 	if (rc < 0)
-- 
2.31.1


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux