From: Piotr Maziarz <[email protected]>

[WHY]
hubbub_soft_reset_params carried the callee itself as a function pointer,
so the step was not fully described by its parameters. The core_gtest
dumper could only record hubbub and reset, which means two sequences
calling different functions compare equal. It also forced dcn401_hwseq to
name the dcn10 symbol hubbub1_soft_reset directly, because hubbub_funcs
had no slot for a soft reset.

[HOW]
Added soft_reset to hubbub_funcs and pointed hubbub4_01_funcs,
hubbub42_funcs and hubbub60_funcs at hubbub1_soft_reset, the same way
allow_self_refresh_control is already shared. Dropped the function pointer
from the params struct and the add helper, and had the executor call
hubbub->funcs->soft_reset. The dcn10_hubbub.h include in dcn401_hwseq.c is
no longer needed.

Signed-off-by: Piotr Maziarz <[email protected]>
Signed-off-by: Fangzhi Zuo <[email protected]>
Reviewed-by: Alvin Lee <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c       | 6 ++----
 .../gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c    | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c  | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c  | 1 +
 drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c   | 5 ++---
 drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h          | 2 --
 drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h            | 2 ++
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index e6d10e3bd6e9..ccf5ed47ce62 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -3822,8 +3822,8 @@ void hwss_hubbub_soft_reset(union block_sequence_params 
*params)
        struct hubbub *hubbub = params->hubbub_soft_reset_params.hubbub;
        bool reset = params->hubbub_soft_reset_params.reset;
 
-       if (hubbub)
-               params->hubbub_soft_reset_params.hubbub_soft_reset(hubbub, 
reset);
+       if (hubbub->funcs->soft_reset)
+               hubbub->funcs->soft_reset(hubbub, reset);
 }
 
 void hwss_hubbub_perfmon_reset(union block_sequence_params *params)
@@ -5176,13 +5176,11 @@ void hwss_add_hubp_disable_control(struct 
block_sequence_state *seq_state,
 
 void hwss_add_hubbub_soft_reset(struct block_sequence_state *seq_state,
                struct hubbub *hubbub,
-               void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset),
                bool reset)
 {
        if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
                seq_state->steps[*seq_state->num_steps].func = 
HUBBUB_SOFT_RESET;
                
seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.hubbub 
= hubbub;
-               
seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.hubbub_soft_reset
 = hubbub_soft_reset;
                
seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.reset = 
reset;
                (*seq_state->num_steps)++;
        }
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
index d948525bc09e..957e8f5a6475 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
@@ -1239,6 +1239,7 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
        .allow_self_refresh_control = hubbub1_allow_self_refresh_control,
        .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
        .verify_allow_pstate_change_high = NULL,
+       .soft_reset = hubbub1_soft_reset,
        .force_wm_propagate_to_pipes = hubbub32_force_wm_propagate_to_pipes,
        .force_pstate_change_control = hubbub3_force_pstate_change_control,
        .init_watermarks = hubbub401_init_watermarks,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
index b8657de84d31..036276c17562 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
@@ -530,6 +530,7 @@ static const struct hubbub_funcs hubbub42_funcs = {
        .program_watermarks = hubbub42_program_watermarks,
        .allow_self_refresh_control = hubbub42_allow_self_refresh_control,
        .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
+       .soft_reset = hubbub1_soft_reset,
        .force_wm_propagate_to_pipes = hubbub32_force_wm_propagate_to_pipes,
        .force_pstate_change_control = hubbub3_force_pstate_change_control,
        .init_watermarks = hubbub35_init_watermarks,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
index 843a0da4bdd7..07282b78972a 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
@@ -1926,6 +1926,7 @@ static const struct hubbub_funcs hubbub60_funcs = {
        .allow_self_refresh_control = hubbub1_allow_self_refresh_control,
        .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
        .verify_allow_pstate_change_high = NULL,
+       .soft_reset = hubbub1_soft_reset,
        .force_wm_propagate_to_pipes = hubbub60_force_wm_propagate_to_pipes,
        .force_pstate_change_control = hubbub3_force_pstate_change_control,
        .init_watermarks = hubbub60_init_watermarks,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c 
b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
index b7680326f495..73f969fd1b33 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
@@ -30,7 +30,6 @@
 
 #include "dce/dmub_hw_lock_mgr.h"
 #include "dcn10/dcn10_cm_common.h"
-#include "dcn10/dcn10_hubbub.h"
 #include "dcn20/dcn20_optc.h"
 #include "dcn20/dcn20_hwseq.h"
 #include "dcn30/dcn30_cm_common.h"
@@ -4161,7 +4160,7 @@ bool dcn401_hw_wa_force_recovery_sequence(struct dc *dc,
        }
 
        /* Step 2: DCHUBBUB_GLOBAL_SOFT_RESET=1 */
-       hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, 
hubbub1_soft_reset, true);
+       hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, true);
 
        /* Step 3: Set HUBP_DISABLE=1 for all active pipes */
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
@@ -4186,7 +4185,7 @@ bool dcn401_hw_wa_force_recovery_sequence(struct dc *dc,
        }
 
        /* Step 5: DCHUBBUB_GLOBAL_SOFT_RESET=0 */
-       hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, 
hubbub1_soft_reset, false);
+       hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, false);
 
        /* Step 6: Set HUBP_BLANK_EN=0 for all active pipes */
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h 
b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index 821cd0de7271..9c32418be8f2 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -602,7 +602,6 @@ struct hubp_disable_control_params {
 
 struct hubbub_soft_reset_params {
        struct hubbub *hubbub;
-       void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset);
        bool reset;
 };
 
@@ -2416,7 +2415,6 @@ void hwss_add_hubp_disable_control(struct 
block_sequence_state *seq_state,
 
 void hwss_add_hubbub_soft_reset(struct block_sequence_state *seq_state,
                struct hubbub *hubbub,
-               void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset),
                bool reset);
 
 void hwss_add_hubbub_perfmon_reset(struct block_sequence_state *seq_state,
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h 
b/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
index d68232f10f3e..b33273b61abd 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
@@ -216,6 +216,8 @@ struct hubbub_funcs {
 
        void (*apply_DEDCN21_147_wa)(struct hubbub *hubbub);
 
+       void (*soft_reset)(struct hubbub *hubbub, bool reset);
+
        void (*force_wm_propagate_to_pipes)(struct hubbub *hubbub);
 
        void (*hubbub_read_state)(struct hubbub *hubbub, struct 
dcn_hubbub_state *hubbub_state);
-- 
2.53.0

Reply via email to