tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Josh Zimmerman <joshz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] tpm_tis: Issue a TPM2_Shutdown for TPM2 devices.
Date: Fri, 28 Apr 2017 15:39:05 -0600	[thread overview]
Message-ID: <20170428213905.GA19326@obsidianresearch.com> (raw)
In-Reply-To: <CAHSjozDRHbuHD6dPfTGMnF4j66hPV-_WiD22y5WRpawPFMQmfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Apr 28, 2017 at 02:32:31PM -0700, Josh Zimmerman wrote:
> On Fri, Apr 28, 2017 at 11:43 AM, Jason Gunthorpe
> <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > On Fri, Apr 28, 2017 at 11:27:16AM -0700, Josh Zimmerman wrote:
> >> It sounds like there are several intertwined issues here. I'd like to
> >> keep this patch relatively minimal, so here are my current thoughts on
> >> a path forward:
> >>
> >> * Refactor references to chip->ops to go through tpm_try_get_ops, as
> >> mentioned in the previous patch
> >
> > As I said, if you rely on the fact that sysfs does not exist for TPM2
> > then this should already be done for the TPM2 case and an incremental
> > later patch could solve this problem in sysfs to turn shutdown on for
> > tpm1. As long as this logic is clearly documented it is probably an OK
> > step for now.
> 
> This I'm not actually sure about: it seems that there are other places
> than sysfs where chip->ops is referenced without being guarded by
> tpm_try_get_ops. If we rely on just NULLing out chip->ops this could
> be dangerous.  I'll look at sending a patch for this first.

If that is the case then we have an existing bug..

The only other user entry point is via the cdev, and those call
try_get_ops around all calls down into the tpm code.

Everything coming in via the kapi must call tpm_chip_find_get, which
does try_get_ops.

> > I think the original patch got a bit stuck on exactly how to do this,
> > but yes, somehow the common shutdown method is called. Either from the
> > driver core (preferred, IHMO) or via patching every single TPM driver.
> 
> I think the original thread was leaning towards (and I agree with)
> moving it into the core. Just to make sure I'm understanding the code
> structure correctly, tpm-chip.c is part of that core and a reasonable
> place for shared functionality, correct?

Yes..

But I went I said driver core, I ment by adding tpm_class->shutdown
that is called by drivers/base/... 'or something like that'

The trouble is how to consistently get the machine shutdown callback
from the driver core.

Jason

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

  parent reply	other threads:[~2017-04-28 21:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 18:26 [PATCH] tpm_tis: Issue a TPM2_Shutdown for TPM2 devices Josh Zimmerman
     [not found] ` <20170427182659.403-1-joshz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2017-04-27 20:49   ` Jason Gunthorpe
     [not found]     ` <20170427204912.GA26330-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-28 12:24       ` Jarkko Sakkinen
2017-04-28 12:12   ` Jarkko Sakkinen
     [not found]     ` <20170428121226.7xnpfbxcjszrnz5d-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-28 15:27       ` Jason Gunthorpe
     [not found]         ` <20170428152748.GA32017-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-28 18:27           ` Josh Zimmerman
     [not found]             ` <CAHSjozC=1GgKazv5m19X6Oe321+mkMUFCfFBQ=_c7kPQ-WESDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-28 18:43               ` Jason Gunthorpe
     [not found]                 ` <20170428184325.GA15327-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-28 21:32                   ` Josh Zimmerman
     [not found]                     ` <CAHSjozDRHbuHD6dPfTGMnF4j66hPV-_WiD22y5WRpawPFMQmfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-28 21:39                       ` Jason Gunthorpe [this message]
     [not found]                         ` <20170428213905.GA19326-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-28 21:45                           ` Rafael J. Wysocki
     [not found]                             ` <CAJZ5v0iFkLfmeQgZyQDoKF42=RQw6q_GdK3fLgwdC9_mDbJKjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-28 22:16                               ` Jason Gunthorpe
     [not found]                                 ` <20170428221648.GA25935-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-28 23:30                                   ` Josh Zimmerman
2017-05-05 22:39                                   ` Josh Zimmerman
     [not found]                                     ` <CAHSjozCROVK=ca8tO+zNC+JD3a0+hQ-54AE7jGndrrs2nG1O1A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-05 22:46                                       ` Jason Gunthorpe
     [not found]                                         ` <20170505224629.GA15229-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 18:16                                           ` Josh Zimmerman
     [not found]                                             ` <CAHSjozCaWoQuQiWJ59_UyXnrnq=eh4sucLGgJ=0me6A0NHYsBA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-08 18:24                                               ` Jason Gunthorpe
     [not found]                                                 ` <20170508182415.GA32332-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-05-08 18:32                                                   ` Josh Zimmerman
2017-04-28 22:07                           ` Josh Zimmerman
     [not found]                             ` <CAHSjozA0-NVB1Nbr3DQ-2tsY3jVa6ADYUECfXjkNJWL3tfhWNA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-28 22:24                               ` Jason Gunthorpe
     [not found]                                 ` <20170428222439.GB25935-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-04-29 11:53                                   ` Jarkko Sakkinen
2017-04-29 11:52                           ` Jarkko Sakkinen
2017-04-29 11:48               ` Jarkko Sakkinen
2017-04-29 11:40           ` Jarkko Sakkinen
     [not found]             ` <20170429114013.67xwbv6xozarcieq-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-29 15:30               ` Jerry Snitselaar
2017-05-03 12:42                 ` Jarkko Sakkinen

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=20170428213905.GA19326@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=joshz-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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).