Skip to content

Commit 5e8a0d3

Browse files
Duncan Maalexdeucher
authored andcommitted
drm/amd/display: Negate IPS allow and commit bits
[WHY] On s0i3, IPS mask isn't saved and restored. It is reset to zero on exit. If it is cleared unexpectedly, driver will proceed operations while DCN is in IPS2 and cause a hang. [HOW] Negate the bit logic. Default value of zero indicates it is still in IPS2. Driver must poll for the bit to assert. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Reviewed-by: Charlene Liu <charlene.liu@amd.com> Acked-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Duncan Ma <duncan.ma@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 0f21636 commit 5e8a0d3

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -820,22 +820,22 @@ static void dcn35_set_idle_state(struct clk_mgr *clk_mgr_base, bool allow_idle)
820820

821821
if (dc->config.disable_ips == DMUB_IPS_ENABLE ||
822822
dc->config.disable_ips == DMUB_IPS_DISABLE_DYNAMIC) {
823-
val |= DMUB_IPS1_ALLOW_MASK;
824-
val |= DMUB_IPS2_ALLOW_MASK;
825-
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS1) {
826823
val = val & ~DMUB_IPS1_ALLOW_MASK;
827824
val = val & ~DMUB_IPS2_ALLOW_MASK;
828-
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS2) {
829-
val |= DMUB_IPS1_ALLOW_MASK;
830-
val = val & ~DMUB_IPS2_ALLOW_MASK;
831-
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS2_Z10) {
825+
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS1) {
832826
val |= DMUB_IPS1_ALLOW_MASK;
833827
val |= DMUB_IPS2_ALLOW_MASK;
828+
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS2) {
829+
val = val & ~DMUB_IPS1_ALLOW_MASK;
830+
val |= DMUB_IPS2_ALLOW_MASK;
831+
} else if (dc->config.disable_ips == DMUB_IPS_DISABLE_IPS2_Z10) {
832+
val = val & ~DMUB_IPS1_ALLOW_MASK;
833+
val = val & ~DMUB_IPS2_ALLOW_MASK;
834834
}
835835

836836
if (!allow_idle) {
837-
val = val & ~DMUB_IPS1_ALLOW_MASK;
838-
val = val & ~DMUB_IPS2_ALLOW_MASK;
837+
val |= DMUB_IPS1_ALLOW_MASK;
838+
val |= DMUB_IPS2_ALLOW_MASK;
839839
}
840840

841841
dcn35_smu_write_ips_scratch(clk_mgr, val);

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,8 +4934,8 @@ bool dc_dmub_is_ips_idle_state(struct dc *dc)
49344934
if (dc->hwss.get_idle_state)
49354935
idle_state = dc->hwss.get_idle_state(dc);
49364936

4937-
if ((idle_state & DMUB_IPS1_ALLOW_MASK) ||
4938-
(idle_state & DMUB_IPS2_ALLOW_MASK))
4937+
if (!(idle_state & DMUB_IPS1_ALLOW_MASK) ||
4938+
!(idle_state & DMUB_IPS2_ALLOW_MASK))
49394939
return true;
49404940

49414941
return false;

drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,11 @@ void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
12021202
allow_state = dc->hwss.get_idle_state(dc);
12031203
dc->hwss.set_idle_state(dc, false);
12041204

1205-
if (allow_state & DMUB_IPS2_ALLOW_MASK) {
1205+
if (!(allow_state & DMUB_IPS2_ALLOW_MASK)) {
12061206
// Wait for evaluation time
12071207
udelay(dc->debug.ips2_eval_delay_us);
12081208
commit_state = dc->hwss.get_idle_state(dc);
1209-
if (commit_state & DMUB_IPS2_COMMIT_MASK) {
1209+
if (!(commit_state & DMUB_IPS2_COMMIT_MASK)) {
12101210
// Tell PMFW to exit low power state
12111211
dc->clk_mgr->funcs->exit_low_power_state(dc->clk_mgr);
12121212

@@ -1216,7 +1216,7 @@ void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
12161216

12171217
for (i = 0; i < max_num_polls; ++i) {
12181218
commit_state = dc->hwss.get_idle_state(dc);
1219-
if (!(commit_state & DMUB_IPS2_COMMIT_MASK))
1219+
if (commit_state & DMUB_IPS2_COMMIT_MASK)
12201220
break;
12211221

12221222
udelay(1);
@@ -1235,10 +1235,10 @@ void dc_dmub_srv_exit_low_power_state(const struct dc *dc)
12351235
}
12361236

12371237
dc_dmub_srv_notify_idle(dc, false);
1238-
if (allow_state & DMUB_IPS1_ALLOW_MASK) {
1238+
if (!(allow_state & DMUB_IPS1_ALLOW_MASK)) {
12391239
for (i = 0; i < max_num_polls; ++i) {
12401240
commit_state = dc->hwss.get_idle_state(dc);
1241-
if (!(commit_state & DMUB_IPS1_COMMIT_MASK))
1241+
if (commit_state & DMUB_IPS1_COMMIT_MASK)
12421242
break;
12431243

12441244
udelay(1);

0 commit comments

Comments
 (0)