Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-28 Thread Jarkko Sakkinen
On Mon, Nov 27, 2017 at 08:02:55AM -0800, Guenter Roeck wrote:
> On Sun, Nov 26, 2017 at 03:56:41PM +0200, Jarkko Sakkinen wrote:
> > On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> > > On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> > > 
> > > > I'll split the patch into two parts, and only add (hopefully)
> > > > non-controversial tpm2 attributes for now (which I think is durations
> > > > and timeouts). Or, in other words, I'll split the attributes into
> > > > two groups - one generic and one for tpm1.
> > > 
> > > Ok. Please look at new attributes you wish to add for tpm2 and see if
> > > they meet the modern sysfs sensibility of one value per file, etc.
> > > 
> > > Jason
> > 
> > In general: if something can be retrieved through /dev/tpm0, there is no
> > any sane reason to have a sysfs attribute for such.
> > 
> 
> If I understand correctly, /dev/tpmX can be used to send any TPM command
> to the chip. Given that, I translate your statement to mean that no sysfs
> attribute will be accepted which sends a TPM command to the chip. This in
> turn means that there is no neded to protect sysfs attributes with a lock
> since any sysfs attribute requiring that lock will be rejected.
> 
> Thanks for the clarification. Please consider this patch abandoned.
> It might be worthwhile mentioning that restriction in the code though -
> the comment stating that TPM2 sysfs accesses are disabled due to lack
> of locking is obvioulsy incorrect.

Your statement about comment is correct. I guess we should rename the
file as tpm1_sysfs.c or tpm_legacy_sysfs.c.

It is not to say that new sysfs attributes would never make sense (like
in PPI case).

> Guenter

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-28 Thread Jarkko Sakkinen
On Mon, Nov 27, 2017 at 08:02:55AM -0800, Guenter Roeck wrote:
> On Sun, Nov 26, 2017 at 03:56:41PM +0200, Jarkko Sakkinen wrote:
> > On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> > > On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> > > 
> > > > I'll split the patch into two parts, and only add (hopefully)
> > > > non-controversial tpm2 attributes for now (which I think is durations
> > > > and timeouts). Or, in other words, I'll split the attributes into
> > > > two groups - one generic and one for tpm1.
> > > 
> > > Ok. Please look at new attributes you wish to add for tpm2 and see if
> > > they meet the modern sysfs sensibility of one value per file, etc.
> > > 
> > > Jason
> > 
> > In general: if something can be retrieved through /dev/tpm0, there is no
> > any sane reason to have a sysfs attribute for such.
> > 
> 
> If I understand correctly, /dev/tpmX can be used to send any TPM command
> to the chip. Given that, I translate your statement to mean that no sysfs
> attribute will be accepted which sends a TPM command to the chip. This in
> turn means that there is no neded to protect sysfs attributes with a lock
> since any sysfs attribute requiring that lock will be rejected.
> 
> Thanks for the clarification. Please consider this patch abandoned.
> It might be worthwhile mentioning that restriction in the code though -
> the comment stating that TPM2 sysfs accesses are disabled due to lack
> of locking is obvioulsy incorrect.

Your statement about comment is correct. I guess we should rename the
file as tpm1_sysfs.c or tpm_legacy_sysfs.c.

It is not to say that new sysfs attributes would never make sense (like
in PPI case).

> Guenter

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-27 Thread Guenter Roeck
On Sun, Nov 26, 2017 at 03:56:41PM +0200, Jarkko Sakkinen wrote:
> On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> > On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> > 
> > > I'll split the patch into two parts, and only add (hopefully)
> > > non-controversial tpm2 attributes for now (which I think is durations
> > > and timeouts). Or, in other words, I'll split the attributes into
> > > two groups - one generic and one for tpm1.
> > 
> > Ok. Please look at new attributes you wish to add for tpm2 and see if
> > they meet the modern sysfs sensibility of one value per file, etc.
> > 
> > Jason
> 
> In general: if something can be retrieved through /dev/tpm0, there is no
> any sane reason to have a sysfs attribute for such.
> 

If I understand correctly, /dev/tpmX can be used to send any TPM command
to the chip. Given that, I translate your statement to mean that no sysfs
attribute will be accepted which sends a TPM command to the chip. This in
turn means that there is no neded to protect sysfs attributes with a lock
since any sysfs attribute requiring that lock will be rejected.

