Skip to contentSkip to conversation

tpm_tis: reserve chip for duration of tpm_tis_core_init

PATCH Superseded Jerry Snitselaar 3 participants 26 messages Dec 11, 2019 – Dec 27, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm_tis: reserve chip for duration of tpm_tis_core_init

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
---
 drivers/char/tpm/tpm_tis_core.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/char/tpm/tpm_tis_core.c +7 -10
index 8af2cee1a762..308756d278b3 100644
@@ -978,13 +978,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	if (wait_startup(chip, 0) != 0) {
 		rc = -ENODEV;
-		goto out_err;
+		goto out_start;
 	}
 
 	/* Take control of the TPM's interrupt hardware and shut it off */
 	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
 	if (rc < 0)
-		goto out_err;
+		goto out_start;
 
 	intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
@@ -993,9 +993,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	rc = tpm_chip_start(chip);
 	if (rc)
-		goto out_err;
+		goto out_start;
 	rc = tpm2_probe(chip);
-	tpm_chip_stop(chip);
 	if (rc)
 		goto out_err;
 
@@ -1059,7 +1058,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 			goto out_err;
 		}
 
-		tpm_chip_start(chip);
 		chip->flags |= TPM_CHIP_FLAG_IRQ;
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
@@ -1070,18 +1068,17 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
-		tpm_chip_stop(chip);
 	}
+	tpm_chip_stop(chip);
 
 	rc = tpm_chip_register(chip);
 	if (rc)
-		goto out_err;
-
-	if (chip->ops->clk_enable != NULL)
-		chip->ops->clk_enable(chip, false);
+		goto out_start;
 
 	return 0;
 out_err:
+	tpm_chip_stop(chip);
+out_start:
 	if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
 		chip->ops->clk_enable(chip, false);
 
Signature · 1 line
2.24.0
#1 lore raw
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 8 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>

Typo on the list address, do you want me to resend Jarkko?

Quoted 3 lines
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")

---

I did some initial testing with both a 1.2 device and a 2.0 device here. Christian, can you verify that this still solves your timeouts problem you were seeing? Dan, can you try this on the internal system with the interrupt issues? I will see if I can get the t490s owner to run it as well.

Thanks,
Jerry

#2 lore raw
Quoted 22 lines · Jerry Snitselaar
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 8 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>

Typo on the list address, do you want me to resend Jarkko?

Quoted 3 lines
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")

---

Quoted 5 lines

I did some initial testing with both a 1.2 device and a 2.0 device here. Christian, can you verify that this still solves your timeouts problem you were seeing? Dan, can you try this on the internal system with the interrupt issues? I will see if I can get the t490s owner to run it as well.

Will do. I assume you'd also want to add 'Fixes: 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")' if it works?

#3 lore raw
Quoted 23 lines · Dan Williams
Quoted 22 lines · Jerry Snitselaar
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 8 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>

Typo on the list address, do you want me to resend Jarkko?

Quoted 3 lines
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")

---

Quoted 9 lines
Quoted 5 lines

I did some initial testing with both a 1.2 device and a 2.0 device here. Christian, can you verify that this still solves your timeouts problem you were seeing? Dan, can you try this on the internal system with the interrupt issues? I will see if I can get the t490s owner to run it as well.

Will do. I assume you'd also want to add 'Fixes: 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")' if it works?

Yes. I'm not certain this deals with the interrupt issue though, so didn't want to stick it on there yet. I guess it should go on there anyways since it is replacing that code. I'll post a v2.

#4 lore raw

PATCH v2 1/1 tpm_tis: reserve chip for duration of tpm_tis_core_init

In reply to Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")

---
v2: Fix integrity list address and add 5b359c7c4372 to fixes

 drivers/char/tpm/tpm_tis_core.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/char/tpm/tpm_tis_core.c +7 -10
index 8af2cee1a762..308756d278b3 100644
@@ -978,13 +978,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	if (wait_startup(chip, 0) != 0) {
 		rc = -ENODEV;
-		goto out_err;
+		goto out_start;
 	}
 
 	/* Take control of the TPM's interrupt hardware and shut it off */
 	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
 	if (rc < 0)
