Skip to content

Commit 2020ee7

Browse files
committed
tpm, tpm_tis: Claim locality when interrupts are reenabled on resume
JIRA: https://issues.redhat.com/browse/RHEL-72765 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 955df4f Author: Lino Sanfilippo <l.sanfilippo@kunbus.com> Date: Thu Nov 24 14:55:36 2022 +0100 tpm, tpm_tis: Claim locality when interrupts are reenabled on resume In tpm_tis_resume() make sure that the locality has been claimed when tpm_tis_reenable_interrupts() is called. Otherwise the writings to the register might not have any effect. Fixes: 45baa1d ("tpm_tis: Re-enable interrupts upon (S3) resume") Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Tested-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
1 parent d384ff9 commit 2020ee7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/char/tpm/tpm_tis_core.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,28 +1212,27 @@ int tpm_tis_resume(struct device *dev)
12121212
struct tpm_chip *chip = dev_get_drvdata(dev);
12131213
int ret;
12141214

1215+
ret = tpm_tis_request_locality(chip, 0);
1216+
if (ret < 0)
1217+
return ret;
1218+
12151219
if (chip->flags & TPM_CHIP_FLAG_IRQ)
12161220
tpm_tis_reenable_interrupts(chip);
12171221

12181222
ret = tpm_pm_resume(dev);
12191223
if (ret)
1220-
return ret;
1224+
goto out;
12211225

12221226
/*
12231227
* TPM 1.2 requires self-test on resume. This function actually returns
12241228
* an error code but for unknown reason it isn't handled.
12251229
*/
1226-
if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
1227-
ret = tpm_tis_request_locality(chip, 0);
1228-
if (ret < 0)
1229-
return ret;
1230-
1230+
if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
12311231
tpm1_do_selftest(chip);
1232+
out:
1233+
tpm_tis_relinquish_locality(chip, 0);
12321234

1233-
tpm_tis_relinquish_locality(chip, 0);
1234-
}
1235-
1236-
return 0;
1235+
return ret;
12371236
}
12381237
EXPORT_SYMBOL_GPL(tpm_tis_resume);
12391238
#endif

0 commit comments

Comments
 (0)