Thanks for the clarification. Please consider this patch abandoned.
It might be worthwhile mentioning that restriction in the code though -
the comment stating that TPM2 sysfs accesses are disabled due to lack
of locking is obvioulsy incorrect.

Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-27 Thread Guenter Roeck
On Sun, Nov 26, 2017 at 03:56:41PM +0200, Jarkko Sakkinen wrote:
> On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> > On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> > 
> > > I'll split the patch into two parts, and only add (hopefully)
> > > non-controversial tpm2 attributes for now (which I think is durations
> > > and timeouts). Or, in other words, I'll split the attributes into
> > > two groups - one generic and one for tpm1.
> > 
> > Ok. Please look at new attributes you wish to add for tpm2 and see if
> > they meet the modern sysfs sensibility of one value per file, etc.
> > 
> > Jason
> 
> In general: if something can be retrieved through /dev/tpm0, there is no
> any sane reason to have a sysfs attribute for such.
> 

If I understand correctly, /dev/tpmX can be used to send any TPM command
to the chip. Given that, I translate your statement to mean that no sysfs
attribute will be accepted which sends a TPM command to the chip. This in
turn means that there is no neded to protect sysfs attributes with a lock
since any sysfs attribute requiring that lock will be rejected.

Thanks for the clarification. Please consider this patch abandoned.
It might be worthwhile mentioning that restriction in the code though -
the comment stating that TPM2 sysfs accesses are disabled due to lack
of locking is obvioulsy incorrect.

Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-26 Thread Jarkko Sakkinen
On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> 
> > I'll split the patch into two parts, and only add (hopefully)
> > non-controversial tpm2 attributes for now (which I think is durations
> > and timeouts). Or, in other words, I'll split the attributes into
> > two groups - one generic and one for tpm1.
> 
> Ok. Please look at new attributes you wish to add for tpm2 and see if
> they meet the modern sysfs sensibility of one value per file, etc.
> 
> Jason

In general: if something can be retrieved through /dev/tpm0, there is no
any sane reason to have a sysfs attribute for such.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-26 Thread Jarkko Sakkinen
On Tue, Nov 21, 2017 at 11:58:56AM -0700, Jason Gunthorpe wrote:
> On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:
> 
> > I'll split the patch into two parts, and only add (hopefully)
> > non-controversial tpm2 attributes for now (which I think is durations
> > and timeouts). Or, in other words, I'll split the attributes into
> > two groups - one generic and one for tpm1.
> 
> Ok. Please look at new attributes you wish to add for tpm2 and see if
> they meet the modern sysfs sensibility of one value per file, etc.
> 
> Jason

In general: if something can be retrieved through /dev/tpm0, there is no
any sane reason to have a sysfs attribute for such.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-21 Thread Jason Gunthorpe
On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:

> I'll split the patch into two parts, and only add (hopefully)
> non-controversial tpm2 attributes for now (which I think is durations
> and timeouts). Or, in other words, I'll split the attributes into
> two groups - one generic and one for tpm1.

Ok. Please look at new attributes you wish to add for tpm2 and see if
they meet the modern sysfs sensibility of one value per file, etc.

Jason


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-21 Thread Jason Gunthorpe
On Tue, Nov 21, 2017 at 10:28:58AM -0800, Guenter Roeck wrote:

> I'll split the patch into two parts, and only add (hopefully)
> non-controversial tpm2 attributes for now (which I think is durations
> and timeouts). Or, in other words, I'll split the attributes into
> two groups - one generic and one for tpm1.

Ok. Please look at new attributes you wish to add for tpm2 and see if
they meet the modern sysfs sensibility of one value per file, etc.

Jason


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-21 Thread Guenter Roeck
On Tue, Nov 21, 2017 at 01:49:47AM +0200, Jarkko Sakkinen wrote:
> On Mon, Nov 20, 2017 at 04:17:28PM -0700, Jason Gunthorpe wrote:
> > On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> > 
> > > "tpm: Enable sysfs support for TPM2 devices
> > > 
> > > Access to chip->ops on TPM2 devices requires an explicit lock,
> > > since the pointer is set to NULL in tpm_class_shutdown().
> > > Implement that lock for sysfs access functions and enable sysfs
> > > support for TPM2 devices."
> > 
> > Wait.. one of the reasons we let it go with no sysfs for so long was
> > because there was not many sysfs files that were compatible with tpm2?
> > 
> > For TPM2 we have sort of had an API break of sorts from TPM1 in a
> > couple places around sysfs, and I would like to not re-introduce any
> > badly designed sysfs files for TPM2..
> > 
> > So.. When you apply this patch, what changes actually happen in the
> > sysfs directory?
> > 
> > Jason
> 
> Oops. I was too quick. This will cause all the TPM 1.x attributes
> added also for TPM 2.0. That's not a great idea. The tpm_dev_group
> should be only assigned for TPM 1.x devices. This commit should only
> enable addition of sysfs attributes for TPM 2.0 devices.
> 

