FAILED: patch "[PATCH] drm/amd/display: Prevent Gating DTBCLK before It Is Properly" failed to apply to 6.17-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.17-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.17.y
git checkout FETCH_HEAD
git cherry-pick -x cfa0904a35fd0231f4d05da0190f0a22ed881cce
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025112424-handball-smolder-0f15@gregkh' --subject-prefix 'PATCH 6.17.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From cfa0904a35fd0231f4d05da0190f0a22ed881cce Mon Sep 17 00:00:00 2001
From: Fangzhi Zuo <[email protected]>
Date: Thu, 18 Sep 2025 16:25:45 -0400
Subject: [PATCH] drm/amd/display: Prevent Gating DTBCLK before It Is Properly
Latched
[why]
1. With allow_0_dtb_clk enabled, the time required to latch DTBCLK to 600 MHz depends on the SMU. If DTBCLK is not latched to 600 MHz before set_mode completes, gating DTBCLK causes the DP2 sink to lose its clock source.
2. The existing DTBCLK gating sequence ungates DTBCLK based on both pix_clk and ref_dtbclk, but gates DTBCLK when either pix_clk or ref_dtbclk is zero.pix_clk can be zero outside the set_mode sequence before DTBCLK is properly latched, which can lead to DTBCLK being gated by mistake.
[how]
Consider both pixel_clk and ref_dtbclk when determining when it is safe to gate DTBCLK; this is more accurate.
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +3 -1
@@ -394,6 +394,8 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base, display_count =dcn35_get_active_display_cnt_wa (dc, context, &all_active_disps);if (new_clocks->dtbclk_en && !new_clocks->ref_dtbclk_khz) new_clocks->ref_dtbclk_khz =600000 ; +else if (!new_clocks->dtbclk_en && new_clocks->ref_dtbclk_khz >590000 ) + new_clocks->ref_dtbclk_khz =0 ;/* * if it is safe to lower, but we are already in the lower state, we don't have to do anything
@@ -435,7 +437,7 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base, actual_dtbclk =REG_READ (CLK1_CLK4_CURRENT_CNT ); -if (actual_dtbclk) { +if (actual_dtbclk >590000 ) { clk_mgr_base->clks.ref_dtbclk_khz = new_clocks->ref_dtbclk_khz; clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; }
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +1 -1
@@ -1411,7 +1411,7 @@ static void dccg35_set_dtbclk_dto( __func__, params->otg_inst, params->pixclk_khz, params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo); - }else { + }else if (!params->ref_dtbclk_khz && !req_dtbclk_khz) {switch (params->otg_inst) {case 0 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL5 ,DTBCLK_P0_GATE_DISABLE ,0 );
Sasha Levin
maintainerPATCH 1/2 drm/amd/display: Insert dccg log for easy debug
From: Charlene Liu <[email protected]>
[ Upstream commit 35bcc9168f3ce6416cbf3f776758be0937f84cb3 ]
[why]
Log for sequence tracking
Stable-dep-of: cfa0904a35fd ("drm/amd/display: Prevent Gating DTBCLK before It Is Properly Latched")
--- .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +21 -3
@@ -39,6 +39,7 @@#define CTX \ dccg_dcn->base.ctx +#include "logger_types.h" #define DC_LOGGER \ dccg->ctx->logger
@@ -1136,7 +1137,7 @@ static void dcn35_set_dppclk_enable(struct dccg *dccg,default :break ; } -//DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable); +DC_LOG_DEBUG ("%s: dpp_inst(%d) DPPCLK_EN = %d\n" , __func__, dpp_inst, enable); }
@@ -1406,6 +1407,10 @@ static void dccg35_set_dtbclk_dto(* PIPEx_DTO_SRC_SEL should not be programmed during DTBCLK update since OTG may still be on, and the * programming is handled in program_pix_clk() regardless, so it can be removed from here. */ +DC_LOG_DEBUG ("%s: OTG%d DTBCLK DTO enabled: pixclk_khz=%d, ref_dtbclk_khz=%d, req_dtbclk_khz=%d, phase=%d, modulo=%d\n" , + __func__, params->otg_inst, params->pixclk_khz, + params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo); + }else {switch (params->otg_inst) {case 0 :
@@ -1431,6 +1436,8 @@ static void dccg35_set_dtbclk_dto(REG_WRITE (DTBCLK_DTO_MODULO [params->otg_inst],0 );REG_WRITE (DTBCLK_DTO_PHASE [params->otg_inst],0 ); + +DC_LOG_DEBUG ("%s: OTG%d DTBCLK DTO disabled\n" , __func__, params->otg_inst); } }
@@ -1475,6 +1482,8 @@ static void dccg35_set_dpstreamclk(BREAK_TO_DEBUGGER ();return ; } +DC_LOG_DEBUG ("%s: dp_hpo_inst(%d) DPSTREAMCLK_EN = %d, DPSTREAMCLK_SRC_SEL = %d\n" , + __func__, dp_hpo_inst, (src ==REFCLK ) ?0 :1 , otg_inst); }
@@ -1514,6 +1523,8 @@ static void dccg35_set_dpstreamclk_root_clock_gating(BREAK_TO_DEBUGGER ();return ; } +DC_LOG_DEBUG ("%s: dp_hpo_inst(%d) DPSTREAMCLK_ROOT_GATE_DISABLE = %d\n" , + __func__, dp_hpo_inst, enable ?1 :0 ); }
@@ -1553,7 +1564,7 @@ static void dccg35_set_physymclk_root_clock_gating(BREAK_TO_DEBUGGER ();return ; } -//DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE:\n", __func__, phy_inst, enable ? 0 : 1); +DC_LOG_DEBUG ("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE: %d\n" , __func__, phy_inst, enable ?0 :1 ); }
@@ -1626,6 +1637,8 @@ static void dccg35_set_physymclk(BREAK_TO_DEBUGGER ();return ; } +DC_LOG_DEBUG ("%s: phy_inst(%d) PHYxSYMCLK_EN = %d, PHYxSYMCLK_SRC_SEL = %d\n" , + __func__, phy_inst, force_enable ?1 :0 , clk_src); } static void dccg35_set_valid_pixel_rate(
@@ -1673,6 +1686,7 @@ static void dccg35_dpp_root_clock_control( } dccg->dpp_clock_gated[dpp_inst] = !clock_on; +DC_LOG_DEBUG ("%s: dpp_inst(%d) clock_on = %d\n" , __func__, dpp_inst, clock_on); } static void dccg35_disable_symclk32_se(
@@ -1731,6 +1745,7 @@ static void dccg35_disable_symclk32_se(BREAK_TO_DEBUGGER ();return ; } + }static void dccg35_init_cb (struct dccg *dccg)
@@ -1738,7 +1753,6 @@ static void dccg35_init_cb(struct dccg *dccg) (void )dccg;/* Any RCG should be done when driver enter low power mode*/ } -void dccg35_init (struct dccg *dccg) {int otg_inst;
@@ -1753,6 +1767,8 @@ void dccg35_init(struct dccg *dccg)for (otg_inst =0 ; otg_inst <2 ; otg_inst++) {dccg31_disable_symclk32_le (dccg, otg_inst);dccg31_set_symclk32_le_root_clock_gating (dccg, otg_inst, false); +DC_LOG_DEBUG ("%s: OTG%d SYMCLK32_LE disabled and root clock gating disabled\n" , + __func__, otg_inst); }// if (dccg->ctx->dc->debug.root_clock_optimization.bits.symclk32_se)
@@ -1765,6 +1781,8 @@ void dccg35_init(struct dccg *dccg)dccg35_set_dpstreamclk (dccg,REFCLK , otg_inst, otg_inst);dccg35_set_dpstreamclk_root_clock_gating (dccg, otg_inst, false); +DC_LOG_DEBUG ("%s: OTG%d DPSTREAMCLK disabled and root clock gating disabled\n" , + __func__, otg_inst); }/*
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/2 drm/amd/display: Prevent Gating DTBCLK before It Is Properly Latched
From: Fangzhi Zuo <[email protected]>
[ Upstream commit cfa0904a35fd0231f4d05da0190f0a22ed881cce ]
[why]
1. With allow_0_dtb_clk enabled, the time required to latch DTBCLK to 600 MHz depends on the SMU. If DTBCLK is not latched to 600 MHz before set_mode completes, gating DTBCLK causes the DP2 sink to lose its clock source.
2. The existing DTBCLK gating sequence ungates DTBCLK based on both pix_clk and ref_dtbclk, but gates DTBCLK when either pix_clk or ref_dtbclk is zero.pix_clk can be zero outside the set_mode sequence before DTBCLK is properly latched, which can lead to DTBCLK being gated by mistake.
[how]
Consider both pixel_clk and ref_dtbclk when determining when it is safe to gate DTBCLK; this is more accurate.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 4 +++- drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +3 -1
@@ -394,6 +394,8 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base, display_count =dcn35_get_active_display_cnt_wa (dc, context, &all_active_disps);if (new_clocks->dtbclk_en && !new_clocks->ref_dtbclk_khz) new_clocks->ref_dtbclk_khz =600000 ; +else if (!new_clocks->dtbclk_en && new_clocks->ref_dtbclk_khz >590000 ) + new_clocks->ref_dtbclk_khz =0 ;/* * if it is safe to lower, but we are already in the lower state, we don't have to do anything
@@ -435,7 +437,7 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base, actual_dtbclk =REG_READ (CLK1_CLK4_CURRENT_CNT ); -if (actual_dtbclk) { +if (actual_dtbclk >590000 ) { clk_mgr_base->clks.ref_dtbclk_khz = new_clocks->ref_dtbclk_khz; clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; }
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +1 -1
@@ -1411,7 +1411,7 @@ static void dccg35_set_dtbclk_dto( __func__, params->otg_inst, params->pixclk_khz, params->ref_dtbclk_khz, req_dtbclk_khz, phase, modulo); - }else { + }else if (!params->ref_dtbclk_khz && !req_dtbclk_khz) {switch (params->otg_inst) {case 0 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL5 ,DTBCLK_P0_GATE_DISABLE ,0 );
Signature · 1 line
2.51.0