Re: [PATCH] tpm_tis: turn on TPM before calling tpm_get_timeouts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue Nov 12 19, Jason Gunthorpe wrote:
On Tue, Nov 12, 2019 at 01:31:09PM -0700, Jerry Snitselaar wrote:
On Tue, Nov 12, 2019 at 1:28 PM Jerry Snitselaar <jsnitsel@xxxxxxxxxx> wrote:
>
> On Tue, Nov 12, 2019 at 1:26 PM Jason Gunthorpe <jgg@xxxxxxxx> wrote:
> >
> > On Tue, Nov 12, 2019 at 01:23:33PM -0700, Jerry Snitselaar wrote:
> > > On Tue, Nov 12, 2019 at 1:03 PM Jarkko Sakkinen
> > > <jarkko.sakkinen@xxxxxxxxxxxxxxx> wrote:
> > > >
> > > > On Mon, Nov 11, 2019 at 04:34:18PM -0700, Jerry Snitselaar wrote:
> > > > > With power gating moved out of the tpm_transmit code we need
> > > > > to power on the TPM prior to calling tpm_get_timeouts.
> > > > >
> > > > > Cc: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
> > > > > Cc: Peter Huewe <peterhuewe@xxxxxx>
> > > > > Cc: Jason Gunthorpe <jgg@xxxxxxxx>
> > > > > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > > > > Cc: linux-stable@xxxxxxxxxxxxxxx
> > > > > Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")
> > > > > Reported-by: Christian Bundy <christianbundy@xxxxxxxxxxx>
> > > > > Signed-off-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
> > > > >  drivers/char/tpm/tpm_tis_core.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> > > > > index 270f43acbb77..cb101cec8f8b 100644
> > > > > +++ b/drivers/char/tpm/tpm_tis_core.c
> > > > > @@ -974,13 +974,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> > > > >                * to make sure it works. May as well use that command to set the
> > > > >                * proper timeouts for the driver.
> > > > >                */
> > > > > +             tpm_chip_start(chip);
> > > > >               if (tpm_get_timeouts(chip)) {
> > > > >                       dev_err(dev, "Could not get TPM timeouts and durations\n");
> > > > >                       rc = -ENODEV;
> > > > > +                     tpm_stop_chip(chip);
> > > > >                       goto out_err;
> > > > >               }
> > > >
> > > > Couldn't this call just be removed?
> > > >
> > > > /Jarkko
> > > >
> > >
> > > Probably. It will eventually get called when tpm_chip_register
> > > happens. I don't know what the reason was for trying it prior to the
> > > irq probe.
> >
> > At least tis once needed the timeouts before registration because it
> > was issuing TPM commands to complete its setup.
> >
> > If timeouts have not been set then no TPM command should be executed.
>
> Would it function with the timeout values set at the beginning of
> tpm_tis_core_init (max values)?

I guess that doesn't set the duration values though

There is no reason to use anything but the correct timeouts, as read
from the device.

Jason


Should there be a check in tpm1_get_timeouts and tpm2_get_timeouts:

	if (chip->flags & TPM_CHIP_FLAG_HAVE_TIMEOUTS)
		return 0;

to skip going through it again in the auto startup code if it was
already called and set?





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux