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

drm/amd/display: Reset DMUB mailbox SW state after HW reset

[Why]
Otherwise we can be out of sync with what's in the hardware, leading
to us rerunning every command that's presently in the ringbuffer.

[How]
Reset software state for the mailboxes in hw_reset callback.
This is already done as part of the mailbox init in hw_init, but we
do need to remember to reset the last cached wptr value as well here.

Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nicholas Kazlauskas and committed by
Alex Deucher
4b0b4c17 cf76ce68

+12
+12
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
··· 532 532 if (dmub->hw_funcs.reset) 533 533 dmub->hw_funcs.reset(dmub); 534 534 535 + /* reset the cache of the last wptr as well now that hw is reset */ 536 + dmub->inbox1_last_wptr = 0; 537 + 535 538 cw0.offset.quad_part = inst_fb->gpu_addr; 536 539 cw0.region.base = DMUB_CW0_BASE; 537 540 cw0.region.top = cw0.region.base + inst_fb->size - 1; ··· 651 648 652 649 if (dmub->hw_funcs.reset) 653 650 dmub->hw_funcs.reset(dmub); 651 + 652 + /* mailboxes have been reset in hw, so reset the sw state as well */ 653 + dmub->inbox1_last_wptr = 0; 654 + dmub->inbox1_rb.wrpt = 0; 655 + dmub->inbox1_rb.rptr = 0; 656 + dmub->outbox0_rb.wrpt = 0; 657 + dmub->outbox0_rb.rptr = 0; 658 + dmub->outbox1_rb.wrpt = 0; 659 + dmub->outbox1_rb.rptr = 0; 654 660 655 661 dmub->hw_init = false; 656 662