-		goto out_err;
+		goto out_start;
 
 	intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
@@ -993,9 +993,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	rc = tpm_chip_start(chip);
 	if (rc)
-		goto out_err;
+		goto out_start;
 	rc = tpm2_probe(chip);
-	tpm_chip_stop(chip);
 	if (rc)
 		goto out_err;
 
@@ -1059,7 +1058,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 			goto out_err;
 		}
 
-		tpm_chip_start(chip);
 		chip->flags |= TPM_CHIP_FLAG_IRQ;
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
@@ -1070,18 +1068,17 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
-		tpm_chip_stop(chip);
 	}
+	tpm_chip_stop(chip);
 
 	rc = tpm_chip_register(chip);
 	if (rc)
-		goto out_err;
-
-	if (chip->ops->clk_enable != NULL)
-		chip->ops->clk_enable(chip, false);
+		goto out_start;
 
 	return 0;
 out_err:
+	tpm_chip_stop(chip);
+out_start:
 	if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
 		chip->ops->clk_enable(chip, false);
 
Signature · 1 line
2.24.0
#5 lore raw
Quoted 6 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 10 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")

Ugh, sorry, I guess this jinxed it. This patch does not address the IRQ storm on the platform I reported earlier.

#6 lore raw
Quoted 19 lines · Dan Williams
Quoted 6 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 10 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 2 lines

Ugh, sorry, I guess this jinxed it. This patch does not address the IRQ storm on the platform I reported earlier.

Are the reverts making their way upstream?

#25 lore raw
In reply to Jerry Snitselaar
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 10 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")

Sorry for the latency.

For me this looks good for putting to my rc3 PR with a minor twist:

1. Rename out_err as err_probe.
2. Rename out_start as err_start.

/Jarkko

#8 lore raw
In reply to Jerry Snitselaar
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

/Jarkko

#9 lore raw
Quoted 19 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...in your -rc3 pull?

#24 lore raw
In reply to Jarkko Sakkinen
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

Oops. Forgot to push please check now

git://git.infradead.org/users/jjs/linux-tpmdd.git master

/Jarkko

#7 lore raw
In reply to Dan Williams
Quoted 18 lines · Dan Williams
Quoted 17 lines · Dan Williams
Quoted 15 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 4 lines
Quoted 2 lines

Ugh, sorry, I guess this jinxed it. This patch does not address the IRQ storm on the platform I reported earlier.

Are the reverts making their way upstream?

Not yet.

Cannot randomly apply patches without answer to why. Given that some changes are already landed changes it would be better to create a patch based on reverts (in the sense of code change) and commit message what is going on.

/Jarkko

#10 lore raw
In reply to Dan Williams
Quoted 29 lines · Dan Williams
Quoted 19 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

Quoted 8 lines

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Quoted 4 lines

5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...in your -rc3 pull?

#11 lore raw
Quoted 36 lines · Jerry Snitselaar
Quoted 34 lines · Dan Williams
Quoted 19 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

#12 lore raw
Quoted 47 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,
Quoted 8 lines

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

#13 lore raw
Quoted 54 lines · Jarkko Sakkinen
Quoted 53 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Quoted 7 lines
Quoted 2 lines

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

Hi Jarkko, I'm waiting to hear back from the t490s user, but I imagine it still has the problem as well.

Christian, were you able to try this patch and verify it still resolves the issue you were having with the kernel failing to get the timeouts and durations from the tpm?

Thanks,
Jerry

#14 lore raw
Quoted 58 lines · Jerry Snitselaar
Quoted 57 lines · Jarkko Sakkinen
Quoted 55 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

Quoted 8 lines
Quoted 4 lines

What about T490S?

/Jarkko

Hi Jarkko, I'm waiting to hear back from the t490s user, but I imagine it still has the problem as well.

It appears he is out of the office until January, so I doubt I will hear anything back until then.

Quoted 6 lines

Christian, were you able to try this patch and verify it still resolves the issue you were having with the kernel failing to get the timeouts and durations from the tpm?

