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

drm/amd/display: Ensure DCN save after VM setup

[Why]
DM initializes VM context after DMCUB initialization.
This results in loss of DCN_VM_CONTEXT registers after z10.

[How]
Notify DMCUB when VM setup is complete, and have DMCUB
save init registers.

v2: squash in CONFIG_DRM_AMD_DC_DCN3_1 fix

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Jake Wang <haonan.wang2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jake Wang and committed by
Alex Deucher
f586fea8 58aa1c50

+30
+6
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1549 1549 if (dc->hwss.z10_restore) 1550 1550 dc->hwss.z10_restore(dc); 1551 1551 } 1552 + 1553 + void dc_z10_save_init(struct dc *dc) 1554 + { 1555 + if (dc->hwss.z10_save_init) 1556 + dc->hwss.z10_save_init(dc); 1557 + } 1552 1558 #endif 1553 1559 /* 1554 1560 * Applies given context to HW and copy it into current context.
+3
drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
··· 47 47 */ 48 48 memcpy(&dc->vm_pa_config, pa_config, sizeof(struct dc_phy_addr_space_config)); 49 49 dc->vm_pa_config.valid = true; 50 + #if defined(CONFIG_DRM_AMD_DC_DCN) 51 + dc_z10_save_init(dc); 52 + #endif 50 53 } 51 54 52 55 return num_vmids;
+1
drivers/gpu/drm/amd/display/dc/dc.h
··· 1338 1338 bool dc_set_psr_allow_active(struct dc *dc, bool enable); 1339 1339 #if defined(CONFIG_DRM_AMD_DC_DCN) 1340 1340 void dc_z10_restore(struct dc *dc); 1341 + void dc_z10_save_init(struct dc *dc); 1341 1342 #endif 1342 1343 1343 1344 bool dc_enable_dmub_notifications(struct dc *dc);
+12
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c
··· 407 407 &pipe_ctx->stream_res.encoder_info_frame); 408 408 } 409 409 } 410 + void dcn31_z10_save_init(struct dc *dc) 411 + { 412 + union dmub_rb_cmd cmd; 413 + 414 + memset(&cmd, 0, sizeof(cmd)); 415 + cmd.dcn_restore.header.type = DMUB_CMD__IDLE_OPT; 416 + cmd.dcn_restore.header.sub_type = DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT; 417 + 418 + dc_dmub_srv_cmd_queue(dc->ctx->dmub_srv, &cmd); 419 + dc_dmub_srv_cmd_execute(dc->ctx->dmub_srv); 420 + dc_dmub_srv_wait_idle(dc->ctx->dmub_srv); 421 + } 410 422 411 423 void dcn31_z10_restore(struct dc *dc) 412 424 {
+1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.h
··· 44 44 void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx); 45 45 46 46 void dcn31_z10_restore(struct dc *dc); 47 + void dcn31_z10_save_init(struct dc *dc); 47 48 48 49 void dcn31_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on); 49 50 int dcn31_init_sys_ctx(struct dce_hwseq *hws, struct dc *dc, struct dc_phy_addr_space_config *pa_config);
+1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 97 97 .set_abm_immediate_disable = dcn21_set_abm_immediate_disable, 98 98 .set_pipe = dcn21_set_pipe, 99 99 .z10_restore = dcn31_z10_restore, 100 + .z10_save_init = dcn31_z10_save_init, 100 101 .is_abm_supported = dcn31_is_abm_supported, 101 102 .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, 102 103 .update_visual_confirm_color = dcn20_update_visual_confirm_color,
+1
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
··· 237 237 int width, int height, int offset); 238 238 239 239 void (*z10_restore)(struct dc *dc); 240 + void (*z10_save_init)(struct dc *dc); 240 241 241 242 void (*update_visual_confirm_color)(struct dc *dc, 242 243 struct pipe_ctx *pipe_ctx,
+5
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
··· 860 860 * DCN hardware restore. 861 861 */ 862 862 DMUB_CMD__IDLE_OPT_DCN_RESTORE = 0, 863 + 864 + /** 865 + * DCN hardware save. 866 + */ 867 + DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT = 1 863 868 }; 864 869 865 870 /**