[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1539933995.19334.9.camel@intel.com>
Date: Fri, 19 Oct 2018 07:30:50 +0000
From: "Winkler, Tomas" <tomas.winkler@...el.com>
To: "jarkko.sakkinen@...ux.intel.com" <jarkko.sakkinen@...ux.intel.com>,
"jgg@...pe.ca" <jgg@...pe.ca>,
"nayna@...ux.ibm.com" <nayna@...ux.ibm.com>
CC: "nayna@...ux.vnet.ibm.com" <nayna@...ux.vnet.ibm.com>,
"Struk, Tadeusz" <tadeusz.struk@...el.com>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>,
"Usyskin, Alexander" <alexander.usyskin@...el.com>,
"linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tpm: tpm_i2c_nuvoton: use correct command duration for
TPM 2.x
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@...ux.ibm.com>
> Tested-by: Nayna Jain <nayna@...ux.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
Powered by blists - more mailing lists