diff mbox

[1/1] drm/i915: Hold RPM wakelock while initializing OA buffer

Message ID 1498585181-23048-1-git-send-email-sagar.a.kamble@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

sagar.a.kamble@intel.com June 27, 2017, 5:39 p.m. UTC
OA buffer initialization involves access to HW registers to set
the OA base, head and tail. Ensure device is awake while setting
these. With this, all oa.ops are covered under RPM and forcewake
wakelock.

Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Lionel Landwerlin June 28, 2017, 10:44 a.m. UTC | #1
Hi Sagar,

Thanks for this patch, it all looks good to me :

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

On 27/06/17 20:39, Sagar Arun Kamble wrote:
> OA buffer initialization involves access to HW registers to set
> the OA base, head and tail. Ensure device is awake while setting
> these. With this, all oa.ops are covered under RPM and forcewake
> wakelock.
>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 38c4440..9cd22f8 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2067,10 +2067,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   			return ret;
>   	}
>   
> -	ret = alloc_oa_buffer(dev_priv);
> -	if (ret)
> -		goto err_oa_buf_alloc;
> -
>   	/* PRM - observability performance counters:
>   	 *
>   	 *   OACONTROL, performance counter enable, note:
> @@ -2086,6 +2082,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   	intel_runtime_pm_get(dev_priv);
>   	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
>   
> +	ret = alloc_oa_buffer(dev_priv);
> +	if (ret)
> +		goto err_oa_buf_alloc;
> +
>   	ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv);
>   	if (ret)
>   		goto err_enable;
> @@ -2097,11 +2097,11 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   	return 0;
>   
>   err_enable:
> -	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> -	intel_runtime_pm_put(dev_priv);
>   	free_oa_buffer(dev_priv);
>   
>   err_oa_buf_alloc:
> +	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> +	intel_runtime_pm_put(dev_priv);
>   	if (stream->ctx)
>   		oa_put_render_ctx_id(stream);
>
Lionel Landwerlin June 29, 2017, 9:35 a.m. UTC | #2
Cc: drm-intel-fixes@lists.freedesktop.org
Fixes: d79651522e89c ("drm/i915: Enable i915 perf stream for Haswell OA 
unit")

On 27/06/17 18:39, Sagar Arun Kamble wrote:
> OA buffer initialization involves access to HW registers to set
> the OA base, head and tail. Ensure device is awake while setting
> these. With this, all oa.ops are covered under RPM and forcewake
> wakelock.
>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 38c4440..9cd22f8 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2067,10 +2067,6 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   			return ret;
>   	}
>   
> -	ret = alloc_oa_buffer(dev_priv);
> -	if (ret)
> -		goto err_oa_buf_alloc;
> -
>   	/* PRM - observability performance counters:
>   	 *
>   	 *   OACONTROL, performance counter enable, note:
> @@ -2086,6 +2082,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   	intel_runtime_pm_get(dev_priv);
>   	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
>   
> +	ret = alloc_oa_buffer(dev_priv);
> +	if (ret)
> +		goto err_oa_buf_alloc;
> +
>   	ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv);
>   	if (ret)
>   		goto err_enable;
> @@ -2097,11 +2097,11 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
>   	return 0;
>   
>   err_enable:
> -	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> -	intel_runtime_pm_put(dev_priv);
>   	free_oa_buffer(dev_priv);
>   
>   err_oa_buf_alloc:
> +	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> +	intel_runtime_pm_put(dev_priv);
>   	if (stream->ctx)
>   		oa_put_render_ctx_id(stream);
>
Lionel Landwerlin June 30, 2017, 1:48 p.m. UTC | #3
Hi Daniel,

Any chance on getting this patch upstream?

Thanks a lot!

-
Lionel

On 29/06/17 10:35, Lionel Landwerlin wrote:
> Cc: drm-intel-fixes@lists.freedesktop.org
> Fixes: d79651522e89c ("drm/i915: Enable i915 perf stream for Haswell 
> OA unit")
>
> On 27/06/17 18:39, Sagar Arun Kamble wrote:
>> OA buffer initialization involves access to HW registers to set
>> the OA base, head and tail. Ensure device is awake while setting
>> these. With this, all oa.ops are covered under RPM and forcewake
>> wakelock.
>>
>> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_perf.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
>> b/drivers/gpu/drm/i915/i915_perf.c
>> index 38c4440..9cd22f8 100644
>> --- a/drivers/gpu/drm/i915/i915_perf.c
>> +++ b/drivers/gpu/drm/i915/i915_perf.c
>> @@ -2067,10 +2067,6 @@ static int i915_oa_stream_init(struct 
>> i915_perf_stream *stream,
>>               return ret;
>>       }
>>   -    ret = alloc_oa_buffer(dev_priv);
>> -    if (ret)
>> -        goto err_oa_buf_alloc;
>> -
>>       /* PRM - observability performance counters:
>>        *
>>        *   OACONTROL, performance counter enable, note:
>> @@ -2086,6 +2082,10 @@ static int i915_oa_stream_init(struct 
>> i915_perf_stream *stream,
>>       intel_runtime_pm_get(dev_priv);
>>       intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
>>   +    ret = alloc_oa_buffer(dev_priv);
>> +    if (ret)
>> +        goto err_oa_buf_alloc;
>> +
>>       ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv);
>>       if (ret)
>>           goto err_enable;
>> @@ -2097,11 +2097,11 @@ static int i915_oa_stream_init(struct 
>> i915_perf_stream *stream,
>>       return 0;
>>     err_enable:
>> -    intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
>> -    intel_runtime_pm_put(dev_priv);
>>       free_oa_buffer(dev_priv);
>>     err_oa_buf_alloc:
>> +    intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
>> +    intel_runtime_pm_put(dev_priv);
>>       if (stream->ctx)
>>           oa_put_render_ctx_id(stream);
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst July 3, 2017, 10:09 a.m. UTC | #4
Op 30-06-17 om 15:48 schreef Lionel Landwerlin:
> Hi Daniel,
>
> Any chance on getting this patch upstream? 
Applied, thanks.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 38c4440..9cd22f8 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2067,10 +2067,6 @@  static int i915_oa_stream_init(struct i915_perf_stream *stream,
 			return ret;
 	}
 
-	ret = alloc_oa_buffer(dev_priv);
-	if (ret)
-		goto err_oa_buf_alloc;
-
 	/* PRM - observability performance counters:
 	 *
 	 *   OACONTROL, performance counter enable, note:
@@ -2086,6 +2082,10 @@  static int i915_oa_stream_init(struct i915_perf_stream *stream,
 	intel_runtime_pm_get(dev_priv);
 	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
 
+	ret = alloc_oa_buffer(dev_priv);
+	if (ret)
+		goto err_oa_buf_alloc;
+
 	ret = dev_priv->perf.oa.ops.enable_metric_set(dev_priv);
 	if (ret)
 		goto err_enable;
@@ -2097,11 +2097,11 @@  static int i915_oa_stream_init(struct i915_perf_stream *stream,
 	return 0;
 
 err_enable:
-	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
-	intel_runtime_pm_put(dev_priv);
 	free_oa_buffer(dev_priv);
 
 err_oa_buf_alloc:
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
+	intel_runtime_pm_put(dev_priv);
 	if (stream->ctx)
 		oa_put_render_ctx_id(stream);