diff mbox

[2/8] drm/i915/vlv/chv: Move resume_prepare() after uncore_early_sanitize()

Message ID 1431975235-1037-3-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien May 18, 2015, 6:53 p.m. UTC
It's probably a good idea to run the uncore sanitize function before
vlv_resume_prepare() writes registers.

At the same time, moving the debug message makes it dispay something if
skl_resume_prepare ever returns non 0. Oh, and re-order the if/else
ladder to have some semblence of ordering.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Imre Deak May 18, 2015, 7:30 p.m. UTC | #1
On Mon, 2015-05-18 at 19:53 +0100, Damien Lespiau wrote:
> It's probably a good idea to run the uncore sanitize function before
> vlv_resume_prepare() writes registers.
> 
> At the same time, moving the debug message makes it dispay something if
> skl_resume_prepare ever returns non 0. Oh, and re-order the if/else
> ladder to have some semblence of ordering.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 5cc57f2..5a9399c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -808,17 +808,17 @@ static int i915_drm_resume_early(struct drm_device *dev)
>  
>  	pci_set_master(dev->pdev);
>  
> -	if (IS_VALLEYVIEW(dev_priv))
> -		ret = vlv_resume_prepare(dev_priv, false);
> -	if (ret)
> -		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
> -
>  	intel_uncore_early_sanitize(dev, true);
>  
> -	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
> -		hsw_disable_pc8(dev_priv);
> -	else if (IS_SKYLAKE(dev_priv))
> +	if (IS_SKYLAKE(dev_priv))
>  		ret = skl_resume_prepare(dev_priv);
> +	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
> +		hsw_disable_pc8(dev_priv);
> +	else if (IS_VALLEYVIEW(dev_priv))
> +		ret = vlv_resume_prepare(dev_priv, false);
> +
> +	if (ret)
> +		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);

vlv_resume_prepare() needs to run before intel_uncore_early_sanitize(),
as the former includes the steps to wake the HW from RC6 for the first
time after suspend. At the time intel_resume_prepare() was removed, I
suggested to instead split out the part from vlv_resume_prepare() that
needs to be done early into a separate function, so that would be one
way to go about this.

>  
>  	intel_uncore_sanitize(dev);
>  	intel_power_domains_init_hw(dev_priv);
Lespiau, Damien May 19, 2015, 10:44 a.m. UTC | #2
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 5cc57f2..5a9399c 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -808,17 +808,17 @@ static int i915_drm_resume_early(struct drm_device *dev)
> >  
> >  	pci_set_master(dev->pdev);
> >  
> > -	if (IS_VALLEYVIEW(dev_priv))
> > -		ret = vlv_resume_prepare(dev_priv, false);
> > -	if (ret)
> > -		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
> > -
> >  	intel_uncore_early_sanitize(dev, true);
> >  
> > -	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
> > -		hsw_disable_pc8(dev_priv);
> > -	else if (IS_SKYLAKE(dev_priv))
> > +	if (IS_SKYLAKE(dev_priv))
> >  		ret = skl_resume_prepare(dev_priv);
> > +	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
> > +		hsw_disable_pc8(dev_priv);
> > +	else if (IS_VALLEYVIEW(dev_priv))
> > +		ret = vlv_resume_prepare(dev_priv, false);
> > +
> > +	if (ret)
> > +		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
> 
> vlv_resume_prepare() needs to run before intel_uncore_early_sanitize(),
> as the former includes the steps to wake the HW from RC6 for the first
> time after suspend. At the time intel_resume_prepare() was removed, I
> suggested to instead split out the part from vlv_resume_prepare() that
> needs to be done early into a separate function, so that would be one
> way to go about this.

Oh, that was a carefully crafted trap! Will see what I can do.
Thankfully the active ingredients of that series don't depend on that
refactoring.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 5cc57f2..5a9399c 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -808,17 +808,17 @@  static int i915_drm_resume_early(struct drm_device *dev)
 
 	pci_set_master(dev->pdev);
 
-	if (IS_VALLEYVIEW(dev_priv))
-		ret = vlv_resume_prepare(dev_priv, false);
-	if (ret)
-		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
-
 	intel_uncore_early_sanitize(dev, true);
 
-	if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
-		hsw_disable_pc8(dev_priv);
-	else if (IS_SKYLAKE(dev_priv))
+	if (IS_SKYLAKE(dev_priv))
 		ret = skl_resume_prepare(dev_priv);
+	else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
+		hsw_disable_pc8(dev_priv);
+	else if (IS_VALLEYVIEW(dev_priv))
+		ret = vlv_resume_prepare(dev_priv, false);
+
+	if (ret)
+		DRM_ERROR("Resume prepare failed: %d,Continuing resume\n", ret);
 
 	intel_uncore_sanitize(dev);
 	intel_power_domains_init_hw(dev_priv);