After having a closer look, I agree. Sorry for my naivite.

I'll split the patch into two parts, and only add (hopefully)
non-controversial tpm2 attributes for now (which I think is durations
and timeouts). Or, in other words, I'll split the attributes into
two groups - one generic and one for tpm1.

Thanks,
Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-21 Thread Guenter Roeck
On Tue, Nov 21, 2017 at 01:49:47AM +0200, Jarkko Sakkinen wrote:
> On Mon, Nov 20, 2017 at 04:17:28PM -0700, Jason Gunthorpe wrote:
> > On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> > 
> > > "tpm: Enable sysfs support for TPM2 devices
> > > 
> > > Access to chip->ops on TPM2 devices requires an explicit lock,
> > > since the pointer is set to NULL in tpm_class_shutdown().
> > > Implement that lock for sysfs access functions and enable sysfs
> > > support for TPM2 devices."
> > 
> > Wait.. one of the reasons we let it go with no sysfs for so long was
> > because there was not many sysfs files that were compatible with tpm2?
> > 
> > For TPM2 we have sort of had an API break of sorts from TPM1 in a
> > couple places around sysfs, and I would like to not re-introduce any
> > badly designed sysfs files for TPM2..
> > 
> > So.. When you apply this patch, what changes actually happen in the
> > sysfs directory?
> > 
> > Jason
> 
> Oops. I was too quick. This will cause all the TPM 1.x attributes
> added also for TPM 2.0. That's not a great idea. The tpm_dev_group
> should be only assigned for TPM 1.x devices. This commit should only
> enable addition of sysfs attributes for TPM 2.0 devices.
> 

After having a closer look, I agree. Sorry for my naivite.

I'll split the patch into two parts, and only add (hopefully)
non-controversial tpm2 attributes for now (which I think is durations
and timeouts). Or, in other words, I'll split the attributes into
two groups - one generic and one for tpm1.

Thanks,
Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Mon, Nov 20, 2017 at 04:17:28PM -0700, Jason Gunthorpe wrote:
> On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> 
> > "tpm: Enable sysfs support for TPM2 devices
> > 
> > Access to chip->ops on TPM2 devices requires an explicit lock,
> > since the pointer is set to NULL in tpm_class_shutdown().
> > Implement that lock for sysfs access functions and enable sysfs
> > support for TPM2 devices."
> 
> Wait.. one of the reasons we let it go with no sysfs for so long was
> because there was not many sysfs files that were compatible with tpm2?
> 
> For TPM2 we have sort of had an API break of sorts from TPM1 in a
> couple places around sysfs, and I would like to not re-introduce any
> badly designed sysfs files for TPM2..
> 
> So.. When you apply this patch, what changes actually happen in the
> sysfs directory?
> 
> Jason

Oops. I was too quick. This will cause all the TPM 1.x attributes
added also for TPM 2.0. That's not a great idea. The tpm_dev_group
should be only assigned for TPM 1.x devices. This commit should only
enable addition of sysfs attributes for TPM 2.0 devices.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Mon, Nov 20, 2017 at 04:17:28PM -0700, Jason Gunthorpe wrote:
> On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> 
> > "tpm: Enable sysfs support for TPM2 devices
> > 
> > Access to chip->ops on TPM2 devices requires an explicit lock,
> > since the pointer is set to NULL in tpm_class_shutdown().
> > Implement that lock for sysfs access functions and enable sysfs
> > support for TPM2 devices."
> 
> Wait.. one of the reasons we let it go with no sysfs for so long was
> because there was not many sysfs files that were compatible with tpm2?
> 
> For TPM2 we have sort of had an API break of sorts from TPM1 in a
> couple places around sysfs, and I would like to not re-introduce any
> badly designed sysfs files for TPM2..
> 
> So.. When you apply this patch, what changes actually happen in the
> sysfs directory?
> 
> Jason

