All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: don't double-restore ARB mode bits for kms
@ 2014-01-16 15:49 Daniel Vetter
  2014-01-16 16:54 ` Paulo Zanoni
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2014-01-16 15:49 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Our init_clock_gating functions and related code should already take
care of this. And if they don't we'd better know.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_suspend.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index e6c90d1382b3..0b72fcd28d4d 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -348,12 +348,14 @@ int i915_save_state(struct drm_device *dev)
 
 	intel_disable_gt_powersave(dev);
 
-	/* Cache mode state */
-	if (INTEL_INFO(dev)->gen < 7)
-		dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
+	if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
+		/* Cache mode state */
+		if (INTEL_INFO(dev)->gen < 7)
+			dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
 
-	/* Memory Arbitration state */
-	dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
+		/* Memory Arbitration state */
+		dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
+	}
 
 	/* Scratch space */
 	for (i = 0; i < 16; i++) {
@@ -394,13 +396,15 @@ int i915_restore_state(struct drm_device *dev)
 		}
 	}
 
-	/* Cache mode state */
-	if (INTEL_INFO(dev)->gen < 7)
-		I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
-			   0xffff0000);
+	if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
+		/* Cache mode state */
+		if (INTEL_INFO(dev)->gen < 7)
+			I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
+				   0xffff0000);
 
-	/* Memory arbitration state */
-	I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000);
+		/* Memory arbitration state */
+		I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000);
+	}
 
 	for (i = 0; i < 16; i++) {
 		I915_WRITE(SWF00 + (i << 2), dev_priv->regfile.saveSWF0[i]);
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: don't double-restore ARB mode bits for kms
  2014-01-16 15:49 [PATCH] drm/i915: don't double-restore ARB mode bits for kms Daniel Vetter
@ 2014-01-16 16:54 ` Paulo Zanoni
  2014-01-16 16:57   ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo Zanoni @ 2014-01-16 16:54 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Intel Graphics Development

2014/1/16 Daniel Vetter <daniel.vetter@ffwll.ch>:
> Our init_clock_gating functions and related code should already take
> care of this. And if they don't we'd better know.

For both registers, I see functions applying specific workarounds, but
they only do the read-write-modify through _MASKED_BIT_ENABLE(). I
don't see anybody explicitly fully initializing the registers
anywhere. So we go with whatever the BIOS gives us at boot + our
changes to a few specific registers. At resume, we don't know so far
what we'll get, so I fear this patch may in fact cause a regression.


