* [PATCH 0/2] fixes for 4.9.96 @ 2018-05-02 14:38 Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-02 14:38 UTC (permalink / raw) To: stable Cc: Jarkko Sakkinen, Jason Gunthorpe, open list, moderated list:TPM DEVICE DRIVER Decided to add Enric's commit because it is also a bug fix instead of modifying Chris commit. Chris Chiu (1): tpm: self test failure should not cause suspend to fail Enric Balletbo i Serra (1): tpm: do not suspend/resume if power stays on drivers/char/tpm/tpm-interface.c | 7 +++++++ drivers/char/tpm/tpm.h | 2 ++ drivers/char/tpm/tpm_of.c | 3 +++ 3 files changed, 12 insertions(+) -- 2.17.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] tpm: do not suspend/resume if power stays on 2018-05-02 14:38 [PATCH 0/2] fixes for 4.9.96 Jarkko Sakkinen @ 2018-05-02 14:38 ` Jarkko Sakkinen 2018-05-05 2:27 ` Greg KH 2018-05-02 14:38 ` [PATCH 2/2] tpm: self test failure should not cause suspend to fail Jarkko Sakkinen 2018-05-02 20:52 ` [PATCH 0/2] fixes for 4.9.96 Greg KH 2 siblings, 1 reply; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-02 14:38 UTC (permalink / raw) To: stable Cc: Enric Balletbo i Serra, Sonny Rao, Jarkko Sakkinen, James Morris, Peter Huewe, Marcel Selhorst, Jason Gunthorpe, moderated list:TPM DEVICE DRIVER, open list From: Enric Balletbo i Serra <enric.balletbo@collabora.com> commit b5d0ebc99bf5d0801a5ecbe958caa3d68b8eaee8 upstream The suspend/resume behavior of the TPM can be controlled by setting "powered-while-suspended" in the DTS. This is useful for the cases when hardware does not power-off the TPM. Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: James Morris <james.l.morris@oracle.com> --- drivers/char/tpm/tpm-interface.c | 3 +++ drivers/char/tpm/tpm.h | 2 ++ drivers/char/tpm/tpm_of.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 830d7e30e508..5463b649bdf1 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -969,6 +969,9 @@ int tpm_pm_suspend(struct device *dev) if (chip == NULL) return -ENODEV; + if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) + return 0; + if (chip->flags & TPM_CHIP_FLAG_TPM2) { tpm2_shutdown(chip, TPM2_SU_STATE); return 0; diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index aa4299cf7e5a..41756a9e9ad8 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -143,6 +143,8 @@ enum tpm_chip_flags { TPM_CHIP_FLAG_TPM2 = BIT(1), TPM_CHIP_FLAG_IRQ = BIT(2), TPM_CHIP_FLAG_VIRTUAL = BIT(3), + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), }; struct tpm_chip { diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c index 570f30c5c5f4..669f4a046398 100644 --- a/drivers/char/tpm/tpm_of.c +++ b/drivers/char/tpm/tpm_of.c @@ -37,6 +37,9 @@ int read_log(struct tpm_bios_log *log) return -ENODEV; } + if (of_property_read_bool(np, "powered-while-suspended")) + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; + sizep = of_get_property(np, "linux,sml-size", NULL); if (sizep == NULL) { pr_err("%s: ERROR - SML size not found\n", __func__); -- 2.17.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] tpm: do not suspend/resume if power stays on 2018-05-02 14:38 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen @ 2018-05-05 2:27 ` Greg KH 2018-05-08 10:56 ` Jarkko Sakkinen 0 siblings, 1 reply; 8+ messages in thread From: Greg KH @ 2018-05-05 2:27 UTC (permalink / raw) To: Jarkko Sakkinen Cc: stable, Enric Balletbo i Serra, Sonny Rao, James Morris, Peter Huewe, Marcel Selhorst, Jason Gunthorpe, moderated list:TPM DEVICE DRIVER, open list On Wed, May 02, 2018 at 05:38:28PM +0300, Jarkko Sakkinen wrote: > From: Enric Balletbo i Serra <enric.balletbo@collabora.com> > > commit b5d0ebc99bf5d0801a5ecbe958caa3d68b8eaee8 upstream > > The suspend/resume behavior of the TPM can be controlled by setting > "powered-while-suspended" in the DTS. This is useful for the cases > when hardware does not power-off the TPM. > > Signed-off-by: Sonny Rao <sonnyrao@chromium.org> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > Signed-off-by: James Morris <james.l.morris@oracle.com> > --- > drivers/char/tpm/tpm-interface.c | 3 +++ > drivers/char/tpm/tpm.h | 2 ++ > drivers/char/tpm/tpm_of.c | 3 +++ > 3 files changed, 8 insertions(+) > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > index 830d7e30e508..5463b649bdf1 100644 > --- a/drivers/char/tpm/tpm-interface.c > +++ b/drivers/char/tpm/tpm-interface.c > @@ -969,6 +969,9 @@ int tpm_pm_suspend(struct device *dev) > if (chip == NULL) > return -ENODEV; > > + if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) > + return 0; > + > if (chip->flags & TPM_CHIP_FLAG_TPM2) { > tpm2_shutdown(chip, TPM2_SU_STATE); > return 0; > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index aa4299cf7e5a..41756a9e9ad8 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -143,6 +143,8 @@ enum tpm_chip_flags { > TPM_CHIP_FLAG_TPM2 = BIT(1), > TPM_CHIP_FLAG_IRQ = BIT(2), > TPM_CHIP_FLAG_VIRTUAL = BIT(3), > + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), > + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), > }; > > struct tpm_chip { > diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c > index 570f30c5c5f4..669f4a046398 100644 > --- a/drivers/char/tpm/tpm_of.c > +++ b/drivers/char/tpm/tpm_of.c > @@ -37,6 +37,9 @@ int read_log(struct tpm_bios_log *log) > return -ENODEV; > } > > + if (of_property_read_bool(np, "powered-while-suspended")) > + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; > + This last line here blows up the build, there is no chip variable defined in this function :( So I have to drop both of these patches, from both 4.4.y and 4.9.y queues right now. Can you fix this up and resend them? thanks, greg k-h ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] tpm: do not suspend/resume if power stays on 2018-05-05 2:27 ` Greg KH @ 2018-05-08 10:56 ` Jarkko Sakkinen 2018-05-09 11:52 ` Jarkko Sakkinen 0 siblings, 1 reply; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-08 10:56 UTC (permalink / raw) To: Greg KH Cc: stable, Enric Balletbo i Serra, Sonny Rao, James Morris, Peter Huewe, Marcel Selhorst, Jason Gunthorpe, moderated list:TPM DEVICE DRIVER, open list On Fri, May 04, 2018 at 07:27:13PM -0700, Greg KH wrote: > On Wed, May 02, 2018 at 05:38:28PM +0300, Jarkko Sakkinen wrote: > > From: Enric Balletbo i Serra <enric.balletbo@collabora.com> > > > > commit b5d0ebc99bf5d0801a5ecbe958caa3d68b8eaee8 upstream > > > > The suspend/resume behavior of the TPM can be controlled by setting > > "powered-while-suspended" in the DTS. This is useful for the cases > > when hardware does not power-off the TPM. > > > > Signed-off-by: Sonny Rao <sonnyrao@chromium.org> > > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> > > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > > Signed-off-by: James Morris <james.l.morris@oracle.com> > > --- > > drivers/char/tpm/tpm-interface.c | 3 +++ > > drivers/char/tpm/tpm.h | 2 ++ > > drivers/char/tpm/tpm_of.c | 3 +++ > > 3 files changed, 8 insertions(+) > > > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > > index 830d7e30e508..5463b649bdf1 100644 > > --- a/drivers/char/tpm/tpm-interface.c > > +++ b/drivers/char/tpm/tpm-interface.c > > @@ -969,6 +969,9 @@ int tpm_pm_suspend(struct device *dev) > > if (chip == NULL) > > return -ENODEV; > > > > + if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) > > + return 0; > > + > > if (chip->flags & TPM_CHIP_FLAG_TPM2) { > > tpm2_shutdown(chip, TPM2_SU_STATE); > > return 0; > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > > index aa4299cf7e5a..41756a9e9ad8 100644 > > --- a/drivers/char/tpm/tpm.h > > +++ b/drivers/char/tpm/tpm.h > > @@ -143,6 +143,8 @@ enum tpm_chip_flags { > > TPM_CHIP_FLAG_TPM2 = BIT(1), > > TPM_CHIP_FLAG_IRQ = BIT(2), > > TPM_CHIP_FLAG_VIRTUAL = BIT(3), > > + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), > > + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), > > }; > > > > struct tpm_chip { > > diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c > > index 570f30c5c5f4..669f4a046398 100644 > > --- a/drivers/char/tpm/tpm_of.c > > +++ b/drivers/char/tpm/tpm_of.c > > @@ -37,6 +37,9 @@ int read_log(struct tpm_bios_log *log) > > return -ENODEV; > > } > > > > + if (of_property_read_bool(np, "powered-while-suspended")) > > + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; > > + > > This last line here blows up the build, there is no chip variable > defined in this function :( > > So I have to drop both of these patches, from both 4.4.y and 4.9.y > queues right now. Can you fix this up and resend them? > > thanks, > > greg k-h Yes. Sorry. I'll do that. /Jarkko ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] tpm: do not suspend/resume if power stays on 2018-05-08 10:56 ` Jarkko Sakkinen @ 2018-05-09 11:52 ` Jarkko Sakkinen 0 siblings, 0 replies; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-09 11:52 UTC (permalink / raw) To: Greg KH Cc: stable, Enric Balletbo i Serra, Sonny Rao, James Morris, Peter Huewe, Marcel Selhorst, Jason Gunthorpe, moderated list:TPM DEVICE DRIVER, open list On Tue, May 08, 2018 at 01:56:14PM +0300, Jarkko Sakkinen wrote: > On Fri, May 04, 2018 at 07:27:13PM -0700, Greg KH wrote: > > On Wed, May 02, 2018 at 05:38:28PM +0300, Jarkko Sakkinen wrote: > > > From: Enric Balletbo i Serra <enric.balletbo@collabora.com> > > > > > > commit b5d0ebc99bf5d0801a5ecbe958caa3d68b8eaee8 upstream > > > > > > The suspend/resume behavior of the TPM can be controlled by setting > > > "powered-while-suspended" in the DTS. This is useful for the cases > > > when hardware does not power-off the TPM. > > > > > > Signed-off-by: Sonny Rao <sonnyrao@chromium.org> > > > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> > > > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > > > Signed-off-by: James Morris <james.l.morris@oracle.com> > > > --- > > > drivers/char/tpm/tpm-interface.c | 3 +++ > > > drivers/char/tpm/tpm.h | 2 ++ > > > drivers/char/tpm/tpm_of.c | 3 +++ > > > 3 files changed, 8 insertions(+) > > > > > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > > > index 830d7e30e508..5463b649bdf1 100644 > > > --- a/drivers/char/tpm/tpm-interface.c > > > +++ b/drivers/char/tpm/tpm-interface.c > > > @@ -969,6 +969,9 @@ int tpm_pm_suspend(struct device *dev) > > > if (chip == NULL) > > > return -ENODEV; > > > > > > + if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) > > > + return 0; > > > + > > > if (chip->flags & TPM_CHIP_FLAG_TPM2) { > > > tpm2_shutdown(chip, TPM2_SU_STATE); > > > return 0; > > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > > > index aa4299cf7e5a..41756a9e9ad8 100644 > > > --- a/drivers/char/tpm/tpm.h > > > +++ b/drivers/char/tpm/tpm.h > > > @@ -143,6 +143,8 @@ enum tpm_chip_flags { > > > TPM_CHIP_FLAG_TPM2 = BIT(1), > > > TPM_CHIP_FLAG_IRQ = BIT(2), > > > TPM_CHIP_FLAG_VIRTUAL = BIT(3), > > > + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), > > > + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), > > > }; > > > > > > struct tpm_chip { > > > diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c > > > index 570f30c5c5f4..669f4a046398 100644 > > > --- a/drivers/char/tpm/tpm_of.c > > > +++ b/drivers/char/tpm/tpm_of.c > > > @@ -37,6 +37,9 @@ int read_log(struct tpm_bios_log *log) > > > return -ENODEV; > > > } > > > > > > + if (of_property_read_bool(np, "powered-while-suspended")) > > > + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; > > > + > > > > This last line here blows up the build, there is no chip variable > > defined in this function :( > > > > So I have to drop both of these patches, from both 4.4.y and 4.9.y > > queues right now. Can you fix this up and resend them? > > > > thanks, > > > > greg k-h > > Yes. Sorry. I'll do that. > > /Jarkko ... obviously should have compiled PPC kernel :-/ /Jarkko ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] tpm: self test failure should not cause suspend to fail 2018-05-02 14:38 [PATCH 0/2] fixes for 4.9.96 Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen @ 2018-05-02 14:38 ` Jarkko Sakkinen 2018-05-02 20:52 ` [PATCH 0/2] fixes for 4.9.96 Greg KH 2 siblings, 0 replies; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-02 14:38 UTC (permalink / raw) To: stable Cc: Chris Chiu, Daniel Drake, Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, Jason Gunthorpe, moderated list:TPM DEVICE DRIVER, open list From: Chris Chiu <chiu@endlessm.com> commit 0803d7befa15cab5717d667a97a66214d2a4c083 upstream The Acer Acer Veriton X4110G has a TPM device detected as: tpm_tis 00:0b: 1.2 TPM (device-id 0xFE, rev-id 71) After the first S3 suspend, the following error appears during resume: tpm tpm0: A TPM error(38) occurred continue selftest Any following S3 suspend attempts will now fail with this error: tpm tpm0: Error (38) sending savestate before suspend PM: Device 00:0b failed to suspend: error 38 Error 38 is TPM_ERR_INVALID_POSTINIT which means the TPM is not in the correct state. This indicates that the platform BIOS is not sending the usual TPM_Startup command during S3 resume. >From this point onwards, all TPM commands will fail. The same issue was previously reported on Foxconn 6150BK8MC and Sony Vaio TX3. The platform behaviour seems broken here, but we should not break suspend/resume because of this. When the unexpected TPM state is encountered, set a flag to skip the affected TPM_SaveState command on later suspends. Cc: stable@vger.kernel.org Signed-off-by: Chris Chiu <chiu@endlessm.com> Signed-off-by: Daniel Drake <drake@endlessm.com> Link: http://lkml.kernel.org/r/CAB4CAwfSCvj1cudi+MWaB5g2Z67d9DwY1o475YOZD64ma23UiQ@mail.gmail.com Link: https://lkml.org/lkml/2011/3/28/192 Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591031 Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> --- drivers/char/tpm/tpm-interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 5463b649bdf1..faf2db122ab9 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -803,6 +803,10 @@ int tpm_do_selftest(struct tpm_chip *chip) loops = jiffies_to_msecs(duration) / delay_msec; rc = tpm_continue_selftest(chip); + if (rc == TPM_ERR_INVALID_POSTINIT) { + chip->flags |= TPM_CHIP_FLAG_ALWAYS_POWERED; + dev_info(&chip->dev, "TPM not ready (%d)\n", rc); + } /* This may fail if there was no TPM driver during a suspend/resume * cycle; some may return 10 (BAD_ORDINAL), others 28 (FAILEDSELFTEST) */ -- 2.17.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] fixes for 4.9.96 2018-05-02 14:38 [PATCH 0/2] fixes for 4.9.96 Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 2/2] tpm: self test failure should not cause suspend to fail Jarkko Sakkinen @ 2018-05-02 20:52 ` Greg KH 2018-05-03 6:37 ` Jarkko Sakkinen 2 siblings, 1 reply; 8+ messages in thread From: Greg KH @ 2018-05-02 20:52 UTC (permalink / raw) To: Jarkko Sakkinen Cc: stable, Jason Gunthorpe, open list, moderated list:TPM DEVICE DRIVER On Wed, May 02, 2018 at 05:38:27PM +0300, Jarkko Sakkinen wrote: > Decided to add Enric's commit because it is also a bug fix instead > of modifying Chris commit. Both now applied, thanks. greg k-h ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] fixes for 4.9.96 2018-05-02 20:52 ` [PATCH 0/2] fixes for 4.9.96 Greg KH @ 2018-05-03 6:37 ` Jarkko Sakkinen 0 siblings, 0 replies; 8+ messages in thread From: Jarkko Sakkinen @ 2018-05-03 6:37 UTC (permalink / raw) To: Greg KH Cc: stable, Jason Gunthorpe, open list, moderated list:TPM DEVICE DRIVER On Wed, May 02, 2018 at 01:52:39PM -0700, Greg KH wrote: > On Wed, May 02, 2018 at 05:38:27PM +0300, Jarkko Sakkinen wrote: > > Decided to add Enric's commit because it is also a bug fix instead > > of modifying Chris commit. > > Both now applied, thanks. > > greg k-h Great, I'll send next updates to v4.4. /Jarkko ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-05-09 11:52 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-05-02 14:38 [PATCH 0/2] fixes for 4.9.96 Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 1/2] tpm: do not suspend/resume if power stays on Jarkko Sakkinen 2018-05-05 2:27 ` Greg KH 2018-05-08 10:56 ` Jarkko Sakkinen 2018-05-09 11:52 ` Jarkko Sakkinen 2018-05-02 14:38 ` [PATCH 2/2] tpm: self test failure should not cause suspend to fail Jarkko Sakkinen 2018-05-02 20:52 ` [PATCH 0/2] fixes for 4.9.96 Greg KH 2018-05-03 6:37 ` Jarkko Sakkinen
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).