Skip to content

Commit 45baa1d

Browse files
stefanbergersrajiv
authored andcommitted
tpm_tis: Re-enable interrupts upon (S3) resume
This patch makes sure that if the TPM TIS interface is run in interrupt mode (rather than polling mode) that all interrupts are enabled in the TPM's interrupt enable register after a resume from ACPI S3 suspend. The registers may either have been cleared by the TPM loosing its state during device sleep or by the BIOS leaving the TPM in polling mode (after sending a command to the TPM for starting it up again) You may want to check if your TPM runs with interrupts by doing cat /proc/interrupts | grep -i tpm and see whether there is an entry or otherwise for it to use interrupts: modprobe tpm_tis interrupts=1 [add 'itpm=1' for Intel TPM ] v2: - the patch was adapted to work with the pnp and platform driver implementations in tpm_tis.c Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
1 parent 5a79444 commit 45baa1d

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎drivers/char/tpm/tpm_tis.c‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,36 @@ static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
649649
return tpm_pm_suspend(&dev->dev, msg);
650650
}
651651

652+
static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
653+
{
654+
u32 intmask;
655+
656+
/* reenable interrupts that device may have lost or
657+
BIOS/firmware may have disabled */
658+
iowrite8(chip->vendor.irq, chip->vendor.iobase +
659+
TPM_INT_VECTOR(chip->vendor.locality));
660+
661+
intmask =
662+
ioread32(chip->vendor.iobase +
663+
TPM_INT_ENABLE(chip->vendor.locality));
664+
665+
intmask |= TPM_INTF_CMD_READY_INT
666+
| TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
667+
| TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
668+
669+
iowrite32(intmask,
670+
chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
671+
}
672+
673+
652674
static int tpm_tis_pnp_resume(struct pnp_dev *dev)
653675
{
654676
struct tpm_chip *chip = pnp_get_drvdata(dev);
655677
int ret;
656678

679+
if (chip->vendor.irq)
680+
tpm_tis_reenable_interrupts(chip);
681+
657682
ret = tpm_pm_resume(&dev->dev);
658683
if (!ret)
659684
tpm_continue_selftest(chip);
@@ -706,6 +731,11 @@ static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg)
706731

707732
static int tpm_tis_resume(struct platform_device *dev)
708733
{
734+
struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
735+
736+
if (chip->vendor.irq)
737+
tpm_tis_reenable_interrupts(chip);
738+
709739
return tpm_pm_resume(&dev->dev);
710740
}
711741
static struct platform_driver tis_drv = {

0 commit comments

Comments
 (0)