From: David Smith <dds@google.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Kent Yoder <shpedoikal@gmail.com>,
Marcel Selhorst <tpm@selhorst.net>, Andrew Morton <akpm@osdl.org>,
TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH] - TPM save state before suspending to ram
Date: Sat, 5 Jan 2008 13:54:36 +0900 [thread overview]
Message-ID: <200801051354.37843.dds@google.com> (raw)
In-Reply-To: <20080104234413.GB800@elf.ucw.cz>
[-- Attachment #1.1: Type: text/plain, Size: 2167 bytes --]
> On Fri 2008-01-04 14:09:01, Kent Yoder wrote:
> > On Jan 4, 2008 10:39 AM, Pavel Machek <pavel@ucw.cz> wrote:
> > > On Thu 2008-01-03 21:44:15, Marcel Selhorst wrote:
> > > > Dear list,
> > > >
> > > > this patch fixes a bug, that prevents the TPM chip to resume
> > > > correctly from a suspended state.
> > > >
> > > > Signed-off-by: Marcel Selhorst <tpm@selhorst.net>
> >
> > [cut]
> >
> > > I'm not sure if we want to use variable-size array on stack. What
> > > hacks are you doing with max_t/max?
> > >
> > > Pavel
> >
> > Hi Pavel,
> >
> > Here's an alternate solution from David, signoffs pending --
> >
> > commit 058f1e3c4d4e2de5a7188608a1c2e0722498fd4b
> > Author: David Smith <davidsmith@acm.org>
> > Date: Fri Jan 4 03:33:11 2008 +0900
> >
> > Fix for TPM suspend/resume failure
> >
> > diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> > index 9bb5429..79d2fd5 100644
> > --- a/drivers/char/tpm/tpm.c
> > +++ b/drivers/char/tpm/tpm.c
> > @@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
> > }
> > EXPORT_SYMBOL_GPL(tpm_remove_hardware);
> >
> > -static u8 savestate[] = {
> > - 0, 193, /* TPM_TAG_RQU_COMMAND */
> > - 0, 0, 0, 10, /* blob length (in bytes) */
> > - 0, 0, 0, 152 /* TPM_ORD_SaveState */
> > -};
> > -
> > /*
> > * We are about to suspend. Save the TPM state
> > * so that it can be restored.
> > @@ -1059,8 +1053,14 @@ static u8 savestate[] = {
> > int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
> > {
> > struct tpm_chip *chip = dev_get_drvdata(dev);
> > + u8 savestate[] = {
> > + 0, 193, /* TPM_TAG_RQU_COMMAND */
> > + 0, 0, 0, 10, /* blob length (in bytes) */
> > + 0, 0, 0, 152 /* TPM_ORD_SaveState */
> > + };
> > +
> > if (chip == NULL)
> > - return -ENODEV;
> > + return -ENODEV;
> >
> > tpm_transmit(chip, savestate, sizeof(savestate));
> > return 0;
>
> Yep, but please fix the whitespace.
> Pavel
OK, attached.
--
man perl | tail -6 | head -2
[-- Attachment #1.2: tpm-suspend.patch --]
[-- Type: text/x-diff, Size: 1320 bytes --]
commit a17f28b93a6e11097ea806d576eb317263aa8768
Author: David Smith <dds@toriatama.tok.corp.google.com>
Date: Fri Jan 4 16:12:58 2008 +0900
Fix TPM suspend and resume failure.
The savestate command structure was being overwritten by the
result of running the TPM_SaveState command after one run, so
make it a local variable to the function instead of a global
variable that gets overwritten.
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 9bb5429..4f18ddf 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
}
EXPORT_SYMBOL_GPL(tpm_remove_hardware);
-static u8 savestate[] = {
- 0, 193, /* TPM_TAG_RQU_COMMAND */
- 0, 0, 0, 10, /* blob length (in bytes) */
- 0, 0, 0, 152 /* TPM_ORD_SaveState */
-};
-
/*
* We are about to suspend. Save the TPM state
* so that it can be restored.
@@ -1059,6 +1053,12 @@ static u8 savestate[] = {
int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
{
struct tpm_chip *chip = dev_get_drvdata(dev);
+ u8 savestate[] = {
+ 0, 193, /* TPM_TAG_RQU_COMMAND */
+ 0, 0, 0, 10, /* blob length (in bytes) */
+ 0, 0, 0, 152 /* TPM_ORD_SaveState */
+ };
+
if (chip == NULL)
return -ENODEV;
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 481 bytes --]
next prev parent reply other threads:[~2008-01-05 4:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 20:44 [PATCH] - TPM save state before suspending to ram Marcel Selhorst
2008-01-04 16:39 ` Pavel Machek
2008-01-04 20:09 ` [tpmdd-devel] " Kent Yoder
2008-01-04 23:29 ` Marcel Selhorst
2008-01-04 23:44 ` Pavel Machek
2008-01-05 4:54 ` David Smith [this message]
2008-01-14 21:40 ` Rafael J. Wysocki
2008-01-14 21:52 ` Andrew Morton
2008-01-14 22:09 ` Rafael J. Wysocki
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=200801051354.37843.dds@google.com \
--to=dds@google.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=shpedoikal@gmail.com \
--cc=tpm@selhorst.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.