tpm: turn on TPM on suspend for TPM 1.x
Subsystems (3)
PATCH 1/1 tpm: turn on TPM on suspend for TPM 1.x
tpm_chip_start/stop() should be also called for TPM 1.x devices on suspend. Add that functionality back. Do not lock the chip because it is unnecessary as there are no multiple threads using it when doing the suspend.
--- drivers/char/tpm/tpm-interface.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm-interface.c +6 -8
@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev)if (chip->flags &TPM_CHIP_FLAG_ALWAYS_POWERED )return 0 ; -if (chip->flags &TPM_CHIP_FLAG_TPM2 ) { -mutex_lock (&chip->tpm_mutex); -if (!tpm_chip_start (chip)) { +if (!tpm_chip_start (chip)) { +if (chip->flags &TPM_CHIP_FLAG_TPM2 )tpm2_shutdown (chip,TPM2_SU_STATE ); -tpm_chip_stop (chip); - } -mutex_unlock (&chip->tpm_mutex); - }else { - rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); +else + rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); + +tpm_chip_stop (chip); }return rc;
Signature · 1 line
2.19.1
Quoted 28 lines · Jarkko Sakkinen
tpm_chip_start/stop() should be also called for TPM 1.x devices on suspend. Add that functionality back. Do not lock the chip because it is unnecessary as there are no multiple threads using it when doing the suspend.
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Paul Zimmerman <[email protected]>Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm-interface.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)drivers/char/tpm/tpm-interface.c +2
-5@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev)if (chip->flags &TPM_CHIP_FLAG_ALWAYS_POWERED )return 0 ; -if (chip->flags &TPM_CHIP_FLAG_TPM2 ) { -mutex_lock (&chip->tpm_mutex); -if (!tpm_chip_start (chip)) { +if (!tpm_chip_start (chip)) { +if (chip->flags &TPM_CHIP_FLAG_TPM2 )tpm2_shutdown (chip,TPM2_SU_STATE ); -tpm_chip_stop (chip); - }
drivers/char/tpm/tpm-interface.c int tpm_pm_suspend(struct device *dev) · line 414
Quoted 10 lines
drivers/char/tpm/tpm-interface.c +4
-3-mutex_unlock (&chip->tpm_mutex); - }else { - rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); +else + rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); + +tpm_chip_stop (chip); }return rc;
Signature · 1 line
3B10 0CA1 8674 ACBA B4FE FCD2 CE5B CF17 9960 DE13
Quoted 38 lines · Domenico Andreoli
Quoted 37 lines · Jarkko Sakkinen
tpm_chip_start/stop() should be also called for TPM 1.x devices on suspend. Add that functionality back. Do not lock the chip because it is unnecessary as there are no multiple threads using it when doing the suspend.
Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Paul Zimmerman <[email protected]>Signed-off-by Jarkko Sakkinen <[email protected]>--- drivers/char/tpm/tpm-interface.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)drivers/char/tpm/tpm-interface.c +6
-8@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev)if (chip->flags &TPM_CHIP_FLAG_ALWAYS_POWERED )return 0 ; -if (chip->flags &TPM_CHIP_FLAG_TPM2 ) { -mutex_lock (&chip->tpm_mutex); -if (!tpm_chip_start (chip)) { +if (!tpm_chip_start (chip)) { +if (chip->flags &TPM_CHIP_FLAG_TPM2 )tpm2_shutdown (chip,TPM2_SU_STATE ); -tpm_chip_stop (chip); - } -mutex_unlock (&chip->tpm_mutex); - }else { - rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); +else + rc =tpm1_pm_suspend (chip, tpm_suspend_pcr); + +tpm_chip_stop (chip); }
Quoted 3 lines
drivers/char/tpm/tpm-interface.c int tpm_pm_suspend(struct device *dev) · line 414
Quoted 1 line
drivers/char/tpm/tpm-interface.c +0
-0return rc;Tested-by Domenico Andreoli <[email protected]>
Thank you! I'll do a PR to James during the weekend.
/Jarkko