dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Get PM ref before accessing HW register
@ 2021-09-07 23:27 Vinay Belgaumkar
  2021-09-08  9:26 ` [Intel-gfx] " Tvrtko Ursulin
  0 siblings, 1 reply; 2+ messages in thread
From: Vinay Belgaumkar @ 2021-09-07 23:27 UTC (permalink / raw)
  To: intel-gfx, dri-devel; +Cc: Vinay Belgaumkar

Seeing these errors when GT is likely in suspend state-
"RPM wakelock ref not held during HW access"

Ensure GT is awake before trying to access HW registers. Avoid
reading the register if that is not the case.

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_rps.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
index 3489f5f0cac1..e1a198bbd135 100644
--- a/drivers/gpu/drm/i915/gt/intel_rps.c
+++ b/drivers/gpu/drm/i915/gt/intel_rps.c
@@ -1969,8 +1969,14 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
 u32 intel_rps_read_punit_req(struct intel_rps *rps)
 {
 	struct intel_uncore *uncore = rps_to_uncore(rps);
+	struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
+	intel_wakeref_t wakeref;
+	u32 freq = 0;
 
-	return intel_uncore_read(uncore, GEN6_RPNSWREQ);
+	with_intel_runtime_pm_if_in_use(rpm, wakeref)
+		freq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
+
+	return freq;
 }
 
 static u32 intel_rps_get_req(u32 pureq)
-- 
2.25.0


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

* Re: [Intel-gfx] [PATCH] drm/i915: Get PM ref before accessing HW register
  2021-09-07 23:27 [PATCH] drm/i915: Get PM ref before accessing HW register Vinay Belgaumkar
@ 2021-09-08  9:26 ` Tvrtko Ursulin
  0 siblings, 0 replies; 2+ messages in thread
From: Tvrtko Ursulin @ 2021-09-08  9:26 UTC (permalink / raw)
  To: Vinay Belgaumkar, intel-gfx, dri-devel


On 08/09/2021 00:27, Vinay Belgaumkar wrote:
> Seeing these errors when GT is likely in suspend state-
> "RPM wakelock ref not held during HW access"
> 
> Ensure GT is awake before trying to access HW registers. Avoid
> reading the register if that is not the case.
> 
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

Fixes: 41e5c17ebfc2 ("drm/i915/guc/slpc: Sysfs hooks for SLPC")
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

> ---
>   drivers/gpu/drm/i915/gt/intel_rps.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 3489f5f0cac1..e1a198bbd135 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -1969,8 +1969,14 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
>   u32 intel_rps_read_punit_req(struct intel_rps *rps)
>   {
>   	struct intel_uncore *uncore = rps_to_uncore(rps);
> +	struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
> +	intel_wakeref_t wakeref;
> +	u32 freq = 0;
>   
> -	return intel_uncore_read(uncore, GEN6_RPNSWREQ);
> +	with_intel_runtime_pm_if_in_use(rpm, wakeref)
> +		freq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
> +
> +	return freq;
>   }
>   
>   static u32 intel_rps_get_req(u32 pureq)
> 

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

end of thread, other threads:[~2021-09-08  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 23:27 [PATCH] drm/i915: Get PM ref before accessing HW register Vinay Belgaumkar
2021-09-08  9:26 ` [Intel-gfx] " Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).