Skip to content

Commit c6df621

Browse files
Dillon Varonealexdeucher
authored andcommitted
drm/amd/display: Add P-State Stall Timeout Recovery Support for dcn401
[WHY&HOW] Adds support for P-State stall timeout detection in DCHUBBUB. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Tom Chung <chiahsuan.chung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 69f22c5 commit c6df621

File tree

8 files changed

+39
-4
lines changed

8 files changed

+39
-4
lines changed

drivers/gpu/drm/amd/display/dc/dml2/dml21/inc/dml_top_dchub_registers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct dml2_display_arb_regs {
8888
uint32_t sdpif_request_rate_limit;
8989
uint32_t allow_sdpif_rate_limit_when_cstate_req;
9090
uint32_t dcfclk_deep_sleep_hysteresis;
91+
uint32_t pstate_stall_threshold;
9192
};
9293

9394
struct dml2_cursor_dlg_regs{

drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12236,6 +12236,8 @@ static void rq_dlg_get_dlg_reg(
1223612236

1223712237
static void rq_dlg_get_arb_params(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_display_arb_regs *arb_param)
1223812238
{
12239+
double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : mode_lib->soc.dchub_refclk_mhz;
12240+
1223912241
arb_param->max_req_outstanding = mode_lib->soc.max_outstanding_reqs;
1224012242
arb_param->min_req_outstanding = mode_lib->soc.max_outstanding_reqs; // turn off the sat level feature if this set to max
1224112243
arb_param->sdpif_request_rate_limit = (3 * mode_lib->ip.words_per_channel * mode_lib->soc.clk_table.dram_config.channel_count) / 4;
@@ -12247,6 +12249,7 @@ static void rq_dlg_get_arb_params(const struct dml2_display_cfg *display_cfg, co
1224712249
arb_param->compbuf_size = mode_lib->mp.CompressedBufferSizeInkByte / mode_lib->ip.compressed_buffer_segment_size_in_kbytes;
1224812250
arb_param->allow_sdpif_rate_limit_when_cstate_req = dml_get_hw_debug5(mode_lib);
1224912251
arb_param->dcfclk_deep_sleep_hysteresis = dml_get_dcfclk_deep_sleep_hysteresis(mode_lib);
12252+
arb_param->pstate_stall_threshold = (unsigned int)(mode_lib->ip_caps.fams2.max_allow_delay_us * refclk_freq_in_mhz);
1225012253

1225112254
#ifdef __DML_VBA_DEBUG__
1225212255
dml2_printf("DML::%s: max_req_outstanding = %d\n", __func__, arb_param->max_req_outstanding);

drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ struct dcn_hubbub_registers {
198198
uint32_t DCHUBBUB_ARB_REFCYC_PER_META_TRIP_B;
199199
uint32_t DCHUBBUB_ARB_FRAC_URG_BW_MALL_A;
200200
uint32_t DCHUBBUB_ARB_FRAC_URG_BW_MALL_B;
201+
uint32_t DCHUBBUB_TIMEOUT_DETECTION_CTRL1;
202+
uint32_t DCHUBBUB_TIMEOUT_DETECTION_CTRL2;
201203
};
202204

203205
#define HUBBUB_REG_FIELD_LIST_DCN32(type) \
@@ -313,7 +315,12 @@ struct dcn_hubbub_registers {
313315
type DCN_VM_ERROR_VMID;\
314316
type DCN_VM_ERROR_TABLE_LEVEL;\
315317
type DCN_VM_ERROR_PIPE;\
316-
type DCN_VM_ERROR_INTERRUPT_STATUS
318+
type DCN_VM_ERROR_INTERRUPT_STATUS;\
319+
type DCHUBBUB_TIMEOUT_ERROR_STATUS;\
320+
type DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD;\
321+
type DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD;\
322+
type DCHUBBUB_TIMEOUT_DETECTION_EN;\
323+
type DCHUBBUB_TIMEOUT_TIMER_RESET
317324

318325
#define HUBBUB_STUTTER_REG_FIELD_LIST(type) \
319326
type DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A;\

drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,17 @@ static void dcn401_wait_for_det_update(struct hubbub *hubbub, int hubp_inst)
11921192
}
11931193
}
11941194

1195+
static void dcn401_program_timeout_thresholds(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs)
1196+
{
1197+
struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
1198+
1199+
/* request backpressure and outstanding return threshold (unused)*/
1200+
//REG_UPDATE(DCHUBBUB_TIMEOUT_DETECTION_CTRL1, DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD, arb_regs->req_stall_threshold);
1201+
1202+
/* P-State stall threshold */
1203+
REG_UPDATE(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD, arb_regs->pstate_stall_threshold);
1204+
}
1205+
11951206
static const struct hubbub_funcs hubbub4_01_funcs = {
11961207
.update_dchub = hubbub2_update_dchub,
11971208
.init_dchub_sys_ctx = hubbub3_init_dchub_sys_ctx,
@@ -1215,6 +1226,7 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
12151226
.program_det_segments = dcn401_program_det_segments,
12161227
.program_compbuf_segments = dcn401_program_compbuf_segments,
12171228
.wait_for_det_update = dcn401_wait_for_det_update,
1229+
.program_timeout_thresholds = dcn401_program_timeout_thresholds,
12181230
};
12191231

12201232
void hubbub401_construct(struct dcn20_hubbub *hubbub2,

drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@
123123
HUBBUB_SF(DCHUBBUB_CLOCK_CNTL, DCFCLK_R_DCHUBBUB_GATE_DIS, mask_sh),\
124124
HUBBUB_SF(DCHUBBUB_SDPIF_CFG0, SDPIF_PORT_CONTROL, mask_sh),\
125125
HUBBUB_SF(DCHUBBUB_SDPIF_CFG1, SDPIF_MAX_NUM_OUTSTANDING, mask_sh),\
126-
HUBBUB_SF(DCHUBBUB_MEM_PWR_MODE_CTRL, DET_MEM_PWR_LS_MODE, mask_sh)
127-
126+
HUBBUB_SF(DCHUBBUB_MEM_PWR_MODE_CTRL, DET_MEM_PWR_LS_MODE, mask_sh),\
127+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL1, DCHUBBUB_TIMEOUT_ERROR_STATUS, mask_sh),\
128+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL1, DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD, mask_sh),\
129+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD, mask_sh),\
130+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_DETECTION_EN, mask_sh),\
131+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_TIMER_RESET, mask_sh)
128132

