From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 07/16] drm/i915: fix S4 suspend while switcheroo state is off
Date: Tue, 21 Oct 2014 16:24:59 +0300 [thread overview]
Message-ID: <20141021132459.GG4284@intel.com> (raw)
In-Reply-To: <1413896901.26465.15.camel@intelbox>
On Tue, Oct 21, 2014 at 04:08:21PM +0300, Imre Deak wrote:
> On Tue, 2014-10-21 at 15:41 +0300, Ville Syrjälä wrote:
> > On Wed, Sep 10, 2014 at 06:17:00PM +0300, Imre Deak wrote:
> > > If the device is suspended already through the switcheroo interface we
> > > shouldn't suspend it again. We have the corresponding check for S3
> > > suspend already, add it for S4 freeze and poweroff too.
> > >
> > > Note that there is still the problem that the resume path should also
> > > check for the switcheroo-off state and keep the device disabled or in
> > > case of S4 disable it. That is a separate issue, which is not addressed
> > > in this patchset.
> >
> > That's about RESUME/RESTORE I take it.
> >
> > But what about .thaw()? I think simply adding the same check to .thaw()
> > would work out just fine since it's always called after .freeze() for
> > THAW/RECOVER.
>
> Yes, the check is missing from there too (actually by the end of the
> patchset THAW/RESUME/RESTORE are handled the same way). I didn't want to
> fix up that part in this patchset, since I thought avoiding RESTORE in
> case DRM_SWITCH_POWER_OFF is set is not enough during S4, we have to
> actually disable the device if it was enabled. But thinking about it
> again that seems to be not true, since before RESTORE FREEZE is called
> in the loader kernel, which leaves the device in a disabled state.
I was thinking just about fixing THAW/RECOVER since those get executed
from the same kernel as FREEZE/QUIESCE, but I guess you're correct that
we can just handle RESUME/RESTORE the same way since SUSPEND/QUIESCE in
the pre-resume kernel should have disabled the device anyway in case it
was enabled, which means the state will match the switcheroo disabled
state in the resumed kernel. And if switcheroo says the device should
be enabled we enable it normally when resuming. So yeah, sounds like it
should just work (tm).
>
> So I can put the check to .thaw too (.suspend by the end of the
> patchset), but it'd be easier to do it on top of this patchset if that's
> ok.
Sure.
>
> --Imre
>
> >
> > >
> > > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > > ---
> > > drivers/gpu/drm/i915/i915_drv.c | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > > index ca74d6d..a3addc2 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.c
> > > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > > @@ -994,6 +994,9 @@ static int i915_pm_freeze(struct device *dev)
> > > return -ENODEV;
> > > }
> > >
> > > + if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> > > + return 0;
> > > +
> > > return i915_drm_freeze(drm_dev);
> > > }
> > >
> > > @@ -1003,6 +1006,9 @@ static int i915_pm_freeze_late(struct device *dev)
> > > struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > struct drm_i915_private *dev_priv = drm_dev->dev_private;
> > >
> > > + if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> > > + return 0;
> > > +
> > > return intel_suspend_complete(dev_priv);
> > > }
> > >
> > > @@ -1027,6 +1033,9 @@ static int i915_pm_poweroff(struct device *dev)
> > > struct pci_dev *pdev = to_pci_dev(dev);
> > > struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > >
> > > + if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> > > + return 0;
> > > +
> > > return i915_drm_freeze(drm_dev);
> > > }
> > >
> > > --
> > > 1.8.4
> > >
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> >
>
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-10-21 23:48 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 15:16 [PATCH 00/16] fix VLV S4 suspend/resume, unify S3/S4 handlers Imre Deak
2014-09-10 15:16 ` [PATCH 01/16] drm/i915: vlv: fix gunit HW state corruption during S4 suspend Imre Deak
2014-09-15 17:26 ` Sagar Arun Kamble
2014-09-15 17:42 ` Imre Deak
2014-09-29 15:30 ` Sagar Arun Kamble
2014-10-21 12:34 ` Ville Syrjälä
2014-09-10 15:16 ` [PATCH 02/16] drm/i915: remove dead code from legacy suspend handler Imre Deak
2014-10-21 11:56 ` Ville Syrjälä
2014-10-21 12:11 ` Daniel Vetter
2014-09-10 15:16 ` [PATCH 03/16] drm/i915: factor out i915_drm_suspend_late Imre Deak
2014-09-10 15:16 ` [PATCH 04/16] drm/i915: unify legacy S3 suspend and S4 freeze handlers Imre Deak
2014-09-11 9:00 ` Daniel Vetter
2014-09-11 12:39 ` Imre Deak
2014-09-10 15:16 ` [PATCH 05/16] drm/i915: propagate error from legacy resume handler Imre Deak
2014-09-10 15:16 ` [PATCH 06/16] drm/i915: vlv: fix switcheroo/legacy suspend/resume Imre Deak
2014-09-29 15:33 ` Sagar Arun Kamble
2014-09-10 15:17 ` [PATCH 07/16] drm/i915: fix S4 suspend while switcheroo state is off Imre Deak
2014-10-21 12:41 ` Ville Syrjälä
2014-10-21 13:08 ` Imre Deak
2014-10-21 13:24 ` Ville Syrjälä [this message]
2014-09-10 15:17 ` [PATCH 08/16] drm/i915: remove unused restore_gtt_mappings optimization during suspend Imre Deak
2014-09-11 7:49 ` Chris Wilson
2014-09-11 11:59 ` Imre Deak
2014-09-11 14:15 ` Jesse Barnes
2014-10-21 13:50 ` Ville Syrjälä
2014-11-06 21:50 ` Jesse Barnes
2014-09-11 8:57 ` Daniel Vetter
2014-09-10 15:17 ` [PATCH 09/16] drm/i915: check for GT faults during S3 resume and S4 restore too Imre Deak
2014-09-11 7:47 ` Chris Wilson
2014-09-11 11:53 ` Imre Deak
2014-09-15 15:21 ` [PATCH v2 09/16] drm/i915: check for GT faults in all resume handlers and driver load time Imre Deak
2014-09-15 16:45 ` Chris Wilson
2014-09-10 15:17 ` [PATCH 10/16] drm/i915: enable output polling during S4 thaw Imre Deak
2014-09-10 15:17 ` [PATCH 11/16] drm/i915: disable/re-enable PCI device around S4 freeze/thaw Imre Deak
2014-10-21 13:16 ` Ville Syrjälä
2014-09-10 15:17 ` [PATCH 12/16] drm/i915: unify S3 and S4 suspend/resume handlers Imre Deak
2014-09-10 15:17 ` [PATCH 13/16] drm/i915: sanitize suspend/resume helper function names Imre Deak
2014-09-10 15:17 ` [PATCH 14/16] drm/i915: add poweroff_late handler Imre Deak
2014-10-21 13:32 ` Ville Syrjälä
2014-09-10 15:17 ` [PATCH 15/16] drm/i915: unify switcheroo and legacy suspend/resume handlers Imre Deak
2014-09-10 15:17 ` [PATCH 16/16] drm/i915: add comments on what stage a given PM handler is called Imre Deak
2014-09-15 15:23 ` [PATCH v2 " Imre Deak
2014-10-21 13:42 ` [PATCH " Ville Syrjälä
2014-10-21 13:51 ` Imre Deak
2014-09-10 15:52 ` [PATCH 00/16] fix VLV S4 suspend/resume, unify S3/S4 handlers Daniel Vetter
2014-09-10 18:38 ` Imre Deak
2014-09-11 9:02 ` Daniel Vetter
2014-09-11 13:48 ` Imre Deak
2014-10-21 14:42 ` Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141021132459.GG4284@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox