Skip to contentSkip to conversation

FAILED: patch "[PATCH] tpm: self test failure should not cause suspend to fail" failed to apply to 4.4-stable tree

PATCH [email protected] 2 participants 5 messages Apr 20, 2018 – May 1, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 0803d7befa15cab5717d667a97a66214d2a4c083 Mon Sep 17 00:00:00 2001

From: Chris Chiu <[email protected]>
Date: Tue, 20 Mar 2018 15:36:40 +0800
Subject: [PATCH] tpm: self test failure should not cause suspend to fail

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) occurred 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
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 -0
index 47aacecdc85c..22288ff70a0b 100644
@@ -1002,6 +1002,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)
 	 */
#1 lore raw
Quoted 9 lines · On Fri, Apr 20, 2018 at 06:19:30PM +0200, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

I applied this on top of v4.4.99 with "git am -3" without conflicts.

/Jarkko

author maintainer
#2 lore raw
Quoted 7 lines · Jarkko Sakkinen
Quoted 6 lines · On Fri, Apr 20, 2018 at 06:19:30PM +0200, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 5 lines
Quoted 3 lines

thanks,

greg k-h

I applied this on top of v4.4.99 with "git am -3" without conflicts.

I don't use git am until I apply the patch itself, I rely on patch to get things right to start with. I'll try this in a few days to see if I can force it...

thanks,

greg k-h

author maintainer
#3 lore raw
Quoted 10 lines · Greg KH
Quoted 9 lines · Jarkko Sakkinen
Quoted 8 lines · On Fri, Apr 20, 2018 at 06:19:30PM +0200, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

greg k-h

I applied this on top of v4.4.99 with "git am -3" without conflicts.

I don't use git am until I apply the patch itself, I rely on patch to get things right to start with. I'll try this in a few days to see if I can force it...

Ah, I remember what happened here. It applies just fine to 4.4.y and 4.9.y, but the build is then broken. The code needs to change for those kernels if you want that patch applied.

If so, can you please provide a working backport?

thanks,

greg k-h

#4 lore raw
Quoted 23 lines · Greg KH
Quoted 10 lines · Greg KH
Quoted 9 lines · Jarkko Sakkinen
Quoted 8 lines · On Fri, Apr 20, 2018 at 06:19:30PM +0200, [email protected] wrote:

The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

greg k-h

I applied this on top of v4.4.99 with "git am -3" without conflicts.

I don't use git am until I apply the patch itself, I rely on patch to get things right to start with. I'll try this in a few days to see if I can force it...

Ah, I remember what happened here. It applies just fine to 4.4.y and 4.9.y, but the build is then broken. The code needs to change for those kernels if you want that patch applied.

Quoted 5 lines

If so, can you please provide a working backport?

thanks,

greg k-h

Yes, sure, I can do that!

/Jarkko