From: Wenjing Liu <[email protected]>

[Why]
The QoS model override for a display IP block was silently
skipped whenever the firmware-populated table was invalid.

[How]
Always re-point the bandwidth params at the driver's own
persistent QoS model storage before applying the override,
instead of returning early when the firmware-populated model
is NULL.

Signed-off-by: Wenjing Liu <[email protected]>
Signed-off-by: Fangzhi Zuo <[email protected]>
Reviewed-by: Alvin Lee <[email protected]>
---
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c 
b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
index 4cca1db2a79a..04891ae776b6 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
@@ -706,20 +706,18 @@ static void dcn60_copy_utm_qos_model_to_soc_table(
 
 /**
  * dcn60_override_utm_qos_model - Override the UTM QoS model.
+ * @clk_mgr: clock manager instance
  * @bw_params: clock manager bandwidth parameters
  */
-static void dcn60_override_utm_qos_model(struct clk_bw_params *bw_params)
+static void dcn60_override_utm_qos_model(struct clk_mgr_internal *clk_mgr,
+               struct clk_bw_params *bw_params)
 {
-       struct utm_qos_model *qos_model;
-       struct utm_qos_model_dchub_v3 *dchub;
-
-       if (!bw_params->utm_qos_model
-                       || bw_params->utm_qos_model->version != 
utm_qos_model_version_v3
-                       || !bw_params->utm_qos_model->dchub_v3)
-               return;
+       struct dcn60_clk_mgr *dcn60_clk_mgr =
+                       container_of(clk_mgr, struct dcn60_clk_mgr, base);
+       struct utm_qos_model *qos_model = &dcn60_clk_mgr->utm_qos_model;
+       struct utm_qos_model_dchub_v3 *dchub = &dcn60_clk_mgr->dchub_v3;
 
-       qos_model = (struct utm_qos_model *)bw_params->utm_qos_model;
-       dchub = (struct utm_qos_model_dchub_v3 *)qos_model->dchub_v3;
+       bw_params->utm_qos_model = qos_model;
 
        dcn6_test_initialize_utm_qos_model_v3(qos_model, dchub);
 
@@ -735,7 +733,7 @@ static void dcn60_override_bw_params(struct 
clk_mgr_internal *clk_mgr,
        dcn60_override_dc_mode_limit(clk_mgr, bw_params);
 
        if (dcn60_should_apply_temp_utm_override)
-               dcn60_override_utm_qos_model(bw_params);
+               dcn60_override_utm_qos_model(clk_mgr, bw_params);
 }
 
 /**
-- 
2.53.0

Reply via email to