From: Sagar Arun Kamble <sagar.a.kamble@intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: paulo.r.zanoni@intel.com, daniel.vetter@ffwll.ch,
intel-gfx@lists.freedesktop.org, "Goel,
Akash" <akash.goel@intel.com>
Subject: Re: [PATCH 1/1] drm/i915: Adding Gfx Clock, Wake and Gunit save/restore logic in PM suspend/resume paths.
Date: Fri, 08 Aug 2014 12:22:44 +0530 [thread overview]
Message-ID: <1407480764.14962.2.camel@sagar-desktop> (raw)
In-Reply-To: <20140804080710.GI8727@phenom.ffwll.local>
Hi Daniel,
On Mon, 2014-08-04 at 10:07 +0200, Daniel Vetter wrote:
> On Fri, Aug 01, 2014 at 12:34:56PM +0530, sagar.a.kamble@intel.com wrote:
> > From: Sagar Kamble <sagar.a.kamble@intel.com>
> >
> > Sequence to get gfx clocks on/off, allow/disallow wake and save/restore of gunit registers need to be followed in
> > PM suspend and resume path similar to runtime suspend and resume.
> >
> > v2:
> > 1. Keeping GT access, wake, gunit save/restore related helpers static.
> > 2. Moved GT access check, Wake Control, Gunit state save to end of i915_drm_freeze.
> > 3. Reusing the sequence in runtime_suspend/resume path at macro level.
> >
> > Cc: Imre Deak <imre.deak at intel.com>
> > Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> > Cc: Jani Nikula <jani.nikula at linux.intel.com>
> > Cc: Goel, Akash <akash.goel@intel.com>
> > Change-Id: I15cfdeeec9c976d9839bb281f809664f4a0c78a2
> > Signed-off-by: Sagar Kamble <sagar.a.kamble@intel.com>
> > ---
> > drivers/gpu/drm/i915/i915_drv.c | 39 +++++++++++++++++++++++++++++++++------
> > drivers/gpu/drm/i915/i915_drv.h | 1 +
> > 2 files changed, 34 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 6c4b25c..385dc74 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -490,11 +490,16 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)
> > return true;
> > }
> >
> > +static int vlv_runtime_suspend(struct drm_i915_private *dev_priv);
> > +static int vlv_runtime_resume(struct drm_i915_private *dev_priv,
> > + bool resume_from_s0ix);
> > +
> > static int i915_drm_freeze(struct drm_device *dev)
> > {
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > struct drm_crtc *crtc;
> > pci_power_t opregion_target_state;
> > + int ret = 0;
> >
> > /* ignore lid events during suspend */
> > mutex_lock(&dev_priv->modeset_restore_lock);
> > @@ -562,7 +567,12 @@ static int i915_drm_freeze(struct drm_device *dev)
> >
> > intel_display_set_init_power(dev_priv, false);
> >
> > - return 0;
> > + /* Save Gunit State and clear wake - Need to make sure
> > + * changes in vlv_runtime_suspend path don't impact this path */
> > + if (IS_VALLEYVIEW(dev))
> > + ret = vlv_runtime_suspend(dev_priv);
>
> Maybe I wasn't clear, but I absolutely don't want any IS_VLV additions to
> core resume/thaw code. This should be shovelled into the runtime pm
> handling code, which should be reused in the suspend/resume code.
This piece of code does not fit into any of the power well get/put path.
Its specific sequence that need to be followed in VLV when Gunit gets
power gated. So we have to keep this IS_VLV related functionality in
both runtime and pm suspend/resume.
>
> > +
> > + return ret;
> > }
> >
> > int i915_suspend(struct drm_device *dev, pm_message_t state)
> > @@ -610,6 +620,12 @@ void intel_console_resume(struct work_struct *work)
> > static int i915_drm_thaw_early(struct drm_device *dev)
> > {
> > struct drm_i915_private *dev_priv = dev->dev_private;
> > + int ret = 0;
> > +
> > + /* Restore Gunit State and allow wake - Need to make sure
> > + * changes in vlv_runtime_resume path don't impact this path */
> > + if (IS_VALLEYVIEW(dev))
> > + ret = vlv_runtime_resume(dev_priv, true);
> >
> > if (IS_HASWELL(dev) || IS_BROADWELL(dev))
> > hsw_disable_pc8(dev_priv);
> > @@ -618,7 +634,7 @@ static int i915_drm_thaw_early(struct drm_device *dev)
> > intel_uncore_sanitize(dev);
> > intel_power_domains_init_hw(dev_priv);
> >
> > - return 0;
> > + return ret;
> > }
> >
> > static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
> > @@ -1098,6 +1114,7 @@ static void vlv_save_gunit_s0ix_state(struct drm_i915_private *dev_priv)
> > s->gu_ctl0 = I915_READ(VLV_GU_CTL0);
> > s->gu_ctl1 = I915_READ(VLV_GU_CTL1);
> > s->clock_gate_dis2 = I915_READ(VLV_GUNIT_CLOCK_GATE2);
> > + s->dpio_cfg_data = I915_READ(DPIO_CTL);
> >
> > /*
> > * Not saving any of:
> > @@ -1192,6 +1209,7 @@ static void vlv_restore_gunit_s0ix_state(struct drm_i915_private *dev_priv)
> > I915_WRITE(VLV_GU_CTL0, s->gu_ctl0);
> > I915_WRITE(VLV_GU_CTL1, s->gu_ctl1);
> > I915_WRITE(VLV_GUNIT_CLOCK_GATE2, s->clock_gate_dis2);
> > + I915_WRITE(DPIO_CTL, s->dpio_cfg_data);
> > }
> >
> > int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool force_on)
> > @@ -1291,6 +1309,8 @@ static void vlv_check_no_gt_access(struct drm_i915_private *dev_priv)
> > I915_WRITE(VLV_GTLC_PW_STATUS, VLV_GTLC_ALLOWWAKEERR);
> > }
> >
> > +/* This function is used in system suspend path as well to utilize
> > + * Gfx clock, Wake control, Gunit state save related functionaility */
> > static int vlv_runtime_suspend(struct drm_i915_private *dev_priv)
> > {
> > u32 mask;
> > @@ -1331,7 +1351,12 @@ err1:
> > return err;
> > }
> >
> > -static int vlv_runtime_resume(struct drm_i915_private *dev_priv)
> > +/* This function is used in system resume path as well to utilize
> > + * Gfx clock, Wake control, Gunit state restore related functionaility.
> > + * GEM and other initialization will differ which will be controlled by
> > + * resume_from_s0ix variable */
> > +static int vlv_runtime_resume(struct drm_i915_private *dev_priv,
> > + bool resume_from_s0ix)
> > {
> > struct drm_device *dev = dev_priv->dev;
> > int err;
> > @@ -1356,8 +1381,10 @@ static int vlv_runtime_resume(struct drm_i915_private *dev_priv)
> >
> > vlv_check_no_gt_access(dev_priv);
> >
> > - intel_init_clock_gating(dev);
> > - i915_gem_restore_fences(dev);
> > + if (!resume_from_s0ix) {
> > + intel_init_clock_gating(dev);
> > + i915_gem_restore_fences(dev);
> > + }
>
> This essentially amounts to another IS_VLV block. I might be able to live
> with a generic "supports runtime pm check".
>
> >
> > return ret;
> > }
> > @@ -1462,7 +1489,7 @@ static int intel_runtime_resume(struct device *device)
> > } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
> > ret = hsw_runtime_resume(dev_priv);
> > } else if (IS_VALLEYVIEW(dev)) {
> > - ret = vlv_runtime_resume(dev_priv);
> > + ret = vlv_runtime_resume(dev_priv, false);
> > } else {
> > WARN_ON(1);
> > ret = -ENODEV;
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index d604f4f..3a836c9 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -910,6 +910,7 @@ struct vlv_s0ix_state {
> > u32 gu_ctl0;
> > u32 gu_ctl1;
> > u32 clock_gate_dis2;
> > + u32 dpio_cfg_data;
>
> Register save/restore files considered evil. I've let vlv slip through,
> but I really want people to try harder to avoid these. The correct fix is
> to pimp the clock_gating_init functions and similar places to make sure we
> don't just keep the right value around, but also reinit in all places
> correctly.
> -Daniel
next prev parent reply other threads:[~2014-08-08 6:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 17:37 [PATCH 1/1] drm/i915: Adding Gfx Clock, Wake and Gunit save/restore logic in PM suspend/resume paths sagar.a.kamble
2014-07-28 18:20 ` Sagar Arun Kamble
2014-07-28 18:51 ` Daniel Vetter
2014-07-31 12:36 ` [RFC 1/1] FOR_UPSTREAM [VPG]: " sagar.a.kamble
2014-08-01 7:04 ` [PATCH 1/1] " sagar.a.kamble
2014-08-04 8:07 ` Daniel Vetter
2014-08-08 6:52 ` Sagar Arun Kamble [this message]
2014-08-08 7:42 ` Daniel Vetter
2014-08-08 8:59 ` Sagar Arun Kamble
2014-08-08 9:14 ` Imre Deak
2014-08-08 9:15 ` Daniel Vetter
2014-08-08 10:24 ` Sagar Arun Kamble
2014-08-08 11:34 ` Imre Deak
2014-08-08 13:43 ` Daniel Vetter
2014-08-08 14:01 ` Daniel Vetter
2014-08-12 10:51 ` [PATCH v3 1/1] drm/i915: Sharing Gfx Clock, Wake and Gunit save/restore logic using common handler for runtime/system s/r paths sagar.a.kamble
2014-08-12 12:00 ` Daniel Vetter
2014-08-13 13:47 ` Imre Deak
2014-08-13 15:04 ` Sagar Arun Kamble
2014-08-13 17:37 ` [PATCH 1/2] drm/i915: Created common handler for platform specific suspend/resume sagar.a.kamble
2014-08-13 17:37 ` [PATCH 2/2] drm/i915: Sharing platform specific sequence between runtime and system suspend/ resume paths sagar.a.kamble
2014-08-14 11:51 ` [PATCH 1/2] drm/i915: Created common handler for platform specific suspend/resume Imre Deak
2014-08-14 14:14 ` Daniel Vetter
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=1407480764.14962.2.camel@sagar-desktop \
--to=sagar.a.kamble@intel.com \
--cc=akash.goel@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.