This is a note to let you know that I've just added the patch titled drm/amd/display: fix linux dp link lost handled only one time to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-amd-display-fix-linux-dp-link-lost-handled-only-one-time.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Tue Jul 25 00:26:54 2023 From: Mario Limonciello <mario.limonciello@xxxxxxx> Date: Mon, 24 Jul 2023 17:26:37 -0500 Subject: drm/amd/display: fix linux dp link lost handled only one time To: <stable@xxxxxxxxxxxxxxx> Cc: Mario Limonciello <mario.limonciello@xxxxxxx> Message-ID: <20230724222638.1477-7-mario.limonciello@xxxxxxx> From: Hersen Wu <hersenxs.wu@xxxxxxx> commit e322843e5e33e72ff218d661f3d15ff9c9f2f1b5 upstream. [Why] linux amdgpu defer handle link lost irq. dm add handle request to irq work queue for the first irq of link lost. if link training fails for link lost handle, link will not be enabled anymore. [How] allow adding handle request of link lost to work queue before running dp link training for link lost. Signed-off-by: Hersen Wu <hersenxs.wu@xxxxxxx> Acked-by: Alex Hung <alex.hung@xxxxxxx> Tested-by: Daniel Wheeler <daniel.wheeler@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> [ Modified due to not having c5a31f178e352 ("drm/amd/display: move dp irq handler functions from dc_link_dp to link_dp_irq_handler") until kernel 6.3-rc1.] Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++++++++++++--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 - drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 4 +++ 3 files changed, 26 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1346,10 +1346,28 @@ static void dm_handle_hpd_rx_offload_wor } else if ((dc_link->connector_signal != SIGNAL_TYPE_EDP) && hpd_rx_irq_check_link_loss_status(dc_link, &offload_work->data) && dc_link_dp_allow_hpd_rx_irq(dc_link)) { - dc_link_dp_handle_link_loss(dc_link); + /* offload_work->data is from handle_hpd_rx_irq-> + * schedule_hpd_rx_offload_work.this is defer handle + * for hpd short pulse. upon here, link status may be + * changed, need get latest link status from dpcd + * registers. if link status is good, skip run link + * training again. + */ + union hpd_irq_data irq_data; + + memset(&irq_data, 0, sizeof(irq_data)); + + /* before dc_link_dp_handle_link_loss, allow new link lost handle + * request be added to work queue if link lost at end of dc_link_ + * dp_handle_link_loss + */ spin_lock_irqsave(&offload_work->offload_wq->offload_lock, flags); offload_work->offload_wq->is_handling_link_loss = false; spin_unlock_irqrestore(&offload_work->offload_wq->offload_lock, flags); + + if ((read_hpd_rx_irq_data(dc_link, &irq_data) == DC_OK) && + hpd_rx_irq_check_link_loss_status(dc_link, &irq_data)) + dc_link_dp_handle_link_loss(dc_link); } mutex_unlock(&adev->dm.dc_lock); @@ -3324,7 +3342,7 @@ static void handle_hpd_rx_irq(void *para union hpd_irq_data hpd_irq_data; bool link_loss = false; bool has_left_work = false; - int idx = aconnector->base.index; + int idx = dc_link->link_index; struct hpd_rx_irq_offload_work_queue *offload_wq = &adev->dm.hpd_rx_offload_wq[idx]; memset(&hpd_irq_data, 0, sizeof(hpd_irq_data)); @@ -3466,7 +3484,7 @@ static void register_hpd_handlers(struct (void *) aconnector); if (adev->dm.hpd_rx_offload_wq) - adev->dm.hpd_rx_offload_wq[connector->index].aconnector = + adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector = aconnector; } } --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -3115,7 +3115,7 @@ struct dc_link_settings dp_get_max_link_ return max_link_cap; } -static enum dc_status read_hpd_rx_irq_data( +enum dc_status read_hpd_rx_irq_data( struct dc_link *link, union hpd_irq_data *irq_data) { --- a/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +++ b/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h @@ -82,6 +82,10 @@ bool perform_link_training_with_retries( enum signal_type signal, bool do_fallback); +enum dc_status read_hpd_rx_irq_data( + struct dc_link *link, + union hpd_irq_data *irq_data); + bool hpd_rx_irq_check_link_loss_status( struct dc_link *link, union hpd_irq_data *hpd_irq_dpcd_data); Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-6.1/bpf-aggressively-forget-precise-markings-during-state-checkpointing.patch queue-6.1/selftests-bpf-fix-sk_assign-on-s390x.patch queue-6.1/bpf-stop-setting-precise-in-current-state.patch queue-6.1/drm-amd-display-use-max_dsc_bpp-in-amdgpu_dm.patch queue-6.1/drm-amd-display-fix-linux-dp-link-lost-handled-only-one-time.patch queue-6.1/drm-dp_mst-clear-msg_rdy-flag-before-sending-new-message.patch queue-6.1/bpf-allow-precision-tracking-for-programs-with-subprogs.patch queue-6.1/drm-amd-display-fix-some-coding-style-issues.patch queue-6.1/drm-amd-display-add-polling-method-to-handle-mst-reply-packet.patch queue-6.1/selftests-bpf-make-test_align-selftest-more-robust.patch queue-6.1/drm-amd-display-force-connector-state-when-bpc-changes-during-compliance.patch queue-6.1/drm-amd-display-clean-up-errors-warnings-in-amdgpu_dm.c.patch queue-6.1/selftests-bpf-workaround-verification-failure-for-fexit_bpf2bpf-func_replace_return_code.patch