Re: [Intel-gfx] [PATCH] drm/i915: Fix up the forcewake timer initialization

2014-03-19 Thread Daniel Vetter
On Wed, Mar 19, 2014 at 8:26 AM, Chris Wilson  wrote:
> On Tue, Mar 18, 2014 at 05:41:54PM -0700, Ben Widawsky wrote:
>> On Tue, Mar 18, 2014 at 04:31:03PM +0100, Daniel Vetter wrote:
>> > This is a regression introduced in
>> >
>> > commit 0294ae7b44bba7ab0d4cef9a8736287f38bdb4fd
>> > Author: Chris Wilson 
>> > Date:   Thu Mar 13 12:00:29 2014 +
>> >
>> > drm/i915: Consolidate forcewake resetting to a single function
>> >
>> > The reordered setup sequence ended up calling del_timer_sync before
>> > the timer was set up correctly, resulting in endless hilarity when
>> > loading the driver.
>> >
>> > Compared to Ben's patch (which moved around the setup_timer call to
>> > sanitize_early) this moves the sanitize_early call around in the
>> > driver load call. This way we avoid calling setup_timer again in the
>> > resume code (where we also call sanitize_early).
>> >
>> > Cc: Chris Wilson 
>> > Cc: Mika Kuoppala 
>> > Cc: Ben Widawsky 
>> > Tested-by: Rodrigo Vivi 
>> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76242
>> > Signed-off-by: Daniel Vetter 
>> > ---
>> >  drivers/gpu/drm/i915/i915_dma.c | 2 --
>> >  drivers/gpu/drm/i915/intel_uncore.c | 2 ++
>> >  2 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_dma.c 
>> > b/drivers/gpu/drm/i915/i915_dma.c
>> > index e4d2b9f15ae2..9faee49f210d 100644
>> > --- a/drivers/gpu/drm/i915/i915_dma.c
>> > +++ b/drivers/gpu/drm/i915/i915_dma.c
>> > @@ -1608,8 +1608,6 @@ int i915_driver_load(struct drm_device *dev, 
>> > unsigned long flags)
>> > goto put_bridge;
>> > }
>> >
>> > -   intel_uncore_early_sanitize(dev);
>> > -
>> > /* This must be called before any calls to HAS_PCH_* */
>> > intel_detect_pch(dev);
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
>> > b/drivers/gpu/drm/i915/intel_uncore.c
>> > index e2e328d86aff..c3832d9270a6 100644
>> > --- a/drivers/gpu/drm/i915/intel_uncore.c
>> > +++ b/drivers/gpu/drm/i915/intel_uncore.c
>> > @@ -736,6 +736,8 @@ void intel_uncore_init(struct drm_device *dev)
>> > setup_timer(&dev_priv->uncore.force_wake_timer,
>> > gen6_force_wake_timer, (unsigned long)dev_priv);
>> >
>> > +   intel_uncore_early_sanitize(dev);
>> > +
>> > if (IS_VALLEYVIEW(dev)) {
>> > dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;
>> > dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put;
>>
>> If you only want to setup_timer once, the setup_timer call should be in
>> intel_uncore_init() which is the only one called only at load time. And
>> of course, this is where the bug is. Otherwise, thaw calls
>> uncore_early_sanitize, which will setup_timer again (which I thought was
>> your complaint with my original patch).
>
> I don't think we want to stop checking for garbage in the forcewake
> registers upon resume though?

We still have a call to early_sanitize in i915_thaw, which should take
care of this. My intention here was to only touch codepaths
exclusively run at driver load time, and both i915_driver_load and
uncore_init aren't used anywhere else. Or do I miss something and
should wait for the morning coffee to kick in?

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Fix up the forcewake timer initialization

2014-03-19 Thread Chris Wilson
On Tue, Mar 18, 2014 at 05:41:54PM -0700, Ben Widawsky wrote:
> On Tue, Mar 18, 2014 at 04:31:03PM +0100, Daniel Vetter wrote:
> > This is a regression introduced in
> > 
> > commit 0294ae7b44bba7ab0d4cef9a8736287f38bdb4fd
> > Author: Chris Wilson 
> > Date:   Thu Mar 13 12:00:29 2014 +
> > 
> > drm/i915: Consolidate forcewake resetting to a single function
> > 
> > The reordered setup sequence ended up calling del_timer_sync before
> > the timer was set up correctly, resulting in endless hilarity when
> > loading the driver.
> > 
> > Compared to Ben's patch (which moved around the setup_timer call to
> > sanitize_early) this moves the sanitize_early call around in the
> > driver load call. This way we avoid calling setup_timer again in the
> > resume code (where we also call sanitize_early).
> > 
> > Cc: Chris Wilson 
> > Cc: Mika Kuoppala 
> > Cc: Ben Widawsky 
> > Tested-by: Rodrigo Vivi 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76242
> > Signed-off-by: Daniel Vetter 
> > ---
> >  drivers/gpu/drm/i915/i915_dma.c | 2 --
> >  drivers/gpu/drm/i915/intel_uncore.c | 2 ++
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c 
> > b/drivers/gpu/drm/i915/i915_dma.c
> > index e4d2b9f15ae2..9faee49f210d 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -1608,8 +1608,6 @@ int i915_driver_load(struct drm_device *dev, unsigned 
> > long flags)
> > goto put_bridge;
> > }
> >  
> > -   intel_uncore_early_sanitize(dev);
> > -
> > /* This must be called before any calls to HAS_PCH_* */
> > intel_detect_pch(dev);
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
> > b/drivers/gpu/drm/i915/intel_uncore.c
> > index e2e328d86aff..c3832d9270a6 100644
> > --- a/drivers/gpu/drm/i915/intel_uncore.c
> > +++ b/drivers/gpu/drm/i915/intel_uncore.c
> > @@ -736,6 +736,8 @@ void intel_uncore_init(struct drm_device *dev)
> > setup_timer(&dev_priv->uncore.force_wake_timer,
> > gen6_force_wake_timer, (unsigned long)dev_priv);
> >  
> > +   intel_uncore_early_sanitize(dev);
> > +
> > if (IS_VALLEYVIEW(dev)) {
> > dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;
> > dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put;
> 
> If you only want to setup_timer once, the setup_timer call should be in
> intel_uncore_init() which is the only one called only at load time. And
> of course, this is where the bug is. Otherwise, thaw calls
> uncore_early_sanitize, which will setup_timer again (which I thought was
> your complaint with my original patch).

I don't think we want to stop checking for garbage in the forcewake
registers upon resume though?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Fix up the forcewake timer initialization

2014-03-19 Thread Daniel Vetter
On Wed, Mar 19, 2014 at 1:41 AM, Ben Widawsky
 wrote:
>> diff --git a/drivers/gpu/drm/i915/i915_dma.c 
>> b/drivers/gpu/drm/i915/i915_dma.c
>> index e4d2b9f15ae2..9faee49f210d 100644
>> --- a/drivers/gpu/drm/i915/i915_dma.c
>> +++ b/drivers/gpu/drm/i915/i915_dma.c
>> @@ -1608,8 +1608,6 @@ int i915_driver_load(struct drm_device *dev, unsigned 
>> long flags)
>>   goto put_bridge;
>>   }
>>
>> - intel_uncore_early_sanitize(dev);
>> -
>>   /* This must be called before any calls to HAS_PCH_* */
>>   intel_detect_pch(dev);
>>
>> diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
>> b/drivers/gpu/drm/i915/intel_uncore.c
>> index e2e328d86aff..c3832d9270a6 100644
>> --- a/drivers/gpu/drm/i915/intel_uncore.c
>> +++ b/drivers/gpu/drm/i915/intel_uncore.c
>> @@ -736,6 +736,8 @@ void intel_uncore_init(struct drm_device *dev)
>>   setup_timer(&dev_priv->uncore.force_wake_timer,
>>   gen6_force_wake_timer, (unsigned long)dev_priv);
>>
>> + intel_uncore_early_sanitize(dev);
>> +
>>   if (IS_VALLEYVIEW(dev)) {
>>   dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;
>>   dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put;
>
> If you only want to setup_timer once, the setup_timer call should be in
> intel_uncore_init() which is the only one called only at load time. And
> of course, this is where the bug is. Otherwise, thaw calls
> uncore_early_sanitize, which will setup_timer again (which I thought was
> your complaint with my original patch).
>
> How about this, (only minimally tested):

Yeah, would work also but since everyone was blocked on the regression
I've moved forward with my color choice of moving 1 line around ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Fix up the forcewake timer initialization

2014-03-18 Thread Ben Widawsky
On Tue, Mar 18, 2014 at 04:31:03PM +0100, Daniel Vetter wrote:
> This is a regression introduced in
> 
> commit 0294ae7b44bba7ab0d4cef9a8736287f38bdb4fd
> Author: Chris Wilson 
> Date:   Thu Mar 13 12:00:29 2014 +
> 
> drm/i915: Consolidate forcewake resetting to a single function
> 
> The reordered setup sequence ended up calling del_timer_sync before
> the timer was set up correctly, resulting in endless hilarity when
> loading the driver.
> 
> Compared to Ben's patch (which moved around the setup_timer call to
> sanitize_early) this moves the sanitize_early call around in the
> driver load call. This way we avoid calling setup_timer again in the
> resume code (where we also call sanitize_early).
> 
> Cc: Chris Wilson 
> Cc: Mika Kuoppala 
> Cc: Ben Widawsky 
> Tested-by: Rodrigo Vivi 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76242
> Signed-off-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 2 --
>  drivers/gpu/drm/i915/intel_uncore.c | 2 ++
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index e4d2b9f15ae2..9faee49f210d 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1608,8 +1608,6 @@ int i915_driver_load(struct drm_device *dev, unsigned 
> long flags)
>   goto put_bridge;
>   }
>  
> - intel_uncore_early_sanitize(dev);
> -
>   /* This must be called before any calls to HAS_PCH_* */
>   intel_detect_pch(dev);
>  
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
> b/drivers/gpu/drm/i915/intel_uncore.c
> index e2e328d86aff..c3832d9270a6 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -736,6 +736,8 @@ void intel_uncore_init(struct drm_device *dev)
>   setup_timer(&dev_priv->uncore.force_wake_timer,
>   gen6_force_wake_timer, (unsigned long)dev_priv);
>  
> + intel_uncore_early_sanitize(dev);
> +
>   if (IS_VALLEYVIEW(dev)) {
>   dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;
>   dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put;

If you only want to setup_timer once, the setup_timer call should be in
intel_uncore_init() which is the only one called only at load time. And
of course, this is where the bug is. Otherwise, thaw calls
uncore_early_sanitize, which will setup_timer again (which I thought was
your complaint with my original patch).

How about this, (only minimally tested):

diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
b/drivers/gpu/drm/i915/intel_uncore.c
index e2e328d..7ef5aa3 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -387,8 +387,6 @@ void intel_uncore_early_sanitize(struct drm_device *dev)
if (IS_GEN6(dev) || IS_GEN7(dev))
__raw_i915_write32(dev_priv, GTFIFODBG,
   __raw_i915_read32(dev_priv, GTFIFODBG));
-
-   intel_uncore_forcewake_reset(dev, false);
 }
 
 void intel_uncore_sanitize(struct drm_device *dev)