129133
bool hubbub401_program_urgent_watermarks(
130134
struct hubbub *hubbub,

drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,11 @@ void dcn401_optimize_bandwidth(
15541554
pipe_ctx->dlg_regs.min_dst_y_next_start);
15551555
}
15561556
}
1557+
1558+
/* update timeout thresholds */
1559+
if (hubbub->funcs->program_timeout_thresholds) {
1560+
hubbub->funcs->program_timeout_thresholds(hubbub, &context->bw_ctx.bw.dcn.arb_regs);
1561+
}
15571562
}
15581563

15591564
void dcn401_fams2_global_control_lock(struct dc *dc,

drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct hubbub_funcs {
228228
void (*program_det_segments)(struct hubbub *hubbub, int hubp_inst, unsigned det_buffer_size_seg);
229229
void (*program_compbuf_segments)(struct hubbub *hubbub, unsigned compbuf_size_seg, bool safe_to_increase);
230230
void (*wait_for_det_update)(struct hubbub *hubbub, int hubp_inst);
231+
void (*program_timeout_thresholds)(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs);
231232
};
232233

233234
struct hubbub {

drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ void dcn401_prepare_mcache_programming(struct dc *dc, struct dc_state *context);
610610
SR(DCHUBBUB_CLOCK_CNTL), \
611611
SR(DCHUBBUB_SDPIF_CFG0), \
612612
SR(DCHUBBUB_SDPIF_CFG1), \
613-
SR(DCHUBBUB_MEM_PWR_MODE_CTRL)
613+
SR(DCHUBBUB_MEM_PWR_MODE_CTRL), \
614+
SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL1), \
615+
SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL2)
614616

615617
/* DCCG */
616618

0 commit comments

Comments
 (0)