drm/amd/display: Prevent IPX From Link Detect and Set Mode
authorFangzhi Zuo <jerry.zuo@amd.com>
Fri, 10 May 2024 19:23:02 +0000 (15:23 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Jun 2024 15:25:14 +0000 (11:25 -0400)
IPX involvment proven to affect LT, causing link loss. Need to prevent
IPX enabled in LT process in which link detect and set mode are main
procedures that have LT taken place.

Reviewed-by: Roman Li <roman.li@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 059f78c8cd0486e74f2ad3b2a4f1fca7fea59add..6196de6cebbfca3907ce216462a64ca29ee8595e 100644 (file)
@@ -3097,6 +3097,7 @@ static int dm_resume(void *handle)
 
                commit_params.streams = dc_state->streams;
                commit_params.stream_count = dc_state->stream_count;
+               dc_exit_ips_for_hw_access(dm->dc);
                WARN_ON(!dc_commit_streams(dm->dc, &commit_params));
 
                dm_gpureset_commit_state(dm->cached_dc_state, dm);
@@ -3169,6 +3170,7 @@ static int dm_resume(void *handle)
                        emulated_link_detect(aconnector->dc_link);
                } else {
                        mutex_lock(&dm->dc_lock);
+                       dc_exit_ips_for_hw_access(dm->dc);
                        dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
                        mutex_unlock(&dm->dc_lock);
                }
@@ -3505,6 +3507,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
        enum dc_connection_type new_connection_type = dc_connection_none;
        struct amdgpu_device *adev = drm_to_adev(dev);
        struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);
+       struct dc *dc = aconnector->dc_link->ctx->dc;
        bool ret = false;
 
        if (adev->dm.disable_hpd_irq)
@@ -3539,6 +3542,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
                        drm_kms_helper_connector_hotplug_event(connector);
        } else {
                mutex_lock(&adev->dm.dc_lock);
+               dc_exit_ips_for_hw_access(dc);
                ret = dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD);
                mutex_unlock(&adev->dm.dc_lock);
                if (ret) {
@@ -3598,6 +3602,7 @@ static void handle_hpd_rx_irq(void *param)
        bool has_left_work = false;
        int idx = dc_link->link_index;
        struct hpd_rx_irq_offload_work_queue *offload_wq = &adev->dm.hpd_rx_offload_wq[idx];
+       struct dc *dc = aconnector->dc_link->ctx->dc;
 
        memset(&hpd_irq_data, 0, sizeof(hpd_irq_data));
 
@@ -3687,6 +3692,7 @@ out:
                        bool ret = false;
 
                        mutex_lock(&adev->dm.dc_lock);
+                       dc_exit_ips_for_hw_access(dc);
                        ret = dc_link_detect(dc_link, DETECT_REASON_HPDRX);
                        mutex_unlock(&adev->dm.dc_lock);
 
@@ -4888,6 +4894,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
                        bool ret = false;
 
                        mutex_lock(&dm->dc_lock);
+                       dc_exit_ips_for_hw_access(dm->dc);
                        ret = dc_link_detect(link, DETECT_REASON_BOOT);
                        mutex_unlock(&dm->dc_lock);
 
@@ -9298,6 +9305,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
 
                        memset(&position, 0, sizeof(position));
                        mutex_lock(&dm->dc_lock);
+                       dc_exit_ips_for_hw_access(dm->dc);
                        dc_stream_program_cursor_position(dm_old_crtc_state->stream, &position);
                        mutex_unlock(&dm->dc_lock);
                }
@@ -9372,6 +9380,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
 
        dm_enable_per_frame_crtc_master_sync(dc_state);
        mutex_lock(&dm->dc_lock);
+       dc_exit_ips_for_hw_access(dm->dc);
        WARN_ON(!dc_commit_streams(dm->dc, &params));
 
        /* Allow idle optimization when vblank count is 0 for display off */
@@ -9737,6 +9746,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 
 
                mutex_lock(&dm->dc_lock);
+               dc_exit_ips_for_hw_access(dm->dc);
                dc_update_planes_and_stream(dm->dc,
                                            dummy_updates,
                                            status->plane_count,