@@ -413,6 +411,8 @@ void intel_uncore_sanitize(struct drm_device *dev)
mutex_unlock(&dev_priv->rps.hw_lock);
 
}
+
+   intel_uncore_forcewake_reset(dev, false);
 }
 
 /*
@@ -846,7 +846,6 @@ void intel_uncore_fini(struct drm_device *dev)
 {
/* Paranoia: make sure we have disabled everything before we exit. */
intel_uncore_sanitize(dev);
-   intel_uncore_forcewake_reset(dev, false);
 }
 


-- 
Ben Widawsky, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Fix up the forcewake timer initialization

2014-03-18 Thread Daniel Vetter
This is a regression introduced in

commit 0294ae7b44bba7ab0d4cef9a8736287f38bdb4fd
Author: Chris Wilson 
Date:   Thu Mar 13 12:00:29 2014 +

drm/i915: Consolidate forcewake resetting to a single function

The reordered setup sequence ended up calling del_timer_sync before
the timer was set up correctly, resulting in endless hilarity when
loading the driver.

Compared to Ben's patch (which moved around the setup_timer call to
sanitize_early) this moves the sanitize_early call around in the
driver load call. This way we avoid calling setup_timer again in the
resume code (where we also call sanitize_early).

Cc: Chris Wilson 
Cc: Mika Kuoppala 
Cc: Ben Widawsky 
Tested-by: Rodrigo Vivi 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76242
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_dma.c | 2 --
 drivers/gpu/drm/i915/intel_uncore.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e4d2b9f15ae2..9faee49f210d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1608,8 +1608,6 @@ int i915_driver_load(struct drm_device *dev, unsigned 
long flags)
goto put_bridge;
}
 
-   intel_uncore_early_sanitize(dev);
-
/* This must be called before any calls to HAS_PCH_* */
intel_detect_pch(dev);
 
diff --git a/drivers/gpu/drm/i915/intel_uncore.c 
b/drivers/gpu/drm/i915/intel_uncore.c
index e2e328d86aff..c3832d9270a6 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -736,6 +736,8 @@ void intel_uncore_init(struct drm_device *dev)
setup_timer(&dev_priv->uncore.force_wake_timer,
gen6_force_wake_timer, (unsigned long)dev_priv);
 
+   intel_uncore_early_sanitize(dev);
+
if (IS_VALLEYVIEW(dev)) {
dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;
dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put;
-- 
1.8.5.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx