linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Winkler, Tomas" <tomas.winkler@intel.com>
To: "jarkko.sakkinen@linux.intel.com"
	<jarkko.sakkinen@linux.intel.com>, "jgg@ziepe.ca" <jgg@ziepe.ca>,
	"nayna@linux.ibm.com" <nayna@linux.ibm.com>
Cc: "nayna@linux.vnet.ibm.com" <nayna@linux.vnet.ibm.com>,
	"Struk, Tadeusz" <tadeusz.struk@intel.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"Usyskin, Alexander" <alexander.usyskin@intel.com>,
	"linux-security-module@vger.kernel.org" 
	<linux-security-module@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tpm: tpm_i2c_nuvoton: use correct command duration for TPM 2.x
Date: Fri, 19 Oct 2018 07:30:50 +0000	[thread overview]
Message-ID: <1539933995.19334.9.camel@intel.com> (raw)
In-Reply-To: <6e12d4b6-cb84-3be5-8a62-6868be43d43d@linux.ibm.com>

On Fri, 2018-10-19 at 10:14 +0530, Nayna Jain wrote:
> 
> On 10/17/2018 10:02 PM, Tomas Winkler wrote:
> > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > index caa86b19c76d..f74f451baf6a 100644
> > --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > @@ -369,6 +369,7 @@ static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
> >   	struct device *dev = chip->dev.parent;
> >   	struct i2c_client *client = to_i2c_client(dev);
> >   	u32 ordinal;
> > +	unsigned long duration;
> >   	size_t count = 0;
> >   	int burst_count, bytes2write, retries, rc = -EIO;
> > 
> > @@ -455,10 +456,12 @@ static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
> >   		return rc;
> >   	}
> >   	ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
> > -	rc = i2c_nuvoton_wait_for_data_avail(chip,
> > -					     tpm_calc_ordinal_duration(chip,
> > -								       ordinal),
> > -					     &priv->read_queue);
> > +	if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > +		duration = tpm2_calc_ordinal_duration(chip, ordinal);
> > +	else
> > +		duration = tpm_calc_ordinal_duration(chip, ordinal);
> > +
> > +	rc = i2c_nuvoton_wait_for_data_avail(chip, duration, &priv->read_queue);
> >   	if (rc) {
> >   		dev_err(dev, "%s() timeout command duration\n", __func__);
> >   		i2c_nuvoton_ready(chip);
> 
> I only have Nuvoton TPM 2.0, tested for that.
> 
> Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
> Tested-by: Nayna Jain <nayna@linux.ibm.com> (For TPM 2.0)

That's what we needed as TPM 1.2 should be unchanged.
Really appreciate the quick response. I will rebase the series on to of
this patch. 

Thanks
Tomas

  reply	other threads:[~2018-10-19  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 16:32 [PATCH] tpm: tpm_i2c_nuvoton: use correct command duration for TPM 2.x Tomas Winkler
2018-10-19  4:44 ` Nayna Jain
2018-10-19  7:30   ` Winkler, Tomas [this message]
2018-10-19 23:24 ` 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=1539933995.19334.9.camel@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=nayna@linux.ibm.com \
    --cc=nayna@linux.vnet.ibm.com \
    --cc=tadeusz.struk@intel.com \
    /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).