tpm_tis: turn on TPM before calling tpm_get_timeouts
Subsystems (3)
PATCH 1/1 tpm_tis: turn on TPM before calling tpm_get_timeouts
With power gating moved out of the tpm_transmit code we need to power on the TPM prior to calling tpm_get_timeouts.
--- drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +2 -1
@@ -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; } -tpm_chip_start (chip); chip->flags |=TPM_CHIP_FLAG_IRQ ;if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
Signature · 1 line
2.24.0
PATCH v2 1/1 tpm_tis: turn on TPM before calling tpm_get_timeouts
With power gating moved out of the tpm_transmit code we need to power on the TPM prior to calling tpm_get_timeouts.
---
v2: fix stable cc to correct address
drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +2 -1
@@ -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; } -tpm_chip_start (chip); chip->flags |=TPM_CHIP_FLAG_IRQ ;if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
Signature · 1 line
2.24.0
Quoted 20 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +0
-0
drivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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
Quoted 35 lines · Jarkko Sakkinen
Quoted 20 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>--- drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +0
-0drivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 2 lines
/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.
Jason Gunthorpe
reviewerQuoted 35 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 6 lines
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. 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.
Jason
Quoted 44 lines · Jason Gunthorpe
Quoted 35 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 6 lines
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. I don't know what the reason was for trying it prior to the irq probe.
Quoted 7 lines
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.
Jason
Would it function with the timeout values set at the beginning of tpm_tis_core_init (max values)?
Quoted 49 lines · Jerry Snitselaar
Quoted 47 lines · Jason Gunthorpe
Quoted 35 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 6 lines
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. 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.
Quoted 7 lines
Quoted 4 lines
If timeouts have not been set then no TPM command should be executed.
Jason
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
Jason Gunthorpe
reviewerQuoted 50 lines · Jerry Snitselaar
Quoted 49 lines · Jerry Snitselaar
Quoted 47 lines · Jason Gunthorpe
Quoted 35 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 6 lines
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. 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.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 56 lines · Jason Gunthorpe
Quoted 55 lines · Jerry Snitselaar
Quoted 53 lines · Jerry Snitselaar
Quoted 40 lines · Jason Gunthorpe
Quoted 38 lines · Jerry Snitselaar
Quoted 35 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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
Quoted 8 lines
Quoted 3 lines
Probably. It will eventually get called when
tpm_chip_registerhappens. 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)?
Quoted 7 lines
Quoted 1 line
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?
Quoted 48 lines · Jerry Snitselaar
Quoted 47 lines · Jason Gunthorpe
Quoted 35 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 6 lines
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. 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.
Quoted 7 lines
Quoted 4 lines
If timeouts have not been set then no TPM command should be executed.
Jason
Would it function with the timeout values set at the beginning of
tpm_tis_core_init(max values)?
tpm_get_timeouts() should be replaced with:
if (tpm_chip_start()) {
dev_err(dev, "Could not get TPM timeouts and durations\n");
rc = -ENODEV;
goto out_err;
}tpm_stop_chip(chip);
tpm_get_timeouts() is called by tpm_auto_startup(). Also the function should be moved to tpm_chip.c and converted to a static function so that it won't be called from random cal sites like above.
/Jarkko
Jason Gunthorpe
reviewerQuoted 11 lines · Jarkko Sakkinen
Quoted 2 lines
Would it function with the timeout values set at the beginning of
tpm_tis_core_init(max values)?
tpm_get_timeouts()should be replaced with:if (tpm_chip_start()) { dev_err(dev, "Could not get TPM timeouts and durations\n"); rc = -ENODEV; goto out_err; }
Quoted 5 lines
tpm_stop_chip(chip);
tpm_get_timeouts()is called bytpm_auto_startup(). Also the function should be moved totpm_chip.cand converted to a static function so that it won't be called from random cal sites like above.
Careful, the design here was to allow a driver to do only get_timeouts, then additional setup work, then do auto_startup()
Forcing a driver to do auto_startup too early may not be good.
Jason
Quoted 14 lines · Jason Gunthorpe
Quoted 13 lines · Jarkko Sakkinen
Quoted 2 lines
Would it function with the timeout values set at the beginning of
tpm_tis_core_init(max values)?
tpm_get_timeouts()should be replaced with:if (tpm_chip_start()) { dev_err(dev, "Could not get TPM timeouts and durations\n"); rc = -ENODEV; goto out_err; }
tpm_stop_chip(chip);
Quoted 8 lines
Quoted 3 lines
tpm_get_timeouts()is called bytpm_auto_startup(). Also the function should be moved totpm_chip.cand converted to a static function so that it won't be called from random cal sites like above.Careful, the design here was to allow a driver to do only
get_timeouts, then additional setup work, then doauto_startup()Forcing a driver to do
auto_startuptoo early may not be good.
All drivers always do it anyway because all drivers always call tpm_chip_register().
/Jarkko
Jason Gunthorpe
reviewerQuoted 19 lines · Jarkko Sakkinen
Quoted 18 lines · Jason Gunthorpe
Quoted 16 lines · Jarkko Sakkinen
Quoted 2 lines
Would it function with the timeout values set at the beginning of
tpm_tis_core_init(max values)?
tpm_get_timeouts()should be replaced with:if (tpm_chip_start()) { dev_err(dev, "Could not get TPM timeouts and durations\n"); rc = -ENODEV; goto out_err; }
tpm_stop_chip(chip);
tpm_get_timeouts()is called bytpm_auto_startup(). Also the function should be moved totpm_chip.cand converted to a static function so that it won't be called from random cal sites like above.
Quoted 7 lines
Quoted 4 lines
Careful, the design here was to allow a driver to do only
get_timeouts, then additional setup work, then doauto_startup()Forcing a driver to do
auto_startuptoo early may not be good.All drivers always do it anyway because all drivers always call
tpm_chip_register().
But chip_register is after the driver has done it's setup and after it may have called get_timeouts
auto_setup should not be moved to before chip_register()
Jason
Quoted 25 lines · Jason Gunthorpe
Quoted 24 lines · Jarkko Sakkinen
Quoted 22 lines · Jason Gunthorpe
Quoted 11 lines · Jarkko Sakkinen
Quoted 2 lines
Would it function with the timeout values set at the beginning of
tpm_tis_core_init(max values)?
tpm_get_timeouts()should be replaced with:if (tpm_chip_start()) { dev_err(dev, "Could not get TPM timeouts and durations\n"); rc = -ENODEV; goto out_err; }Quoted 5 lines
tpm_stop_chip(chip);
tpm_get_timeouts()is called bytpm_auto_startup(). Also the function should be moved totpm_chip.cand converted to a static function so that it won't be called from random cal sites like above.Careful, the design here was to allow a driver to do only
get_timeouts, then additional setup work, then doauto_startup()Forcing a driver to do
auto_startuptoo early may not be good.
Quoted 7 lines
Quoted 2 lines
All drivers always do it anyway because all drivers always call
tpm_chip_register().But
chip_registeris after the driver has done it's setup and after it may have calledget_timeouts
auto_setupshould not be moved to beforechip_register()
I do not see any sense calling from get_timeouts() from call sites in the same initialization flow.
/Jarkko
Quoted 39 lines · Jason Gunthorpe
Quoted 38 lines · Jerry Snitselaar
Quoted 35 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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
Quoted 8 lines
Quoted 3 lines
Probably. It will eventually get called when
tpm_chip_registerhappens. 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.
Not true since you need a TPM command to set them. That is why they have been set initially to maximum possible values.
/Jarkko
Jason Gunthorpe
reviewerQuoted 44 lines · Jarkko Sakkinen
Quoted 43 lines · Jason Gunthorpe
Quoted 41 lines · Jerry Snitselaar
Quoted 33 lines · Jarkko Sakkinen
Quoted 18 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +1
-0+++ b/drivers/char/tpm/tpm_tis_core.cdrivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-0@@ -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?
Quoted 2 lines
/Jarkko
Probably. It will eventually get called when
tpm_chip_registerhappens. I don't know what the reason was for trying it prior to the irq probe.
Quoted 7 lines
Quoted 4 lines
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.
Not true since you need a TPM command to set them. That is why they have been set initially to maximum possible values.
getting timeouts is the exception
Jason
PATCH v3 1/1 tpm_tis: turn on TPM before calling tpm_get_timeouts
In reply to Jerry SnitselaarWith power gating moved out of the tpm_transmit code we need to power on the TPM prior to calling tpm_get_timeouts.
---
v3: call tpm_chip_stop in error path
v2: fix stable cc to correct address
drivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +2 -1
@@ -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_chip_stop (chip); goto out_err; } -tpm_chip_start (chip); chip->flags |=TPM_CHIP_FLAG_IRQ ;if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
Signature · 1 line
2.24.0
Quoted 25 lines · Jerry Snitselaar
With power gating moved out of the
tpm_transmitcode we need to power on the TPM prior to callingtpm_get_timeouts.Cc Jarkko Sakkinen <[email protected]>Cc Peter Huewe <[email protected]>Cc Jason Gunthorpe <[email protected]>Fixes a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()")Reported-by Christian Bundy <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>---
v3: calltpm_chip_stopin error path
v2: fix stable cc to correct addressdrivers/char/tpm/tpm_tis_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_tis_core.c +0
-0@@ -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.
drivers/char/tpm/tpm_tis_core.c int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, · line 983
Quoted 10 lines
drivers/char/tpm/tpm_tis_core.c +2
-1*/ +tpm_chip_start (chip);if (tpm_get_timeouts (chip)) {dev_err (dev,"Could not get TPM timeouts and durations\n" ); rc = -ENODEV ; +tpm_chip_stop (chip); goto out_err; } -tpm_chip_start (chip);
As the commit describes the call is not there for any other reason than pinging the TPM.
/Jarkko