From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
semenzato-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org
Subject: Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
Date: Tue, 17 Jan 2017 13:59:33 -0700 [thread overview]
Message-ID: <20170117205933.GA9604@obsidianresearch.com> (raw)
In-Reply-To: <20170117201336.GA140854@apronin>
On Tue, Jan 17, 2017 at 12:13:36PM -0800, Andrey Pronin wrote:
> > Is there some way we can have the TPM core do this without requiring
> > the driver to add a shutdown the struct driver?
> >
> > Maybe we could put something in chip->dev->driver? Not sure..
>
> I can play more with it. We can check in tpm_chip_register() if
> chip->dev->driver->shutdown is NULL, and, if so, set it to a default
> handler. Or, do register_reboot_notifier() instead, to avoid messing
> with struct device_driver from tpm-chip.c. Not sure if that's a
> consideration at alli - any reason not to mess with those structures?
I think ordering is important here, the TPM core has to do any
shutdown before the driver shutdown method. That restriction might
entirely preclude using a reboot_notifier.
> Whatever we do, we should allow the drivers to still send
> (vendor-specific) commands from their shutdown handlers.
A vendor specific command should be done via a new core TPM
mechanism. I really want to keep access drivers (eg i2c, lpc, spi,
etc) out of the buisness of *assuming* they are connected to any
specific chip.
So, the core should detect chip XYZ and then issue the required
vendor-specific command in some way.
The driver shutdown would be used to close the access interface in
some way.
> But, yes, setting a default handler through chip->dev->driver
> might just be good enough.
Probably the *best* thing would be to add shutdown to 'struct class'
in the driver core like suspend/resume?
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Andrey Pronin <apronin@chromium.org>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Marcel Selhorst <tpmdd@selhorst.net>,
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
semenzato@chromium.org, groeck@chromium.org
Subject: Re: [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown
Date: Tue, 17 Jan 2017 13:59:33 -0700 [thread overview]
Message-ID: <20170117205933.GA9604@obsidianresearch.com> (raw)
In-Reply-To: <20170117201336.GA140854@apronin>
On Tue, Jan 17, 2017 at 12:13:36PM -0800, Andrey Pronin wrote:
> > Is there some way we can have the TPM core do this without requiring
> > the driver to add a shutdown the struct driver?
> >
> > Maybe we could put something in chip->dev->driver? Not sure..
>
> I can play more with it. We can check in tpm_chip_register() if
> chip->dev->driver->shutdown is NULL, and, if so, set it to a default
> handler. Or, do register_reboot_notifier() instead, to avoid messing
> with struct device_driver from tpm-chip.c. Not sure if that's a
> consideration at alli - any reason not to mess with those structures?
I think ordering is important here, the TPM core has to do any
shutdown before the driver shutdown method. That restriction might
entirely preclude using a reboot_notifier.
> Whatever we do, we should allow the drivers to still send
> (vendor-specific) commands from their shutdown handlers.
A vendor specific command should be done via a new core TPM
mechanism. I really want to keep access drivers (eg i2c, lpc, spi,
etc) out of the buisness of *assuming* they are connected to any
specific chip.
So, the core should detect chip XYZ and then issue the required
vendor-specific command in some way.
The driver shutdown would be used to close the access interface in
some way.
> But, yes, setting a default handler through chip->dev->driver
> might just be good enough.
Probably the *best* thing would be to add shutdown to 'struct class'
in the driver core like suspend/resume?
Jason
next prev parent reply other threads:[~2017-01-17 20:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-14 0:09 [PATCH] tpm/tpm_i2c_infineon: ensure no ongoing commands on shutdown Andrey Pronin
2017-01-14 0:09 ` Andrey Pronin
[not found] ` <20170114000954.17728-1-apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2017-01-14 0:28 ` Jason Gunthorpe
2017-01-14 0:28 ` Jason Gunthorpe
2017-01-14 0:42 ` Andrey Pronin
2017-01-16 9:33 ` Jarkko Sakkinen
2017-01-25 18:59 ` [tpmdd-devel] " Jarkko Sakkinen
2017-01-16 16:19 ` Jason Gunthorpe
[not found] ` <20170116161919.GA20238-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 17:58 ` Andrey Pronin
2017-01-17 17:58 ` Andrey Pronin
2017-01-17 19:27 ` Jason Gunthorpe
2017-01-17 19:27 ` Jason Gunthorpe
[not found] ` <20170117192728.GF27528-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 20:13 ` Andrey Pronin
2017-01-17 20:13 ` Andrey Pronin
2017-01-17 20:59 ` Jason Gunthorpe [this message]
2017-01-17 20:59 ` Jason Gunthorpe
[not found] ` <20170117205933.GA9604-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-17 23:00 ` Andrey Pronin
2017-01-17 23:00 ` Andrey Pronin
2017-01-17 23:22 ` Jason Gunthorpe
2017-01-17 23:22 ` Jason Gunthorpe
[not found] ` <20170117232207.GA12127-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-23 20:02 ` Andrey Pronin
2017-01-23 20:02 ` Andrey Pronin
2017-01-23 20:16 ` [tpmdd-devel] " Andrey Pronin
2017-01-23 20:39 ` Jason Gunthorpe
2017-01-23 20:39 ` Jason Gunthorpe
2017-01-23 22:19 ` Andrey Pronin
2017-01-23 22:57 ` Jason Gunthorpe
2017-01-23 22:57 ` Jason Gunthorpe
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=20170117205933.GA9604@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=semenzato-F7+t8E8rja9g9hUCZPvPmw@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 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.