Oops. I was too quick. This will cause all the TPM 1.x attributes
added also for TPM 2.0. That's not a great idea. The tpm_dev_group
should be only assigned for TPM 1.x devices. This commit should only
enable addition of sysfs attributes for TPM 2.0 devices.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> On Tue, Nov 21, 2017 at 12:13:23AM +0200, Jarkko Sakkinen wrote:
> > On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> > > Add explicit chip->ops locking for all sysfs attributes.
> > > This lets us support those attributes on tpm2 devices.
> > > 
> > > Signed-off-by: Guenter Roeck 
> > > ---
> > >  drivers/char/tpm/tpm-chip.c  |   4 --
> > >  drivers/char/tpm/tpm-sysfs.c | 125 
> > > ---
> > >  2 files changed, 93 insertions(+), 36 deletions(-)
> > 
> > I think the patch looks ok (with a quick skim) as code change. We need
> > it. It should have been already done. Thanks for doing this.
> > 
> > I don't digest the commit message.
> > 
> > You should just to explain why this change needs to be done in order to
> > support sysfs attributes with TPM 2.0 devices and not speculate how it
> > will be used in future commits.
> > 
> 
> How about the following ?
> 
> "tpm: Enable sysfs support for TPM2 devices
> 
> Access to chip->ops on TPM2 devices requires an explicit lock,
> since the pointer is set to NULL in tpm_class_shutdown().
> Implement that lock for sysfs access functions and enable sysfs
> support for TPM2 devices."
> 
> Thanks,
> Guenter

I can go with that. No need to send a new commit just for this :-)

I'll do some testing and give my final thoughts about the code
change and if everything is good I can change the commit message.
If not, submit the next version with that commit message.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:
> On Tue, Nov 21, 2017 at 12:13:23AM +0200, Jarkko Sakkinen wrote:
> > On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> > > Add explicit chip->ops locking for all sysfs attributes.
> > > This lets us support those attributes on tpm2 devices.
> > > 
> > > Signed-off-by: Guenter Roeck 
> > > ---
> > >  drivers/char/tpm/tpm-chip.c  |   4 --
> > >  drivers/char/tpm/tpm-sysfs.c | 125 
> > > ---
> > >  2 files changed, 93 insertions(+), 36 deletions(-)
> > 
> > I think the patch looks ok (with a quick skim) as code change. We need
> > it. It should have been already done. Thanks for doing this.
> > 
> > I don't digest the commit message.
> > 
> > You should just to explain why this change needs to be done in order to
> > support sysfs attributes with TPM 2.0 devices and not speculate how it
> > will be used in future commits.
> > 
> 
> How about the following ?
> 
> "tpm: Enable sysfs support for TPM2 devices
> 
> Access to chip->ops on TPM2 devices requires an explicit lock,
> since the pointer is set to NULL in tpm_class_shutdown().
> Implement that lock for sysfs access functions and enable sysfs
> support for TPM2 devices."
> 
> Thanks,
> Guenter

I can go with that. No need to send a new commit just for this :-)

I'll do some testing and give my final thoughts about the code
change and if everything is good I can change the commit message.
If not, submit the next version with that commit message.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jason Gunthorpe
On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:

> "tpm: Enable sysfs support for TPM2 devices
> 
> Access to chip->ops on TPM2 devices requires an explicit lock,
> since the pointer is set to NULL in tpm_class_shutdown().
> Implement that lock for sysfs access functions and enable sysfs
> support for TPM2 devices."

Wait.. one of the reasons we let it go with no sysfs for so long was
because there was not many sysfs files that were compatible with tpm2?

For TPM2 we have sort of had an API break of sorts from TPM1 in a
couple places around sysfs, and I would like to not re-introduce any
badly designed sysfs files for TPM2..

So.. When you apply this patch, what changes actually happen in the
sysfs directory?

Jason


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jason Gunthorpe
On Mon, Nov 20, 2017 at 02:45:23PM -0800, Guenter Roeck wrote:

> "tpm: Enable sysfs support for TPM2 devices
> 
> Access to chip->ops on TPM2 devices requires an explicit lock,
> since the pointer is set to NULL in tpm_class_shutdown().
> Implement that lock for sysfs access functions and enable sysfs
> support for TPM2 devices."

