[Intel-gfx] [PATCH 08/11] drm/i915: Guard rpm helpers in rpm_get/put

Tilak Tangudu tilak.tangudu at intel.com
Tue Jun 21 12:35:13 UTC 2022


Guard rpm helpers in rpm_get/put with is_intel_rpm_allowed
to avoid rpm helpers in intel_engine/gt_pm_get/put
called from  user_forcewake, intel_gt_resume, i915_ttm_accel_move
and intel_context_enter/exit_engine

Signed-off-by: Tilak Tangudu <tilak.tangudu at intel.com>
---
 drivers/gpu/drm/i915/intel_wakeref.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_wakeref.c b/drivers/gpu/drm/i915/intel_wakeref.c
index dfd87d082218..00a5335387a4 100644
--- a/drivers/gpu/drm/i915/intel_wakeref.c
+++ b/drivers/gpu/drm/i915/intel_wakeref.c
@@ -11,15 +11,17 @@
 
 static void rpm_get(struct intel_wakeref *wf)
 {
-	wf->wakeref = intel_runtime_pm_get(wf->rpm);
+	if (is_intel_rpm_allowed(wf->rpm))
+		wf->wakeref = intel_runtime_pm_get(wf->rpm);
 }
 
 static void rpm_put(struct intel_wakeref *wf)
 {
 	intel_wakeref_t wakeref = fetch_and_zero(&wf->wakeref);
 
-	intel_runtime_pm_put(wf->rpm, wakeref);
-	INTEL_WAKEREF_BUG_ON(!wakeref);
+	if (wakeref)
+		intel_runtime_pm_put(wf->rpm, wakeref);
+
 }
 
 int __intel_wakeref_get_first(struct intel_wakeref *wf)
-- 
2.25.1



More information about the Intel-gfx mailing list