]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: prevent register access while in IPS
authorHamza Mahfooz <hamza.mahfooz@amd.com>
Mon, 3 Jun 2024 14:16:45 +0000 (10:16 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:15:59 +0000 (16:15 -0400)
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.

Cc: stable@vger.kernel.org # 6.6+
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 6d468badb669f9c00539e597b44d3f4452ed043d..27acbe3ff57b6558127b81242b60f107a18114bc 100644 (file)
@@ -11814,6 +11814,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)
 {
@@ -11824,6 +11830,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);
 }
@@ -11847,6 +11855,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);