Wait.. one of the reasons we let it go with no sysfs for so long was
because there was not many sysfs files that were compatible with tpm2?

For TPM2 we have sort of had an API break of sorts from TPM1 in a
couple places around sysfs, and I would like to not re-introduce any
badly designed sysfs files for TPM2..

So.. When you apply this patch, what changes actually happen in the
sysfs directory?

Jason


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Guenter Roeck
On Tue, Nov 21, 2017 at 12:13:23AM +0200, Jarkko Sakkinen wrote:
> On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> > Add explicit chip->ops locking for all sysfs attributes.
> > This lets us support those attributes on tpm2 devices.
> > 
> > Signed-off-by: Guenter Roeck 
> > ---
> >  drivers/char/tpm/tpm-chip.c  |   4 --
> >  drivers/char/tpm/tpm-sysfs.c | 125 
> > ---
> >  2 files changed, 93 insertions(+), 36 deletions(-)
> 
> I think the patch looks ok (with a quick skim) as code change. We need
> it. It should have been already done. Thanks for doing this.
> 
> I don't digest the commit message.
> 
> You should just to explain why this change needs to be done in order to
> support sysfs attributes with TPM 2.0 devices and not speculate how it
> will be used in future commits.
> 

How about the following ?

"tpm: Enable sysfs support for TPM2 devices

Access to chip->ops on TPM2 devices requires an explicit lock,
since the pointer is set to NULL in tpm_class_shutdown().
Implement that lock for sysfs access functions and enable sysfs
support for TPM2 devices."

Thanks,
Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Guenter Roeck
On Tue, Nov 21, 2017 at 12:13:23AM +0200, Jarkko Sakkinen wrote:
> On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> > Add explicit chip->ops locking for all sysfs attributes.
> > This lets us support those attributes on tpm2 devices.
> > 
> > Signed-off-by: Guenter Roeck 
> > ---
> >  drivers/char/tpm/tpm-chip.c  |   4 --
> >  drivers/char/tpm/tpm-sysfs.c | 125 
> > ---
> >  2 files changed, 93 insertions(+), 36 deletions(-)
> 
> I think the patch looks ok (with a quick skim) as code change. We need
> it. It should have been already done. Thanks for doing this.
> 
> I don't digest the commit message.
> 
> You should just to explain why this change needs to be done in order to
> support sysfs attributes with TPM 2.0 devices and not speculate how it
> will be used in future commits.
> 

How about the following ?

"tpm: Enable sysfs support for TPM2 devices

Access to chip->ops on TPM2 devices requires an explicit lock,
since the pointer is set to NULL in tpm_class_shutdown().
Implement that lock for sysfs access functions and enable sysfs
support for TPM2 devices."

Thanks,
Guenter


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> Add explicit chip->ops locking for all sysfs attributes.
> This lets us support those attributes on tpm2 devices.
> 
> Signed-off-by: Guenter Roeck 
> ---
>  drivers/char/tpm/tpm-chip.c  |   4 --
>  drivers/char/tpm/tpm-sysfs.c | 125 
> ---
>  2 files changed, 93 insertions(+), 36 deletions(-)

I think the patch looks ok (with a quick skim) as code change. We need
it. It should have been already done. Thanks for doing this.

I don't digest the commit message.

You should just to explain why this change needs to be done in order to
support sysfs attributes with TPM 2.0 devices and not speculate how it
will be used in future commits.

/Jarkko


Re: [PATCH] tpm: Add explicit chip->ops locking for sysfs attributes.

2017-11-20 Thread Jarkko Sakkinen
On Thu, Nov 16, 2017 at 01:25:01PM -0800, Guenter Roeck wrote:
> Add explicit chip->ops locking for all sysfs attributes.
> This lets us support those attributes on tpm2 devices.
> 
> Signed-off-by: Guenter Roeck 
> ---
>  drivers/char/tpm/tpm-chip.c  |   4 --
>  drivers/char/tpm/tpm-sysfs.c | 125 
> ---
>  2 files changed, 93 insertions(+), 36 deletions(-)

I think the patch looks ok (with a quick skim) as code change. We need
it. It should have been already done. Thanks for doing this.

I don't digest the commit message.

You should just to explain why this change needs to be done in order to
support sysfs attributes with TPM 2.0 devices and not speculate how it
will be used in future commits.

/Jarkko