Skip to contentSkip to conversation

drm/amd/display: prevent register access while in IPS

PATCH In review Hamza Mahfooz 2 participants 2 messages Jun 3, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: prevent register access while in IPS

We can't read/write to DCN registers while in IPS. Since, that can cause the system to hang. So, before proceeding with the access in that scenario, force the system out of IPS.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
index 059f78c8cd04..c8bc4098ed18 100644
@@ -11796,6 +11796,12 @@ void amdgpu_dm_trigger_timing_sync(struct drm_device *dev)
 	mutex_unlock(&adev->dm.dc_lock);
 }
 
+static inline void amdgpu_dm_exit_ips_for_hw_access(struct dc *dc)
+{
+	if (dc->ctx->dmub_srv && !dc->ctx->dmub_srv->idle_exit_counter)
+		dc_exit_ips_for_hw_access(dc);
+}
+
 void dm_write_reg_func(const struct dc_context *ctx, uint32_t address,
 		       u32 value, const char *func_name)
 {
@@ -11806,6 +11812,8 @@ void dm_write_reg_func(const struct dc_context *ctx, uint32_t address,
 		return;
 	}
 #endif
+
+	amdgpu_dm_exit_ips_for_hw_access(ctx->dc);
 	cgs_write_register(ctx->cgs_device, address, value);
 	trace_amdgpu_dc_wreg(&ctx->perf_trace->write_count, address, value);
 }
@@ -11829,6 +11837,8 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,
 		return 0;
 	}
 
+	amdgpu_dm_exit_ips_for_hw_access(ctx->dc);
+
 	value = cgs_read_register(ctx->cgs_device, address);
 
 	trace_amdgpu_dc_rreg(&ctx->perf_trace->read_count, address, value);
Signature · 1 line
2.45.0
Reviewed-by on v1 1/1
#1 lore raw

[Public]

Quoted 61 lines

-----Original Message-----
From: Mahfooz, Hamza <[email protected]>
Sent: Monday, June 3, 2024 10:35 AM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Siqueira, Rodrigo <[email protected]>; Deucher, Alexander <[email protected]>; Hung, Alex <[email protected]>; Li, Roman <[email protected]>; Mahfooz, Hamza <[email protected]>; [email protected]
Subject: [PATCH] drm/amd/display: prevent register access while in IPS

We can't read/write to DCN registers while in IPS. Since, that can cause the system to hang. So, before proceeding with the access in that scenario, force the system out of IPS.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10
++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -0
index 059f78c8cd04..c8bc4098ed18 100644
@@ -11796,6 +11796,12 @@ void amdgpu_dm_trigger_timing_sync(struct
 drm_device *dev)
      mutex_unlock(&adev->dm.dc_lock);
 }
 
+static inline void amdgpu_dm_exit_ips_for_hw_access(struct dc *dc) {
+     if (dc->ctx->dmub_srv && !dc->ctx->dmub_srv->idle_exit_counter)
+             dc_exit_ips_for_hw_access(dc);
+}
+
 void dm_write_reg_func(const struct dc_context *ctx, uint32_t address,
                     u32 value, const char *func_name)  { @@ -11806,6
+11812,8 @@ void dm_write_reg_func(const struct dc_context *ctx, uint32_t

address,

              return;
      }

#endif

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
+
+     amdgpu_dm_exit_ips_for_hw_access(ctx->dc);
      cgs_write_register(ctx->cgs_device, address, value);
      trace_amdgpu_dc_wreg(&ctx->perf_trace->write_count, address,

value); } @@ -11829,6 +11837,8 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,

              return 0;
      }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
+     amdgpu_dm_exit_ips_for_hw_access(ctx->dc);
+
      value = cgs_read_register(ctx->cgs_device, address);
 
      trace_amdgpu_dc_rreg(&ctx->perf_trace->read_count, address,

value);
--
2.45.0