Thanks,
Jerry

#22 lore raw
In reply to Jarkko Sakkinen
Quoted 54 lines · Jarkko Sakkinen
Quoted 53 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Quoted 7 lines
Quoted 2 lines

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

I just heard back from the t490s user, and as expected the problem still exists there with this patch.

Regards,
Jerry

#16 lore raw
In reply to Jerry Snitselaar
Quoted 63 lines · Jerry Snitselaar
Quoted 54 lines · Jarkko Sakkinen
Quoted 53 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Quoted 7 lines
Quoted 2 lines

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

Quoted 6 lines

Hi Jarkko, I'm waiting to hear back from the t490s user, but I imagine it still has the problem as well.

Christian, were you able to try this patch and verify it still resolves the issue you were having with the kernel failing to get the timeouts and durations from the tpm?

Including those reverts would be a bogus change at this point.

The fix that I already applied obviously fixes an issue even if it does not fix all the issues.

/Jarkko

#23 lore raw
In reply to Jerry Snitselaar
Quoted 2 lines · Jerry Snitselaar

I just heard back from the t490s user, and as expected the problem still exists there with this patch.

OK. Now we have to reason what still is behaving incorrectly and create a proper fix. Is he available to test a subsequent fix?

Since the holidays are coming it might anyway take early Jan before we can test anything but we can still try to find the root cause by inspection.

/Jarkko

#15 lore raw
In reply to Jerry Snitselaar
Quoted 2 lines · Jerry Snitselaar

It appears he is out of the office until January, so I doubt I will hear anything back until then.

Unless we have access to a platform to sanely validate a fix before that, we will have to wait until January then.

/Jarkko

#17 lore raw
In reply to Jarkko Sakkinen
Quoted 65 lines · Jarkko Sakkinen
Quoted 63 lines · Jerry Snitselaar
Quoted 61 lines · Jarkko Sakkinen
Quoted 47 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,
Quoted 8 lines

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

Quoted 8 lines
Quoted 6 lines

Hi Jarkko, I'm waiting to hear back from the t490s user, but I imagine it still has the problem as well.

Christian, were you able to try this patch and verify it still resolves the issue you were having with the kernel failing to get the timeouts and durations from the tpm?

Including those reverts would be a bogus change at this point.

I'm failing to see how you arrived at that conclusion.

Quoted 2 lines

The fix that I already applied obviously fixes an issue even if it does not fix all the issues.

These patches take a usable system and make it unusable:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...they need to be reverted, or the regression needs to be fixed, but asserting that you fixed something else unrelated does not help.

#18 lore raw
Quoted 81 lines · Dan Williams
Quoted 65 lines · Jarkko Sakkinen
Quoted 63 lines · Jerry Snitselaar
Quoted 61 lines · Jarkko Sakkinen
Quoted 47 lines · Dan Williams
Quoted 34 lines · Jerry Snitselaar
Quoted 33 lines · Dan Williams
Quoted 18 lines · Jarkko Sakkinen
Quoted 5 lines · Jerry Snitselaar

Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.

Quoted 11 lines
Cc Christian Bundy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Peter Huewe <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Stefan Berger <[email protected]>
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
Fixes 5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")
Quoted 3 lines

I pushed to my master with minor tweaks and added my tags.

Please check before I put it to linux-next.

I don't see it yet here:

http://git.infradead.org/users/jjs/linux-tpmdd.git/shortlog/refs/heads/master

However, I wanted to make sure you captured that this does *not* fix the interrupt issue. I.e. make sure you remove the "Fixes:
5b359c7c4372 ("tpm_tis_core: Turn on the TPM before probing IRQ's")" tag.

Quoted 5 lines
Quoted 3 lines

With that said, are you going to include the revert of:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts

Dan, with the above reverted do you still get the screaming interrupt?

Yes, the screaming interrupt goes away, although it is replaced by these messages when the driver starts:

[    3.725131] tpm_tis IFX0740:00: 2.0 TPM (device-id 0x1B, rev-id 16)
[    3.725358] tpm tpm0: tpm_try_transmit: send(): error -5
[    3.725359] tpm tpm0: [Firmware Bug]: TPM interrupt not working,
Quoted 8 lines

