Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599607

Re: [PATCH v2] tpm_crb: request and relinquish locality 0

From Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] tpm_crb: request and relinquish locality 0
Date 2017-03-13 17:50 +0100
Message-ID <tkBkv-3fs-53@gated-at.bofh.it> (permalink)
References <tjOWt-3dl-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Mar 11, 2017 at 03:02:14PM +0200, Jarkko Sakkinen wrote:
> Added two new callbacks to struct tpm_class_ops:
> 
> - request_locality
> - relinquish_locality
> 
> These are called before sending and receiving data from the TPM.  We
> update also tpm_tis_core to use these callbacks. Small modification to
> request_locality() is done so that it returns -EBUSY instead of locality
> number when check_locality() fails.

Make sense

I think you may as well do the other two drivers, even though you
can't run them the transformation looks safe enough to me.

> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>  drivers/char/tpm/tpm-interface.c |  9 +++++++++
>  drivers/char/tpm/tpm_crb.c       | 41 +++++++++++++++++++++++++++++++++++++++-
>  drivers/char/tpm/tpm_tis_core.c  | 12 ++++--------
>  include/linux/tpm.h              |  3 ++-
>  4 files changed, 55 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index e38c792..9c56581 100644
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -407,6 +407,12 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  	if (chip->dev.parent)
>  		pm_runtime_get_sync(chip->dev.parent);
>  
> +	if (chip->ops->request_locality)  {
> +		rc = chip->ops->request_locality(chip, 0);
> +		if (rc)
> +			goto out;

If request_locality fails we probably shouldn't call
relinquish_locality on the unwind path..

I think you should also put a relinquish_locality inside tpm_remove ?

> +	int (*request_locality)(struct tpm_chip *chip, int loc);
> +	void (*relinquish_locality)(struct tpm_chip *chip, int loc,
> bool force);

Let us document what force is supposed to do...

I'm not sure why we have it?

Jason

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] tpm_crb: request and relinquish locality 0 Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-11 14:10 +0100
  Re: [PATCH v2] tpm_crb: request and relinquish locality 0 Jerry Snitselaar <jsnitsel@redhat.com> - 2017-03-12 20:50 +0100
    Re: [PATCH v2] tpm_crb: request and relinquish locality 0 Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 13:00 +0100
  Re: [PATCH v2] tpm_crb: request and relinquish locality 0 Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-13 17:50 +0100
    Re: [PATCH v2] tpm_crb: request and relinquish locality 0 Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 21:20 +0100
      Re: [PATCH v2] tpm_crb: request and relinquish locality 0 Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-13 21:50 +0100

csiph-web