Skip to contentSkip to conversation

tpm: self test failure should not cause suspend to fail

PATCH Applied Daniel Drake 2 participants 3 messages Mar 20, 2018 – Mar 22, 2018

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

PATCH 1/1 tpm: self test failure should not cause suspend to fail

From: Chris Chiu <[email protected]>

The Acer Acer Veriton X4110G has a TPM device detected as:
tpm_tis 00:0b: 1.2 TPM (device-id 0xFE, rev-id 71)

After the first S3 suspend, the following error appears during resume:
tpm tpm0: A TPM error(38) occured continue selftest

Any following S3 suspend attempts will now fail with this error:
tpm tpm0: Error (38) sending savestate before suspend
PM: Device 00:0b failed to suspend: error 38

Error 38 is TPM_ERR_INVALID_POSTINIT which means the TPM is not in the correct state. This indicates that the platform BIOS is not sending the usual TPM_Startup command during S3 resume.

Quoted 1 line

From this point onwards, all TPM commands will fail.

The same issue was previously reported on Foxconn 6150BK8MC and Sony Vaio TX3.

The platform behaviour seems broken here, but we should not break suspend/resume because of this.

When the unexpected TPM state is encountered, set a flag to skip the affected TPM_SaveState command on later suspends.

---
 drivers/char/tpm/tpm-interface.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/char/tpm/tpm-interface.c +4 -0
index 9e80a953d693..248c04090dea 100644
@@ -969,6 +969,10 @@ int tpm_do_selftest(struct tpm_chip *chip)
 	loops = jiffies_to_msecs(duration) / delay_msec;
 
 	rc = tpm_continue_selftest(chip);
+	if (rc == TPM_ERR_INVALID_POSTINIT) {
+		chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED;
+		dev_info(&chip->dev, "TPM not ready (%d)\n", rc);
+	}
 	/* This may fail if there was no TPM driver during a suspend/resume
 	 * cycle; some may return 10 (BAD_ORDINAL), others 28 (FAILEDSELFTEST)
 	 */
Signature · 1 line
2.14.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Daniel Drake

From: Chris Chiu <[email protected]>

The Acer Acer Veriton X4110G has a TPM device detected as:
tpm_tis 00:0b: 1.2 TPM (device-id 0xFE, rev-id 71)

After the first S3 suspend, the following error appears during resume:
tpm tpm0: A TPM error(38) occured continue selftest

Any following S3 suspend attempts will now fail with this error:
tpm tpm0: Error (38) sending savestate before suspend
PM: Device 00:0b failed to suspend: error 38

Error 38 is TPM_ERR_INVALID_POSTINIT which means the TPM is not in the correct state. This indicates that the platform BIOS is not sending the usual TPM_Startup command during S3 resume. From this point onwards, all TPM commands will fail.

The same issue was previously reported on Foxconn 6150BK8MC and Sony Vaio TX3.

The platform behaviour seems broken here, but we should not break suspend/resume because of this.

When the unexpected TPM state is encountered, set a flag to skip the affected TPM_SaveState command on later suspends.

Quoted 6 lines

[email protected]

Thank you.

/Jarkko

#2 lore raw
Quoted 35 lines · Jarkko Sakkinen
Quoted 26 lines · Daniel Drake

From: Chris Chiu <[email protected]>

The Acer Acer Veriton X4110G has a TPM device detected as:
tpm_tis 00:0b: 1.2 TPM (device-id 0xFE, rev-id 71)

After the first S3 suspend, the following error appears during resume:
tpm tpm0: A TPM error(38) occured continue selftest

Any following S3 suspend attempts will now fail with this error:
tpm tpm0: Error (38) sending savestate before suspend
PM: Device 00:0b failed to suspend: error 38

Error 38 is TPM_ERR_INVALID_POSTINIT which means the TPM is not in the correct state. This indicates that the platform BIOS is not sending the usual TPM_Startup command during S3 resume. From this point onwards, all TPM commands will fail.

The same issue was previously reported on Foxconn 6150BK8MC and Sony Vaio TX3.

The platform behaviour seems broken here, but we should not break suspend/resume because of this.

When the unexpected TPM state is encountered, set a flag to skip the affected TPM_SaveState command on later suspends.

Quoted 7 lines

a2
[email protected]

Quoted 3 lines

Thank you.

Applied. I also added:

/Jarkko