>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_suspend.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
> index e6c90d1382b3..0b72fcd28d4d 100644
> --- a/drivers/gpu/drm/i915/i915_suspend.c
> +++ b/drivers/gpu/drm/i915/i915_suspend.c
> @@ -348,12 +348,14 @@ int i915_save_state(struct drm_device *dev)
>
>         intel_disable_gt_powersave(dev);
>
> -       /* Cache mode state */
> -       if (INTEL_INFO(dev)->gen < 7)
> -               dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
> +       if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               /* Cache mode state */
> +               if (INTEL_INFO(dev)->gen < 7)
> +                       dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
>
> -       /* Memory Arbitration state */
> -       dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
> +               /* Memory Arbitration state */
> +               dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
> +       }
>
>         /* Scratch space */
>         for (i = 0; i < 16; i++) {
> @@ -394,13 +396,15 @@ int i915_restore_state(struct drm_device *dev)
>                 }
>         }
>
> -       /* Cache mode state */
> -       if (INTEL_INFO(dev)->gen < 7)
> -               I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
> -                          0xffff0000);
> +       if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               /* Cache mode state */
> +               if (INTEL_INFO(dev)->gen < 7)
> +                       I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
> +                                  0xffff0000);
>
> -       /* Memory arbitration state */
> -       I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000);
> +               /* Memory arbitration state */
> +               I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000);
> +       }
>
>         for (i = 0; i < 16; i++) {
>                 I915_WRITE(SWF00 + (i << 2), dev_priv->regfile.saveSWF0[i]);
> --
> 1.8.5.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: don't double-restore ARB mode bits for kms
  2014-01-16 16:54 ` Paulo Zanoni
@ 2014-01-16 16:57   ` Daniel Vetter
  2014-02-05 13:01     ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2014-01-16 16:57 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: Intel Graphics Development

On Thu, Jan 16, 2014 at 5:54 PM, Paulo Zanoni <przanoni@gmail.com> wrote:
> 2014/1/16 Daniel Vetter <daniel.vetter@ffwll.ch>:
>> Our init_clock_gating functions and related code should already take
>> care of this. And if they don't we'd better know.
>
> For both registers, I see functions applying specific workarounds, but
> they only do the read-write-modify through _MASKED_BIT_ENABLE(). I
> don't see anybody explicitly fully initializing the registers
> anywhere. So we go with whatever the BIOS gives us at boot + our
> changes to a few specific registers. At resume, we don't know so far
> what we'll get, so I fear this patch may in fact cause a regression.

That's part of the risk of it, but fixing those is a simple matter of
comparing register dumps. These two bits here are one of the very few
holdouts we have that depend upon the register save/restore code, and
I want to remove them. Since thus far this was a really good way to
hide random bugs.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: don't double-restore ARB mode bits for kms
  2014-01-16 16:57   ` Daniel Vetter
@ 2014-02-05 13:01     ` Jani Nikula
  2014-02-05 13:03       ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2014-02-05 13:01 UTC (permalink / raw)
  To: Daniel Vetter, Paulo Zanoni; +Cc: Intel Graphics Development

On Thu, 16 Jan 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> On Thu, Jan 16, 2014 at 5:54 PM, Paulo Zanoni <przanoni@gmail.com> wrote:
>> 2014/1/16 Daniel Vetter <daniel.vetter@ffwll.ch>:
>>> Our init_clock_gating functions and related code should already take
>>> care of this. And if they don't we'd better know.
>>
>> For both registers, I see functions applying specific workarounds, but
>> they only do the read-write-modify through _MASKED_BIT_ENABLE(). I
>> don't see anybody explicitly fully initializing the registers
>> anywhere. So we go with whatever the BIOS gives us at boot + our
>> changes to a few specific registers. At resume, we don't know so far
>> what we'll get, so I fear this patch may in fact cause a regression.
>
> That's part of the risk of it, but fixing those is a simple matter of
> comparing register dumps. These two bits here are one of the very few
> holdouts we have that depend upon the register save/restore code, and
> I want to remove them. Since thus far this was a really good way to
> hide random bugs.

I'm in favour of the patch in general, but I spotted at least

	/* On GEN3 we really need to make sure the ARB C3 LP bit is set */
	if (IS_GEN3(dev)) {
		I915_WRITE(MI_ARB_STATE,
			   _MASKED_BIT_ENABLE(MI_ARB_C3_LP_WRITE_ENABLE));
	}

in i915_gem_load() that won't be set on a suspend/resume cycle. Is that
going to be problem?

BR,
Jani.



-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: don't double-restore ARB mode bits for kms
  2014-02-05 13:01     ` Jani Nikula
@ 2014-02-05 13:03       ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2014-02-05 13:03 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Intel Graphics Development

On Wed, Feb 5, 2014 at 2:01 PM, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Thu, 16 Jan 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> On Thu, Jan 16, 2014 at 5:54 PM, Paulo Zanoni <przanoni@gmail.com> wrote:
>>> 2014/1/16 Daniel Vetter <daniel.vetter@ffwll.ch>:
>>>> Our init_clock_gating functions and related code should already take
>>>> care of this. And if they don't we'd better know.
>>>
>>> For both registers, I see functions applying specific workarounds, but
>>> they only do the read-write-modify through _MASKED_BIT_ENABLE(). I
>>> don't see anybody explicitly fully initializing the registers
>>> anywhere. So we go with whatever the BIOS gives us at boot + our
>>> changes to a few specific registers. At resume, we don't know so far
>>> what we'll get, so I fear this patch may in fact cause a regression.
>>
>> That's part of the risk of it, but fixing those is a simple matter of
>> comparing register dumps. These two bits here are one of the very few
>> holdouts we have that depend upon the register save/restore code, and
>> I want to remove them. Since thus far this was a really good way to
>> hide random bugs.
>
> I'm in favour of the patch in general, but I spotted at least
>
>         /* On GEN3 we really need to make sure the ARB C3 LP bit is set */
>         if (IS_GEN3(dev)) {
>                 I915_WRITE(MI_ARB_STATE,
>                            _MASKED_BIT_ENABLE(MI_ARB_C3_LP_WRITE_ENABLE));
>         }
>
> in i915_gem_load() that won't be set on a suspend/resume cycle. Is that
> going to be problem?

Yes, good catch. Somehow I've missed this when grepping.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-05 13:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 15:49 [PATCH] drm/i915: don't double-restore ARB mode bits for kms Daniel Vetter
2014-01-16 16:54 ` Paulo Zanoni
2014-01-16 16:57   ` Daniel Vetter
2014-02-05 13:01     ` Jani Nikula
2014-02-05 13:03       ` Daniel Vetter

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.