[PATCH 6/7] HACK - add a lot of logs

Luca Coelho luciano.coelho at intel.com
Thu Mar 14 07:44:24 UTC 2024


Logs for debugging during implementation.

Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
---
 drivers/gpu/drm/i915/display/intel_dmc_wl.c | 51 +++++++++++++++++++--
 1 file changed, 48 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dmc_wl.c b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
index 8ad6d70a01b0..ccb5c6a83d99 100644
--- a/drivers/gpu/drm/i915/display/intel_dmc_wl.c
+++ b/drivers/gpu/drm/i915/display/intel_dmc_wl.c
@@ -61,6 +61,10 @@ static void __intel_dmc_wl_release(struct drm_i915_private *i915)
 
 	WARN_ON(refcount_read(&wl->refcount));
 
+	drm_info(&i915->drm,
+		 "DMC_WAKELOCK1_CTL to be released (refcount = %d)\n",
+		 refcount_read(&wl->refcount));
+
 	queue_delayed_work(i915->unordered_wq, &wl->work,
 			   msecs_to_jiffies(DMC_WAKELOCK_HOLD_TIME));
 }
@@ -72,6 +76,7 @@ static void intel_dmc_wl_work(struct work_struct *work)
 	struct drm_i915_private *i915 =
 		container_of(wl, struct drm_i915_private, display.wl);
 	unsigned long flags;
+	u32 ctl_value;
 
 	spin_lock_irqsave(&wl->lock, flags);
 
@@ -79,13 +84,24 @@ static void intel_dmc_wl_work(struct work_struct *work)
 	if (!refcount_read(&wl->refcount))
 		goto out_unlock;
 
-	__intel_de_rmw_nowl(i915, DMC_WAKELOCK1_CTL, DMC_WAKELOCK_CTL_REQ, 0);
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL work running (refcount = %d)\n",
+		 refcount_read(&wl->refcount));
+
+	ctl_value = __intel_de_rmw_nowl(i915, DMC_WAKELOCK1_CTL,
+					DMC_WAKELOCK_CTL_REQ, 0);
+
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL 0x%0x before\n", ctl_value);
+
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL read 0x%0x immediately after\n",
+		 intel_de_read(i915, DMC_WAKELOCK1_CTL));
 
 	WARN_RATELIMIT(__intel_wait_for_register_nowl(i915,  DMC_WAKELOCK1_CTL,
 						      DMC_WAKELOCK_CTL_ACK, 0,
 						      DMC_WAKELOCK_CTL_TIMEOUT),
 		       "DMC wakelock release timed out");
 
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL read 0x%0x after delay\n",
+		 intel_de_read(i915, DMC_WAKELOCK1_CTL));
 out_unlock:
 	spin_unlock_irqrestore(&wl->lock, flags);
 }
@@ -129,6 +145,9 @@ void intel_dmc_wl_enable(struct drm_i915_private *i915)
 	if (wl->enabled)
 		goto out_unlock;
 
+	drm_info(&i915->drm, "DMC_WAKELOCK_CFG refcount %d\n",
+		 refcount_read(&wl->refcount));
+
 	/*
 	 * Enable wakelock in DMC.  We shouldn't try to take the
 	 * wakelock, because we're just enabling it, so call the
@@ -136,6 +155,9 @@ void intel_dmc_wl_enable(struct drm_i915_private *i915)
 	 */
 	__intel_de_rmw_nowl(i915, DMC_WAKELOCK_CFG, 0, DMC_WAKELOCK_CFG_ENABLE);
 
+	drm_info(&i915->drm, "DMC_WAKELOCK_CFG read 0x%0x\n",
+		 intel_de_read(i915, DMC_WAKELOCK_CFG));
+
 	wl->enabled = true;
 
 out_unlock:
@@ -180,6 +202,7 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, i915_reg_t reg)
 {
 	struct intel_dmc_wl *wl = &i915->display.wl;
 	unsigned long flags;
+	u32 ctl_value;
 
 	if (!i915->display.params.enable_dmc_wl ||
 	    DISPLAY_VER(i915) < 20)
@@ -195,12 +218,25 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, i915_reg_t reg)
 
 	cancel_delayed_work(&wl->work);
 
-	if (refcount_inc_not_zero(&wl->refcount))
+	if (refcount_inc_not_zero(&wl->refcount)) {
+		drm_info(&i915->drm,
+			 "DMC_WAKELOCK1_CTL refcount is now %d -- wakelock already taken\n",
+			 refcount_read(&wl->refcount));
 		goto out_unlock;
+	}
 
 	refcount_set(&wl->refcount, 1);
 
-	__intel_de_rmw_nowl(i915, DMC_WAKELOCK1_CTL, 0, DMC_WAKELOCK_CTL_REQ);
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL refcount is now %d\n",
+		 refcount_read(&wl->refcount));
+
+	ctl_value = __intel_de_rmw_nowl(i915, DMC_WAKELOCK1_CTL, 0,
+					DMC_WAKELOCK_CTL_REQ);
+
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL 0x%0x before\n", ctl_value);
+
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL read 0x%0x immediately after\n",
+		 intel_de_read(i915, DMC_WAKELOCK1_CTL));
 
 	WARN_RATELIMIT(__intel_wait_for_register_nowl(i915,  DMC_WAKELOCK1_CTL,
 						      DMC_WAKELOCK_CTL_ACK,
@@ -208,6 +244,9 @@ void intel_dmc_wl_get(struct drm_i915_private *i915, i915_reg_t reg)
 						      DMC_WAKELOCK_CTL_TIMEOUT),
 		       "DMC wakelock ack timed out");
 
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL read 0x%0x after delay\n",
+		 intel_de_read(i915, DMC_WAKELOCK1_CTL));
+
 out_unlock:
 	spin_unlock_irqrestore(&wl->lock, flags);
 }
@@ -234,11 +273,17 @@ void intel_dmc_wl_put(struct drm_i915_private *i915, i915_reg_t reg)
 		goto out_unlock;
 
 	if (refcount_dec_and_test(&wl->refcount)) {
+		drm_info(&i915->drm,
+			 "DMC_WAKELOCK1_CTL refcount is now ZERO\n");
+
 		__intel_dmc_wl_release(i915);
 
 		goto out_unlock;
 	}
 
+	drm_info(&i915->drm, "DMC_WAKELOCK1_CTL refcount is now %d\n",
+		 refcount_read(&wl->refcount));
+
 out_unlock:
 	spin_unlock_irqrestore(&wl->lock, flags);
 }
-- 
2.39.2



More information about the Intel-gfx-trybot mailing list