linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Yoder <key@linux.vnet.ibm.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Kent Yoder <key@linux.vnet.ibm.com>,
	Peter.Huewe@infineon.com, linux-kernel@vger.kernel.org,
	tpmdd-devel@lists.sourceforge.net
Subject: Re: [tpmdd-devel] [PATCH] TPM: Issue TPM_STARTUP at driver load if the TPM has not been started
Date: Thu, 4 Oct 2012 12:41:15 -0500	[thread overview]
Message-ID: <20121004174114.GA6520@ennui.austin.ibm.com> (raw)
In-Reply-To: <20121001173908.GA22342@obsidianresearch.com>

> Curiously the current code does call TPM_SaveState on suspend, but
> relies on the BIOS to do TPM_Startup(ST_STATE) on resume, why the
> asymmetry?

  This is based on the PC Client Implementation for BIOS spec in the
TCG. On suspend, the OS is responsible for the save state and then on
resume the BIOS should call startup.

> Anyhow, I think the thing would be something like this. I have no
> means to test TPM suspend, so I'll just post this as a note here. It
> will apply over v2 of my patch.
> 
> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> index b13ad77..7a8136a 100644
> --- a/drivers/char/tpm/tpm.c
> +++ b/drivers/char/tpm/tpm.c
> @@ -1336,10 +1336,23 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
>  int tpm_pm_resume(struct device *dev)
>  {
>         struct tpm_chip *chip = dev_get_drvdata(dev);
> +       struct tpm_cmd_t tpm_cmd;
> 
>         if (chip == NULL)
>                 return -ENODEV;
> 
> +       tpm_cmd.header.in = tpm_getcap_header;
> +       tpm_cmd.params.getcap_in.cap = TPM_CAP_PROP;
> +       tpm_cmd.params.getcap_in.subcap_size = cpu_to_be32(4);
> +       tpm_cmd.params.getcap_in.subcap = TPM_CAP_PROP_TIS_TIMEOUT;
> +       rc = transmit_cmd(chip, &tpm_cmd, TPM_INTERNAL_RESULT_SIZE, 0);
> +       if (rc == TPM_ERR_INVALID_POSTINIT) {
> +               /* The BIOS did not restart the TPM, execute a startup
> +                  command. */
> +               dev_info(chip->dev, "Issuing TPM_STARTUP");
> +               tpm_startup(chip, TPM_ST_STATE);
> +       }
> +

  I'd rather see us just track the state and do the right thing here. If
we don't get invalid postinit if we call tpm_startup during
tpm_tis_init/tpm_tis_i2c_init, then set a flag we switch on here.

  Peter, you mentioned you have some embedded setups, would you be able
to test?

Thanks,
Kent

>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(tpm_pm_resume);
> 
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


  reply	other threads:[~2012-10-04 17:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-30 23:30 [PATCH] TPM: Issue TPM_STARTUP at driver load if the TPM has not been started Jason Gunthorpe
2012-10-01  9:17 ` [tpmdd-devel] " Peter.Huewe
2012-10-01 16:15   ` Jason Gunthorpe
2012-10-01 17:10     ` Kent Yoder
2012-10-01 17:39       ` Jason Gunthorpe
2012-10-04 17:41         ` Kent Yoder [this message]
2012-10-04 18:02           ` Jason Gunthorpe
2012-10-08  7:09           ` Peter.Huewe
2012-11-21  7:10             ` [PATCH resend] " Jason Gunthorpe
2012-11-21  8:59               ` Peter.Huewe
2012-11-21 17:29                 ` Jason Gunthorpe
2012-11-21 17:37                   ` Peter.Huewe
2012-11-21 18:37                     ` [PATCH v4] " Jason Gunthorpe
2012-11-21 20:17                       ` Peter Hüwe
2012-11-21 20:12                         ` Jason Gunthorpe
2012-11-21 20:54                         ` [PATCH v5] " Jason Gunthorpe
2012-11-26 20:08                           ` Kent Yoder
2012-10-01 15:14 ` [PATCH] " Kent Yoder
     [not found] <4347_1349050738_q910IviQ005340_20120930233012.GH30637@obsidianresearch.com>
2012-10-01 12:57 ` [tpmdd-devel] " Jonathan McCune
2012-10-01 15:15   ` Peter.Huewe

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=20121004174114.GA6520@ennui.austin.ibm.com \
    --to=key@linux.vnet.ibm.com \
    --cc=Peter.Huewe@infineon.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).