polling instead

If the choice is "error message + polled-mode" vs "pinning a cpu with interrupts" I'd accept the former, but wanted Jarkko with his maintainer hat to weigh in.

Is there a simple sanity check I can run to see if the TPM is still operational in this state?

What about T490S?

/Jarkko

Quoted 8 lines
Quoted 6 lines

Hi Jarkko, I'm waiting to hear back from the t490s user, but I imagine it still has the problem as well.

Christian, were you able to try this patch and verify it still resolves the issue you were having with the kernel failing to get the timeouts and durations from the tpm?

Including those reverts would be a bogus change at this point.

I'm failing to see how you arrived at that conclusion.

Quoted 2 lines

The fix that I already applied obviously fixes an issue even if it does not fix all the issues.

Quoted 8 lines

These patches take a usable system and make it unusable:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...they need to be reverted, or the regression needs to be fixed, but asserting that you fixed something else unrelated does not help.

Reverting 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts") would at least allow people impacted by this to boot their systems without disabling the tpm, or blacklisting the module while we figure this out. From what I can tell the tpm_tis code was operating in that state since 570a36097f30 ("tpm: drop 'irq' from struct tpm_vendor_specific") until Stefan's patch.

Regards,
Jerry

#19 lore raw
Quoted 9 lines · Jerry Snitselaar
Quoted 8 lines

These patches take a usable system and make it unusable:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...they need to be reverted, or the regression needs to be fixed, but asserting that you fixed something else unrelated does not help.

Quoted 6 lines

Reverting 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts") would at least allow people impacted by this to boot their systems without disabling the tpm, or blacklisting the module while we figure this out. From what I can tell the tpm_tis code was operating in that state since 570a36097f30 ("tpm: drop 'irq' from struct tpm_vendor_specific") until Stefan's patch.

I'll formalize a fix based on the reverts.

Sorry for the holiday latency.

/Jarkko

#20 lore raw
Quoted 17 lines · Jarkko Sakkinen
Quoted 9 lines · Jerry Snitselaar
Quoted 8 lines

These patches take a usable system and make it unusable:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...they need to be reverted, or the regression needs to be fixed, but asserting that you fixed something else unrelated does not help.

Quoted 6 lines

Reverting 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts") would at least allow people impacted by this to boot their systems without disabling the tpm, or blacklisting the module while we figure this out. From what I can tell the tpm_tis code was operating in that state since 570a36097f30 ("tpm: drop 'irq' from struct tpm_vendor_specific") until Stefan's patch.

Quoted 3 lines

I'll formalize a fix based on the reverts.

Sorry for the holiday latency.

OK, have a branch now for the PR:

for-linus-v5.5-rc4

Note: now contains the first revert but I'll add another patch if required.

/Jarkko

#21 lore raw
Quoted 20 lines · Jarkko Sakkinen
Quoted 19 lines · Jarkko Sakkinen
Quoted 9 lines · Jerry Snitselaar
Quoted 8 lines

These patches take a usable system and make it unusable:

1ea32c83c699 tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts 5b359c7c4372 tpm_tis_core: Turn on the TPM before probing IRQ's

...they need to be reverted, or the regression needs to be fixed, but asserting that you fixed something else unrelated does not help.

Quoted 6 lines

Reverting 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts") would at least allow people impacted by this to boot their systems without disabling the tpm, or blacklisting the module while we figure this out. From what I can tell the tpm_tis code was operating in that state since 570a36097f30 ("tpm: drop 'irq' from struct tpm_vendor_specific") until Stefan's patch.

I'll formalize a fix based on the reverts.

Quoted 7 lines
Quoted 1 line

Sorry for the holiday latency.

OK, have a branch now for the PR:

for-linus-v5.5-rc4

Note: now contains the first revert but I'll add another patch if required.

Jerry, can you check this and send me revert to your earlier fix *if* required but first test with just this fix applied.

Thanks.

/Jarkko