Skip to contentSkip to conversation

drm/amd/display: fix hibernate entry for DCN35+

PATCH In review Hamza Mahfooz 2 participants 4 messages Oct 4, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: fix hibernate entry for DCN35+

Since, two suspend-resume cycles are required to enter hibernate and, since we only need to enable idle optimizations in the first cycle (which is pretty much equivalent to s2idle). We can check in_s0ix, to prevent the system from entering idle optimizations before it actually enters hibernate (from display's perspective).

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
index 4651b884d8d9..546a168a2fbf 100644
@@ -2996,10 +2996,11 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 
 	hpd_rx_irq_work_suspend(dm);
 
-	if (adev->dm.dc->caps.ips_support)
-		dc_allow_idle_optimizations(adev->dm.dc, true);
-
 	dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
+
+	if (dm->dc->caps.ips_support && adev->in_s0ix)
+		dc_allow_idle_optimizations(dm->dc, true);
+
 	dc_dmub_srv_set_power_state(dm->dc->ctx->dmub_srv, DC_ACPI_CM_POWER_STATE_D3);
 
 	return 0;
Signature · 1 line
2.46.0
#1 lore raw
Quoted 19 lines · Hamza Mahfooz

Since, two suspend-resume cycles are required to enter hibernate and, since we only need to enable idle optimizations in the first cycle (which is pretty much equivalent to s2idle). We can check in_s0ix, to prevent the system from entering idle optimizations before it actually enters hibernate (from display's perspective).

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 4651b884d8d9..546a168a2fbf 100644
@@ -2996,10 +2996,11 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_suspend(struct amdgpu_ip_block *ip_block) · line 3003

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
        hpd_rx_irq_work_suspend(dm);
 
-       if (adev->dm.dc->caps.ips_support)
-               dc_allow_idle_optimizations(adev->dm.dc, true);
-
        dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
+
+       if (dm->dc->caps.ips_support && adev->in_s0ix)
+               dc_allow_idle_optimizations(dm->dc, true);
+

Is the ordering change with respect to dc_set_power_state() intended?

Alex

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
        dc_dmub_srv_set_power_state(dm->dc->ctx->dmub_srv, DC_ACPI_CM_POWER_STATE_D3);
 
        return 0;
--

2.46.0

#2 lore raw
Quoted 22 lines · Alex Deucher
Quoted 21 lines · Hamza Mahfooz

Since, two suspend-resume cycles are required to enter hibernate and, since we only need to enable idle optimizations in the first cycle (which is pretty much equivalent to s2idle). We can check in_s0ix, to prevent the system from entering idle optimizations before it actually enters hibernate (from display's perspective).

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 4651b884d8d9..546a168a2fbf 100644
@@ -2996,10 +2996,11 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 
         hpd_rx_irq_work_suspend(dm);
 
Quoted 10 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_suspend(struct amdgpu_ip_block *ip_block) · line 3003

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
-       if (adev->dm.dc->caps.ips_support)
-               dc_allow_idle_optimizations(adev->dm.dc, true);
-
         dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
+
+       if (dm->dc->caps.ips_support && adev->in_s0ix)
+               dc_allow_idle_optimizations(dm->dc, true);
+

Is the ordering change with respect to dc_set_power_state() intended?

Yup, it's safer to set idle opts after dc_set_power_state(), since it involves a write to DMUB.

Quoted 9 lines

Alex

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
         dc_dmub_srv_set_power_state(dm->dc->ctx->dmub_srv, DC_ACPI_CM_POWER_STATE_D3);
 
         return 0;
--

2.46.0

Signature · 1 line
Hamza
Acked-by
#3 lore raw
Quoted 35 lines · Hamza Mahfooz
Quoted 22 lines · Alex Deucher
Quoted 21 lines · Hamza Mahfooz

Since, two suspend-resume cycles are required to enter hibernate and, since we only need to enable idle optimizations in the first cycle (which is pretty much equivalent to s2idle). We can check in_s0ix, to prevent the system from entering idle optimizations before it actually enters hibernate (from display's perspective).

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 4651b884d8d9..546a168a2fbf 100644
@@ -2996,10 +2996,11 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 
         hpd_rx_irq_work_suspend(dm);
 
Quoted 10 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_suspend(struct amdgpu_ip_block *ip_block) · line 3003

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
-       if (adev->dm.dc->caps.ips_support)
-               dc_allow_idle_optimizations(adev->dm.dc, true);
-
         dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
+
+       if (dm->dc->caps.ips_support && adev->in_s0ix)
+               dc_allow_idle_optimizations(dm->dc, true);
+

Is the ordering change with respect to dc_set_power_state() intended?

Quoted 2 lines

Yup, it's safer to set idle opts after dc_set_power_state(), since it involves a write to DMUB.

Might want to mention that in the commit message. With that:

Quoted 13 lines
Quoted 10 lines

Alex

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
         dc_dmub_srv_set_power_state(dm->dc->ctx->dmub_srv, DC_ACPI_CM_POWER_STATE_D3);
 
         return 0;
--

2.46.0

--
Hamza