Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Add dummy interface for tracing DCN32 SMU messages

[Why/How]
Some issues may require a trace of the previous SMU messages from DC to
understand the context and aid in debugging. Actual logging to be
implemented when needed.

Reviewed-by: Josip Pavic <josip.pavic@amd.com>
Acked-by: Roman Li <roman.li@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

George Shen and committed by
Alex Deucher
beb9764a 14f9db42

+31 -1
+8
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
··· 52 52 func_name, line); 53 53 } 54 54 55 + void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx) 56 + { 57 + } 58 + 59 + void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx) 60 + { 61 + } 62 + 55 63 /**** power component interfaces ****/
+4 -1
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c
··· 54 54 */ 55 55 static uint32_t dcn30_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, unsigned int delay_us, unsigned int max_retries) 56 56 { 57 + const uint32_t initial_max_retries = max_retries; 57 58 uint32_t reg = 0; 58 59 59 60 do { ··· 70 69 71 70 /* handle DALSMC_Result_CmdRejectedBusy? */ 72 71 73 - /* Log? */ 72 + TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); 74 73 75 74 return reg; 76 75 } ··· 89 88 90 89 /* Trigger the message transaction by writing the message ID */ 91 90 REG_WRITE(DAL_MSG_REG, msg_id); 91 + 92 + TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx); 92 93 93 94 result = dcn30_smu_wait_for_response(clk_mgr, 10, 200000); 94 95
+9
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr_smu_msg.c
··· 49 49 */ 50 50 static uint32_t dcn32_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, unsigned int delay_us, unsigned int max_retries) 51 51 { 52 + const uint32_t initial_max_retries = max_retries; 52 53 uint32_t reg = 0; 53 54 54 55 do { ··· 62 61 else if (delay_us > 0) 63 62 udelay(delay_us); 64 63 } while (max_retries--); 64 + 65 + TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx); 65 66 66 67 return reg; 67 68 } ··· 81 78 82 79 /* Trigger the message transaction by writing the message ID */ 83 80 REG_WRITE(DAL_MSG_REG, msg_id); 81 + 82 + TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx); 84 83 85 84 /* Wait for response */ 86 85 if (dcn32_smu_wait_for_response(clk_mgr, 10, 200000) == DALSMC_Result_OK) { ··· 120 115 *total_delay_us += delay_us; 121 116 } while (max_retries--); 122 117 118 + TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx); 119 + 123 120 return reg; 124 121 } 125 122 ··· 141 134 142 135 /* Trigger the message transaction by writing the message ID */ 143 136 REG_WRITE(DAL_MSG_REG, msg_id); 137 + 138 + TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx); 144 139 145 140 /* Wait for response */ 146 141 if (dcn32_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay2_us) == DALSMC_Result_OK) {
+10
drivers/gpu/drm/amd/display/dc/dm_services.h
··· 275 275 #define PERF_TRACE_CTX(__CTX) dm_perf_trace_timestamp(__func__, __LINE__, __CTX) 276 276 277 277 /* 278 + * SMU message tracing 279 + */ 280 + void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx); 281 + void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx); 282 + 283 + #define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_msg(msg_id, param_in, ctx) 284 + #define TRACE_SMU_DELAY(response_delay, ctx) dm_trace_smu_delay(response_delay, ctx) 285 + 286 + 287 + /* 278 288 * DMUB Interfaces 279 289 */ 280 290 bool dm_execute_dmub_cmd(const struct dc_context *ctx, union dmub_rb_cmd *cmd, enum dm_dmub_wait_type wait_type);