Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tpm: do not suspend/resume if power stays on

The suspend/resume behavior of the TPM can be controlled by setting
"powered-while-suspended" in the DTS. This is useful for the cases
when hardware does not power-off the TPM.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>

authored by

Enric Balletbo i Serra and committed by
James Morris
b5d0ebc9 28707bf2

+7
+3
drivers/char/tpm/tpm-interface.c
··· 1119 1119 if (chip == NULL) 1120 1120 return -ENODEV; 1121 1121 1122 + if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) 1123 + return 0; 1124 + 1122 1125 if (chip->flags & TPM_CHIP_FLAG_TPM2) { 1123 1126 tpm2_shutdown(chip, TPM2_SU_STATE); 1124 1127 return 0;
+1
drivers/char/tpm/tpm.h
··· 174 174 TPM_CHIP_FLAG_IRQ = BIT(2), 175 175 TPM_CHIP_FLAG_VIRTUAL = BIT(3), 176 176 TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), 177 + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), 177 178 }; 178 179 179 180 struct tpm_bios_log {
+3
drivers/char/tpm/tpm_of.c
··· 36 36 else 37 37 return -ENODEV; 38 38 39 + if (of_property_read_bool(np, "powered-while-suspended")) 40 + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; 41 + 39 42 sizep = of_get_property(np, "linux,sml-size", NULL); 40 43 basep = of_get_property(np, "linux,sml-base", NULL); 41 44 if (sizep == NULL && basep == NULL)