* [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware [not found] <20191210210735.9077-1-sashal@kernel.org> @ 2019-12-10 21:06 ` Sasha Levin 2019-12-10 21:32 ` Guenter Roeck 0 siblings, 1 reply; 6+ messages in thread From: Sasha Levin @ 2019-12-10 21:06 UTC (permalink / raw) To: linux-kernel, stable Cc: Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, Jarkko Sakkinen, Sasha Levin, linux-integrity From: Stephen Boyd <swboyd@chromium.org> [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] On some platforms, the TPM power is managed by firmware and therefore we don't need to stop the TPM on suspend when going to a light version of suspend such as S0ix ("freeze" suspend state). Add a chip flag, TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain platforms can probe for the usage of this light suspend and avoid touching the TPM state across suspend/resume. Cc: Andrey Pronin <apronin@chromium.org> Cc: Duncan Laurie <dlaurie@chromium.org> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Guenter Roeck <groeck@chromium.org> Cc: Alexander Steffen <Alexander.Steffen@infineon.com> Cc: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/char/tpm/tpm-interface.c | 8 +++++++- drivers/char/tpm/tpm.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index d7a3888ad80f0..7f105490604c8 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <linux/mutex.h> #include <linux/spinlock.h> +#include <linux/suspend.h> #include <linux/freezer.h> #include <linux/tpm_eventlog.h> @@ -394,7 +395,11 @@ int tpm_pm_suspend(struct device *dev) return -ENODEV; if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) - return 0; + goto suspended; + + if ((chip->flags & TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED) && + !pm_suspend_via_firmware()) + goto suspended; if (!tpm_chip_start(chip)) { if (chip->flags & TPM_CHIP_FLAG_TPM2) @@ -405,6 +410,7 @@ int tpm_pm_suspend(struct device *dev) tpm_chip_stop(chip); } +suspended: return rc; } EXPORT_SYMBOL_GPL(tpm_pm_suspend); diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index a7fea3e0ca86a..f3bf2f7f755c8 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -162,6 +162,7 @@ enum tpm_chip_flags { TPM_CHIP_FLAG_VIRTUAL = BIT(3), TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), + TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6), }; #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev) -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware 2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware Sasha Levin @ 2019-12-10 21:32 ` Guenter Roeck 2019-12-11 17:57 ` Jarkko Sakkinen 0 siblings, 1 reply; 6+ messages in thread From: Guenter Roeck @ 2019-12-10 21:32 UTC (permalink / raw) To: Sasha Levin Cc: linux-kernel, # v4 . 10+, Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, Jarkko Sakkinen, linux-integrity On Tue, Dec 10, 2019 at 1:12 PM Sasha Levin <sashal@kernel.org> wrote: > > From: Stephen Boyd <swboyd@chromium.org> > > [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] > > On some platforms, the TPM power is managed by firmware and therefore we > don't need to stop the TPM on suspend when going to a light version of > suspend such as S0ix ("freeze" suspend state). Add a chip flag, > TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain > platforms can probe for the usage of this light suspend and avoid > touching the TPM state across suspend/resume. > Are the patches needed to support CR50 (which need this patch) going to be applied to v5.4.y as well ? If not, what is the purpose of applying this patch to v5.4.y ? Thanks, Guenter > Cc: Andrey Pronin <apronin@chromium.org> > Cc: Duncan Laurie <dlaurie@chromium.org> > Cc: Jason Gunthorpe <jgg@ziepe.ca> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Guenter Roeck <groeck@chromium.org> > Cc: Alexander Steffen <Alexander.Steffen@infineon.com> > Cc: Heiko Stuebner <heiko@sntech.de> > Tested-by: Heiko Stuebner <heiko@sntech.de> > Reviewed-by: Heiko Stuebner <heiko@sntech.de> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > drivers/char/tpm/tpm-interface.c | 8 +++++++- > drivers/char/tpm/tpm.h | 1 + > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > index d7a3888ad80f0..7f105490604c8 100644 > --- a/drivers/char/tpm/tpm-interface.c > +++ b/drivers/char/tpm/tpm-interface.c > @@ -23,6 +23,7 @@ > #include <linux/slab.h> > #include <linux/mutex.h> > #include <linux/spinlock.h> > +#include <linux/suspend.h> > #include <linux/freezer.h> > #include <linux/tpm_eventlog.h> > > @@ -394,7 +395,11 @@ int tpm_pm_suspend(struct device *dev) > return -ENODEV; > > if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) > - return 0; > + goto suspended; > + > + if ((chip->flags & TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED) && > + !pm_suspend_via_firmware()) > + goto suspended; > > if (!tpm_chip_start(chip)) { > if (chip->flags & TPM_CHIP_FLAG_TPM2) > @@ -405,6 +410,7 @@ int tpm_pm_suspend(struct device *dev) > tpm_chip_stop(chip); > } > > +suspended: > return rc; > } > EXPORT_SYMBOL_GPL(tpm_pm_suspend); > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index a7fea3e0ca86a..f3bf2f7f755c8 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -162,6 +162,7 @@ enum tpm_chip_flags { > TPM_CHIP_FLAG_VIRTUAL = BIT(3), > TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), > TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), > + TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6), > }; > > #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev) > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware 2019-12-10 21:32 ` Guenter Roeck @ 2019-12-11 17:57 ` Jarkko Sakkinen 2019-12-11 18:05 ` Guenter Roeck 0 siblings, 1 reply; 6+ messages in thread From: Jarkko Sakkinen @ 2019-12-11 17:57 UTC (permalink / raw) To: Guenter Roeck Cc: Sasha Levin, linux-kernel, # v4 . 10+, Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, linux-integrity On Tue, Dec 10, 2019 at 01:32:15PM -0800, Guenter Roeck wrote: > On Tue, Dec 10, 2019 at 1:12 PM Sasha Levin <sashal@kernel.org> wrote: > > > > From: Stephen Boyd <swboyd@chromium.org> > > > > [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] > > > > On some platforms, the TPM power is managed by firmware and therefore we > > don't need to stop the TPM on suspend when going to a light version of > > suspend such as S0ix ("freeze" suspend state). Add a chip flag, > > TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain > > platforms can probe for the usage of this light suspend and avoid > > touching the TPM state across suspend/resume. > > > > Are the patches needed to support CR50 (which need this patch) going > to be applied to v5.4.y as well ? If not, what is the purpose of > applying this patch to v5.4.y ? > > Thanks, > Guenter Thanks Guenter. I think not. /Jarkko ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware 2019-12-11 17:57 ` Jarkko Sakkinen @ 2019-12-11 18:05 ` Guenter Roeck 2019-12-13 0:17 ` Jarkko Sakkinen 0 siblings, 1 reply; 6+ messages in thread From: Guenter Roeck @ 2019-12-11 18:05 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Sasha Levin, linux-kernel, # v4 . 10+, Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, linux-integrity On Wed, Dec 11, 2019 at 9:57 AM Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote: > > On Tue, Dec 10, 2019 at 01:32:15PM -0800, Guenter Roeck wrote: > > On Tue, Dec 10, 2019 at 1:12 PM Sasha Levin <sashal@kernel.org> wrote: > > > > > > From: Stephen Boyd <swboyd@chromium.org> > > > > > > [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] > > > > > > On some platforms, the TPM power is managed by firmware and therefore we > > > don't need to stop the TPM on suspend when going to a light version of > > > suspend such as S0ix ("freeze" suspend state). Add a chip flag, > > > TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain > > > platforms can probe for the usage of this light suspend and avoid > > > touching the TPM state across suspend/resume. > > > > > > > Are the patches needed to support CR50 (which need this patch) going > > to be applied to v5.4.y as well ? If not, what is the purpose of > > applying this patch to v5.4.y ? > > > > Thanks, > > Guenter > > Thanks Guenter. I think not. > Thought so. In that case this patch should be dropped. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware 2019-12-11 18:05 ` Guenter Roeck @ 2019-12-13 0:17 ` Jarkko Sakkinen 2019-12-19 22:26 ` Sasha Levin 0 siblings, 1 reply; 6+ messages in thread From: Jarkko Sakkinen @ 2019-12-13 0:17 UTC (permalink / raw) To: Guenter Roeck Cc: Sasha Levin, linux-kernel, # v4 . 10+, Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, linux-integrity On Wed, Dec 11, 2019 at 10:05:52AM -0800, Guenter Roeck wrote: > On Wed, Dec 11, 2019 at 9:57 AM Jarkko Sakkinen > <jarkko.sakkinen@linux.intel.com> wrote: > > > > On Tue, Dec 10, 2019 at 01:32:15PM -0800, Guenter Roeck wrote: > > > On Tue, Dec 10, 2019 at 1:12 PM Sasha Levin <sashal@kernel.org> wrote: > > > > > > > > From: Stephen Boyd <swboyd@chromium.org> > > > > > > > > [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] > > > > > > > > On some platforms, the TPM power is managed by firmware and therefore we > > > > don't need to stop the TPM on suspend when going to a light version of > > > > suspend such as S0ix ("freeze" suspend state). Add a chip flag, > > > > TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain > > > > platforms can probe for the usage of this light suspend and avoid > > > > touching the TPM state across suspend/resume. > > > > > > > > > > Are the patches needed to support CR50 (which need this patch) going > > > to be applied to v5.4.y as well ? If not, what is the purpose of > > > applying this patch to v5.4.y ? > > > > > > Thanks, > > > Guenter > > > > Thanks Guenter. I think not. > > > Thought so. In that case this patch should be dropped. > > Guenter I fully agree with you. /Jarkko ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware 2019-12-13 0:17 ` Jarkko Sakkinen @ 2019-12-19 22:26 ` Sasha Levin 0 siblings, 0 replies; 6+ messages in thread From: Sasha Levin @ 2019-12-19 22:26 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Guenter Roeck, linux-kernel, # v4 . 10+, Stephen Boyd, Andrey Pronin, Duncan Laurie, Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, Guenter Roeck, Alexander Steffen, Heiko Stuebner, linux-integrity On Fri, Dec 13, 2019 at 02:17:31AM +0200, Jarkko Sakkinen wrote: >On Wed, Dec 11, 2019 at 10:05:52AM -0800, Guenter Roeck wrote: >> On Wed, Dec 11, 2019 at 9:57 AM Jarkko Sakkinen >> <jarkko.sakkinen@linux.intel.com> wrote: >> > >> > On Tue, Dec 10, 2019 at 01:32:15PM -0800, Guenter Roeck wrote: >> > > On Tue, Dec 10, 2019 at 1:12 PM Sasha Levin <sashal@kernel.org> wrote: >> > > > >> > > > From: Stephen Boyd <swboyd@chromium.org> >> > > > >> > > > [ Upstream commit 2e2ee5a2db06c4b81315514b01d06fe5644342e9 ] >> > > > >> > > > On some platforms, the TPM power is managed by firmware and therefore we >> > > > don't need to stop the TPM on suspend when going to a light version of >> > > > suspend such as S0ix ("freeze" suspend state). Add a chip flag, >> > > > TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED, to indicate this so that certain >> > > > platforms can probe for the usage of this light suspend and avoid >> > > > touching the TPM state across suspend/resume. >> > > > >> > > >> > > Are the patches needed to support CR50 (which need this patch) going >> > > to be applied to v5.4.y as well ? If not, what is the purpose of >> > > applying this patch to v5.4.y ? >> > > >> > > Thanks, >> > > Guenter >> > >> > Thanks Guenter. I think not. >> > >> Thought so. In that case this patch should be dropped. >> >> Guenter > >I fully agree with you. I've dropped it, thanks! -- Thanks, Sasha ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-19 22:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20191210210735.9077-1-sashal@kernel.org>
2019-12-10 21:06 ` [PATCH AUTOSEL 5.4 277/350] tpm: Add a flag to indicate TPM power is managed by firmware Sasha Levin
2019-12-10 21:32 ` Guenter Roeck
2019-12-11 17:57 ` Jarkko Sakkinen
2019-12-11 18:05 ` Guenter Roeck
2019-12-13 0:17 ` Jarkko Sakkinen
2019-12-19 22:26 ` Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox