drm/amd/display: Wait forever for DMCUB to wake up
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Mon, 11 Dec 2023 22:57:24 +0000 (17:57 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jan 2024 15:46:44 +0000 (10:46 -0500)
[Why]
If we time out waiting for PMFW to finish the exit sequence and touch
the DMCUB register the system will hang in a hard locked state.

[How]
Pol forever. This covers the case where things take too long but also
enables for debugging to occur since the cores won't be hardlocked.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c

index 4ce8ac966cc8138bf295686b49c4e67c626defa2..7724dcadecba5394a258f1ac0b870a4b8bbc3b53 100644 (file)
@@ -1214,10 +1214,8 @@ static void dc_dmub_srv_notify_idle(const struct dc *dc, bool allow_idle)
 
 static void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
 {
-       const uint32_t max_num_polls = 10000;
        uint32_t allow_state = 0;
        uint32_t commit_state = 0;
-       int i;
 
        if (dc->debug.dmcub_emulation)
                return;
@@ -1244,17 +1242,13 @@ static void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
                                udelay(dc->debug.ips2_entry_delay_us);
                                dc->clk_mgr->funcs->exit_low_power_state(dc->clk_mgr);
 
-                               for (i = 0; i < max_num_polls; ++i) {
+                               for (;;) {
                                        commit_state = dc->hwss.get_idle_state(dc);
                                        if (commit_state & DMUB_IPS2_COMMIT_MASK)
                                                break;
 
                                        udelay(1);
-
-                                       if (dc->debug.disable_timeout)
-                                               i--;
                                }
-                               ASSERT(i < max_num_polls);
 
                                if (!dc_dmub_srv_is_hw_pwr_up(dc->ctx->dmub_srv, true))
                                        ASSERT(0);
@@ -1269,17 +1263,13 @@ static void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
 
                dc_dmub_srv_notify_idle(dc, false);
                if (!(allow_state & DMUB_IPS1_ALLOW_MASK)) {
-                       for (i = 0; i < max_num_polls; ++i) {
+                       for (;;) {
                                commit_state = dc->hwss.get_idle_state(dc);
                                if (commit_state & DMUB_IPS1_COMMIT_MASK)
                                        break;
 
                                udelay(1);
-
-                               if (dc->debug.disable_timeout)
-                                       i--;
                        }
-                       ASSERT(i < max_num_polls);
                }
        }