Skip to content

Commit adb441c

Browse files
Dillon Varonealexdeucher
authored andcommitted
drm/amd/display: Refactor SMU tracing
[WHY&HOW] Add new tracing and performance measurements for SMU messaging. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Dillon Varone <Dillon.Varone@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent d19f570 commit adb441c

5 files changed

Lines changed: 20 additions & 14 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc
5353
func_name, line);
5454
}
5555

56-
void dm_trace_smu_msg(uint32_t msg_id, uint32_t param_in, struct dc_context *ctx)
56+
void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx)
5757
{
5858
}
5959

60-
void dm_trace_smu_delay(uint32_t delay, struct dc_context *ctx)
60+
void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx)
6161
{
6262
}
6363

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static uint32_t dcn30_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un
6969

7070
/* handle DALSMC_Result_CmdRejectedBusy? */
7171

72-
TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
72+
TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
7373

7474
return reg;
7575
}

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr_smu_msg.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ static uint32_t dcn32_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, un
6363
udelay(delay_us);
6464
} while (max_retries--);
6565

66-
TRACE_SMU_DELAY(delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
66+
TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
67+
6768

6869
return reg;
6970
}
@@ -120,7 +121,7 @@ static uint32_t dcn32_smu_wait_for_response_delay(struct clk_mgr_internal *clk_m
120121
*total_delay_us += delay_us;
121122
} while (max_retries--);
122123

123-
TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx);
124+
TRACE_SMU_MSG_DELAY(0, 0, *total_delay_us, clk_mgr->base.ctx);
124125

125126
return reg;
126127
}

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr_smu_msg.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin
5757
/* Wait for response register to be ready */
5858
dcn401_smu_wait_for_response(clk_mgr, 10, 200000);
5959

60+
TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx);
61+
6062
/* Clear response register */
6163
REG_WRITE(DAL_RESP_REG, 0);
6264

@@ -71,9 +73,11 @@ static bool dcn401_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uin
7173
if (param_out)
7274
*param_out = REG_READ(DAL_ARG_REG);
7375

76+
TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx);
7477
return true;
7578
}
7679

80+
TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx);
7781
return false;
7882
}
7983

@@ -102,8 +106,6 @@ static uint32_t dcn401_smu_wait_for_response_delay(struct clk_mgr_internal *clk_
102106
*total_delay_us += delay_us;
103107
} while (max_retries--);
104108

105-
TRACE_SMU_DELAY(*total_delay_us, clk_mgr->base.ctx);
106-
107109
return reg;
108110
}
109111

@@ -115,6 +117,8 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg
115117
/* Wait for response register to be ready */
116118
dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay1_us);
117119

120+
TRACE_SMU_MSG_ENTER(msg_id, param_in, clk_mgr->base.ctx);
121+
118122
/* Clear response register */
119123
REG_WRITE(DAL_RESP_REG, 0);
120124

@@ -124,18 +128,18 @@ static bool dcn401_smu_send_msg_with_param_delay(struct clk_mgr_internal *clk_mg
124128
/* Trigger the message transaction by writing the message ID */
125129
REG_WRITE(DAL_MSG_REG, msg_id);
126130

127-
TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx);
128-
129131
/* Wait for response */
130132
if (dcn401_smu_wait_for_response_delay(clk_mgr, 10, 200000, &delay2_us) == DALSMC_Result_OK) {
131133
if (param_out)
132134
*param_out = REG_READ(DAL_ARG_REG);
133135

134136
*total_delay_us = delay1_us + delay2_us;
137+
TRACE_SMU_MSG_EXIT(true, param_out ? *param_out : 0, clk_mgr->base.ctx);
135138
return true;
136139
}
137140

138141
*total_delay_us = delay1_us + 2000000;
142+
TRACE_SMU_MSG_EXIT(false, 0, clk_mgr->base.ctx);
139143
return false;
140144
}
141145

drivers/gpu/drm/amd/display/dc/dm_services.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,13 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc
277277
/*
278278
* SMU message tracing
279279
*/
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)
280+
void dm_trace_smu_enter(uint32_t msg_id, uint32_t param_in, unsigned int delay, struct dc_context *ctx);
281+
void dm_trace_smu_exit(bool success, uint32_t response, struct dc_context *ctx);
285282

283+
#define TRACE_SMU_MSG_DELAY(msg_id, param_in, delay, ctx) dm_trace_smu_enter(msg_id, param_in, delay, ctx)
284+
#define TRACE_SMU_MSG(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx)
285+
#define TRACE_SMU_MSG_ENTER(msg_id, param_in, ctx) dm_trace_smu_enter(msg_id, param_in, 0, ctx)
286+
#define TRACE_SMU_MSG_EXIT(success, response, ctx) dm_trace_smu_exit(success, response, ctx)
286287

287288
/*
288289
* DMUB Interfaces

0 commit comments

Comments
 (0)