From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Ashley Lai <ashley@ashleylai.com>,
Marcel Selhorst <tpmdd@selhorst.net>,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
josh.triplett@intel.com, christophe.ricard@gmail.com,
jason.gunthorpe@obsidianresearch.com
Subject: Re: [PATCH v5 7/7] tpm: create TPM 2.0 devices using own device class
Date: Tue, 04 Nov 2014 13:47:34 +0200 [thread overview]
Message-ID: <1415101654.4115.22.camel@linux.intel.com> (raw)
In-Reply-To: <20141103213826.GG8303@obsidianresearch.com>
On Mon, 2014-11-03 at 14:38 -0700, Jason Gunthorpe wrote:
> On Mon, Nov 03, 2014 at 07:41:01AM +0200, Jarkko Sakkinen wrote:
>
> > I used the class 'tpm' only for TPM 2.x because I didn't want to
> > break the binary compatibility for TPM 1.x anyway. In ideal situtation
> > both would be character devices inside the class 'tpm' and there would
> > be sysfs attribute such as 'family' to mark the protocol to be used.
>
> You can create the class without moving away from miscdev...
>
> Not having the device creates way to much difference that has to be
> supported, way too messy.
I have to admit that I'm not quite following here but I assume that
you restated this below in more verbose way and this is basically the
same argument :)
> > > And considering the volume of changes it might be better to leave
> > > 'dev' as a pointer to the tpm class rather than try and tackle that in
> > > this giant patch..
> >
> > Maybe, or maybe I could make the rename a separate patch?
>
> Pointer then rename?
>
> > It's fairly mechanical, just a matter of replacing string
> > "chip->dev" with "chip->pdev".
>
> Not everyone should be replaced :|
I think the current variable name "dev" is miss-leading. The
use of "pdev" would document better the appropriate use for that
field (i.e. for the most cases DON'T use it).
> > > > + chip->cdev.owner = chip->pdev->driver->owner;
> > >
> > > Is that right? the cdev fops is in this module, not the driver's
> > > module..
> >
> > tpm.ko defines the interface but TPM device driver module owns the
> > character device. I think this is right and similar logic is also
> > for example rtc_device_register().
>
> Hmm, yes, I see that in rtc_dev_prepare - but I don't have time to
> figure out why that might be :)
>
> On the surface, it doesn't seem to make sense: The cdev layer never
> calls into a function that goes to the chip module - all functions go
> to the fops in tpm.ko, and tmp.ko is (eventually) responsible for
> ensuring that ops never points to an unloaded module.
>
> So why should it care what the driver module is??
Fully agreed, I think you got a point here. I think it makes sense
as a guideline to kind of "centralize" robustness to tpm.ko and
leave as little responsibility as possible to device drivers.
> > I could understand in the context of a misc device but don't really
> > when TPM 2.0 devices have their own device class. Using a 'tpm' class
> > would in all cases break non-udev systems because major number is no
> > longer 10 (misc).
>
> I'm just saying it would be nice to force the major/minor to misc.tpm
> for tmp0.
>
> No idea if that is OK or not.
I think that would be a mess. The way things are done in this v5
patch set is actually quite coherent and it does not break backwards
compatibility because the "proper" device hierarchy is only used for
TPM 2.0 devices.
I think the improvement for v6 would be to add a sysctl attribute
to disable legacy device hierarchy and sysfs attributes. If that
attribute is unset, the old misc hierarchy would be used for any
TPM version and TPM 1.0 devices would use existing sysfs attributes.
If the flag is set, then the new proper device hierarchy would be
used for any TPM device and we would have also chance to redefine
sysfs attributes.
This would add some legacy clutter to the stack but would be a
piss-off-free and non-ABI-breaking solution.
> Jason
PS. I feel that drivers/char/tpm is a like a desolated town. How
many of the people currently marked as maintainers are actually
participating to the subsystem development let alone driving it?
This subsystem is increasingly important to us given that major
software platforms like Chrome OS make extensive use of it and
I've heard that even bug fixes have taken some times over a year
to get through. Does not look good at all.
/Jarkko
next prev parent reply other threads:[~2014-11-04 11:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-01 9:01 [PATCH v5 0/7] TPM 2.0 support Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 1/7] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 2/7] tpm: two-phase chip management functions Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 3/7] tpm: fix multiple race conditions in tpm_ppi.c Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 4/7] tpm: TPM 2.0 baseline support Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 5/7] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 6/7] tpm: TPM 2.0 FIFO Interface Jarkko Sakkinen
2014-11-01 9:01 ` [PATCH v5 7/7] tpm: create TPM 2.0 devices using own device class Jarkko Sakkinen
2014-11-02 21:33 ` Jason Gunthorpe
2014-11-03 5:41 ` Jarkko Sakkinen
2014-11-03 21:38 ` Jason Gunthorpe
2014-11-04 11:47 ` Jarkko Sakkinen [this message]
2014-11-04 12:05 ` Jarkko Sakkinen
2014-11-04 18:14 ` Jason Gunthorpe
2014-11-04 20:38 ` Jarkko Sakkinen
2014-11-04 20:49 ` Jason Gunthorpe
2014-11-04 23:00 ` Jarkko Sakkinen
2014-11-05 7:40 ` Jarkko Sakkinen
2014-11-05 17:48 ` Jason Gunthorpe
2014-11-06 8:58 ` Jarkko Sakkinen
2014-11-01 9:33 ` [PATCH v5 0/7] TPM 2.0 support 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=1415101654.4115.22.camel@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=ashley@ashleylai.com \
--cc=christophe.ricard@gmail.com \
--cc=jason.gunthorpe@obsidianresearch.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=josh.triplett@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=tpmdd@selhorst.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).