From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932340AbdCFOsa (ORCPT ); Mon, 6 Mar 2017 09:48:30 -0500 Received: from mga14.intel.com ([192.55.52.115]:46553 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932072AbdCFOsV (ORCPT ); Mon, 6 Mar 2017 09:48:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,254,1484035200"; d="scan'208";a="1138544275" Date: Mon, 6 Mar 2017 16:44:37 +0200 From: Jarkko Sakkinen To: Tomas Winkler Cc: tpmdd-devel@lists.sourceforge.net, Jason Gunthorpe , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tpm/tpm_crb: enter the low power state upon device suspend Message-ID: <20170306144437.vlrilvo33rxans5t@intel.com> References: <1488758015-12681-1-git-send-email-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1488758015-12681-1-git-send-email-tomas.winkler@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 06, 2017 at 01:53:35AM +0200, Tomas Winkler wrote: > This fix enables a platform to enter the idle state (suspend-to-idle) > > The driver needs to request explicitly go_idle upon completion > from the pm suspend handler. > The runtime pm is disabled on suspend during prepare state by calling > pm_runtime_get_noresume, hence we cannot relay on runtime pm to leave > the device in low power state. Symmetrically cmdReady is called > upon resume. > > Signed-off-by: Tomas Winkler LGTM Tested-by: Jarkko Sakkinen Reviewed-by: Jarkko Sakkinen PS. What about Fixes? Does this need it? /Jarkko > --- > drivers/char/tpm/tpm_crb.c | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > index 86f355b6df1d..d8dfff0fdfce 100644 > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -479,10 +479,33 @@ static int crb_pm_runtime_resume(struct device *dev) > > return crb_cmd_ready(dev, priv); > } > + > +static int crb_pm_suspend(struct device *dev) > +{ > + int ret; > + > + ret = tpm_pm_suspend(dev); > + if (ret) > + return ret; > + > + return crb_pm_runtime_suspend(dev); > +} > + > +static int crb_pm_resume(struct device *dev) > +{ > + int ret; > + > + ret = crb_pm_runtime_resume(dev); > + if (ret) > + return ret; > + > + return tpm_pm_resume(dev); > +} > + > #endif /* CONFIG_PM */ > > static const struct dev_pm_ops crb_pm = { > - SET_SYSTEM_SLEEP_PM_OPS(tpm_pm_suspend, tpm_pm_resume) > + SET_SYSTEM_SLEEP_PM_OPS(crb_pm_suspend, crb_pm_resume) > SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) > }; > > -- > 2.7.4 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH] tpm/tpm_crb: enter the low power state upon device suspend Date: Mon, 6 Mar 2017 16:44:37 +0200 Message-ID: <20170306144437.vlrilvo33rxans5t@intel.com> References: <1488758015-12681-1-git-send-email-tomas.winkler@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1488758015-12681-1-git-send-email-tomas.winkler-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Tomas Winkler Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net On Mon, Mar 06, 2017 at 01:53:35AM +0200, Tomas Winkler wrote: > This fix enables a platform to enter the idle state (suspend-to-idle) > > The driver needs to request explicitly go_idle upon completion > from the pm suspend handler. > The runtime pm is disabled on suspend during prepare state by calling > pm_runtime_get_noresume, hence we cannot relay on runtime pm to leave > the device in low power state. Symmetrically cmdReady is called > upon resume. > > Signed-off-by: Tomas Winkler LGTM Tested-by: Jarkko Sakkinen Reviewed-by: Jarkko Sakkinen PS. What about Fixes? Does this need it? /Jarkko > --- > drivers/char/tpm/tpm_crb.c | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > index 86f355b6df1d..d8dfff0fdfce 100644 > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -479,10 +479,33 @@ static int crb_pm_runtime_resume(struct device *dev) > > return crb_cmd_ready(dev, priv); > } > + > +static int crb_pm_suspend(struct device *dev) > +{ > + int ret; > + > + ret = tpm_pm_suspend(dev); > + if (ret) > + return ret; > + > + return crb_pm_runtime_suspend(dev); > +} > + > +static int crb_pm_resume(struct device *dev) > +{ > + int ret; > + > + ret = crb_pm_runtime_resume(dev); > + if (ret) > + return ret; > + > + return tpm_pm_resume(dev); > +} > + > #endif /* CONFIG_PM */ > > static const struct dev_pm_ops crb_pm = { > - SET_SYSTEM_SLEEP_PM_OPS(tpm_pm_suspend, tpm_pm_resume) > + SET_SYSTEM_SLEEP_PM_OPS(crb_pm_suspend, crb_pm_resume) > SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) > }; > > -- > 2.7.4 > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot