From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: debora@linux.vnet.ibm.com, srajiv@linux.vnet.ibm.com,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: jirislaby@gmail.com, preining@logic.at,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: [patch 2/8] tpm_tis: Re-enable interrupts upon (S3) resume
Date: Tue, 15 Mar 2011 07:13:09 -0400 [thread overview]
Message-ID: <20110315111425.977309317@linux.vnet.ibm.com> (raw)
In-Reply-To: 20110315111307.895085413@linux.vnet.ibm.com
[-- Attachment #1: tpm_irq_fix.patch --]
[-- Type: text/plain, Size: 2408 bytes --]
v2:
- the patch was adapted to also work with a machine with a Intel iTPM
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 ]
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm_tis.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm_tis.c
+++ linux-2.6/drivers/char/tpm/tpm_tis.c
@@ -647,11 +647,36 @@ static int tpm_tis_pnp_suspend(struct pn
return tpm_pm_suspend(&dev->dev, msg);
}
+static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
+{
+ u32 intmask;
+
+ /* reenable interrupts that device may have lost or
+ BIOS/firmware may have disabled */
+ iowrite8(chip->vendor.irq, chip->vendor.iobase +
+ TPM_INT_VECTOR(chip->vendor.locality));
+
+ intmask =
+ ioread32(chip->vendor.iobase +
+ TPM_INT_ENABLE(chip->vendor.locality));
+
+ intmask |= TPM_INTF_CMD_READY_INT
+ | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
+ | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
+
+ iowrite32(intmask,
+ chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
+}
+
+
static int tpm_tis_pnp_resume(struct pnp_dev *dev)
{
struct tpm_chip *chip = pnp_get_drvdata(dev);
int ret;
+ if (chip->vendor.irq)
+ tpm_tis_reenable_interrupts(chip);
+
ret = tpm_pm_resume(&dev->dev);
if (!ret)
tpm_continue_selftest(chip);
@@ -704,6 +729,11 @@ static int tpm_tis_suspend(struct platfo
static int tpm_tis_resume(struct platform_device *dev)
{
+ struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
+
+ if (chip->vendor.irq)
+ tpm_tis_reenable_interrupts(chip);
+
return tpm_pm_resume(&dev->dev);
}
static struct platform_driver tis_drv = {
next prev parent reply other threads:[~2011-03-15 11:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-15 11:13 [patch 0/8] tpm + tpm_tis : Various fixes Stefan Berger
2011-03-15 11:13 ` [patch 1/8] tpm_tis: Use timeouts returned from TPM Stefan Berger
2011-03-29 14:34 ` Rajiv Andrade
2011-03-29 16:45 ` Stefan Berger
2011-03-15 11:13 ` Stefan Berger [this message]
2011-03-29 14:37 ` [patch 2/8] tpm_tis: Re-enable interrupts upon (S3) resume Rajiv Andrade
2011-03-29 15:14 ` Stefan Berger
2011-03-15 11:13 ` [patch 3/8] tpm: Fix display of data in pubek sysfs entry Stefan Berger
2011-03-15 11:13 ` [patch 4/8] tpm_tis: Delay ACPI S3 suspend while TPM is busy Stefan Berger
2011-03-15 11:13 ` [patch 5/8] tpm_tis: Fix the probing for interrupts Stefan Berger
2011-03-15 11:13 ` [patch 6/8] tpm + tpm_tis: Use interface timeouts returned from TPM Stefan Berger
2011-03-15 11:13 ` [patch 7/8] tpm_tis: Probing function for Intel iTPM bug Stefan Berger
2011-03-15 11:13 ` [patch 8/8] tpm: Fix a typo Stefan Berger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110315111425.977309317@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=debora@linux.vnet.ibm.com \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=preining@logic.at \
--cc=srajiv@linux.vnet.ibm.com \
--cc=tpmdd-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox