Skip to contentSkip to conversation

drm/amdgpu: fix s3 resume back, uvd dpm randomly can't disable.

PATCH In review Rex Zhu 3 participants 5 messages Oct 21, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/2 drm/amdgpu: fix s3 resume back, uvd dpm randomly can't disable.

the value of last_mclk_dpm_enable_mask will be changed if other clients(vce,dal) trigger set power state between enable and disable uvd dpm.

Change-Id I5bdca2ff7d401243780c71c8d73fdc1e8febaae1
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
index 6ecfc48..966e5bf 100644
@@ -4081,7 +4081,7 @@ static int ci_enable_uvd_dpm(struct amdgpu_device *adev, bool enable)
 							  pi->dpm_level_enable_mask.mclk_dpm_enable_mask);
 		}
 	} else {
-		if (pi->last_mclk_dpm_enable_mask & 0x1) {
+		if (pi->uvd_enabled == true) {
 			pi->uvd_enabled = false;
 			pi->dpm_level_enable_mask.mclk_dpm_enable_mask |= 1;
 			amdgpu_ci_send_msg_to_smc_with_parameter(adev,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1477044836-21474-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu: when suspend, set boot state instand of disable dpm.

fix pm-hibernat bug, when suspend/resume, dpm start failed.

Change-Id I03784f0049563b11721ebe905d9bea40ecc82170
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +12 -5
index 966e5bf..27b1fb4 100644
@@ -5276,7 +5276,7 @@ static int ci_dpm_enable(struct amdgpu_device *adev)
 	int ret;
 
 	if (amdgpu_ci_is_smc_running(adev))
-		return -EINVAL;
+		return 0;
 	if (pi->voltage_control != CISLANDS_VOLTAGE_CONTROL_NONE) {
 		ci_enable_voltage_control(adev);
 		ret = ci_construct_voltage_tables(adev);
@@ -6345,12 +6345,17 @@ static int ci_dpm_suspend(void *handle)
 
 	if (adev->pm.dpm_enabled) {
 		mutex_lock(&adev->pm.mutex);
-		/* disable dpm */
-		ci_dpm_disable(adev);
-		/* reset the power state */
-		adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
+		amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
+			       AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
+		amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
+			       AMDGPU_THERMAL_IRQ_HIGH_TO_LOW);
+		adev->pm.dpm.user_state = POWER_STATE_TYPE_INTERNAL_BOOT;
+		adev->pm.dpm.state = POWER_STATE_TYPE_INTERNAL_BOOT;
 		mutex_unlock(&adev->pm.mutex);
+		amdgpu_pm_compute_clocks(adev);
+
 	}
+
 	return 0;
 }
 
@@ -6368,6 +6373,8 @@ static int ci_dpm_resume(void *handle)
 			adev->pm.dpm_enabled = false;
 		else
 			adev->pm.dpm_enabled = true;
+		adev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED;
+		adev->pm.dpm.state = POWER_STATE_TYPE_BALANCED;
 		mutex_unlock(&adev->pm.mutex);
 		if (adev->pm.dpm_enabled)
 			amdgpu_pm_compute_clocks(adev);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1477044836-21474-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: when suspend, set boot state instand of disable dpm.

Quoted 13 lines · Rex Zhu

fix pm-hibernat bug, when suspend/resume, dpm start failed.

Change-Id I03784f0049563b11721ebe905d9bea40ecc82170
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
index 966e5bf..27b1fb4 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_enable(struct amdgpu_device *adev) · line 5279

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
@@ -5276,7 +5276,7 @@ static int ci_dpm_enable(struct amdgpu_device *adev)
        int ret;
 
        if (amdgpu_ci_is_smc_running(adev))
-               return -EINVAL;
+               return 0;

I think this hunk should be a separate patch. Also, should we actually return here or just print a message?

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
        if (pi->voltage_control != CISLANDS_VOLTAGE_CONTROL_NONE) {
                ci_enable_voltage_control(adev);
                ret = ci_construct_voltage_tables(adev);
@@ -6345,12 +6345,17 @@ static int ci_dpm_suspend(void *handle)
 
        if (adev->pm.dpm_enabled) {
                mutex_lock(&adev->pm.mutex);

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_dpm_suspend(void *handle) · line 6353

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +6 -4
-               /* disable dpm */
-               ci_dpm_disable(adev);
-               /* reset the power state */
-               adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
+               amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
+                              AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
+               amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
+                              AMDGPU_THERMAL_IRQ_HIGH_TO_LOW);
+               adev->pm.dpm.user_state = POWER_STATE_TYPE_INTERNAL_BOOT;
+               adev->pm.dpm.state = POWER_STATE_TYPE_INTERNAL_BOOT;

Ideally we would save the selected state before forcing it to boot mode in suspend and then restore the user state in resume.

Alex

Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +5 -1
                mutex_unlock(&adev->pm.mutex);
+               amdgpu_pm_compute_clocks(adev);
+
        }
+
        return 0;
 }
 
@@ -6368,6 +6373,8 @@ static int ci_dpm_resume(void *handle)
                        adev->pm.dpm_enabled = false;
                else
                        adev->pm.dpm_enabled = true;
+               adev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED;
+               adev->pm.dpm.state = POWER_STATE_TYPE_BALANCED;
                mutex_unlock(&adev->pm.mutex);
                if (adev->pm.dpm_enabled)
                        amdgpu_pm_compute_clocks(adev);
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw
In reply to a message not in the archive

Am 21.10.2016 um 12:13 schrieb Rex Zhu:

Quoted 6 lines

the value of last_mclk_dpm_enable_mask will be changed if other clients(vce,dal) trigger set power state between enable and disable uvd dpm.

Change-Id I5bdca2ff7d401243780c71c8d73fdc1e8febaae1
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +0 -0
index 6ecfc48..966e5bf 100644

drivers/gpu/drm/amd/amdgpu/ci_dpm.c static int ci_enable_uvd_dpm(struct amdgpu_device *adev, bool enable) · line 4087

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
@@ -4081,7 +4081,7 @@ static int ci_enable_uvd_dpm(struct amdgpu_device *adev, bool enable)
  							  pi->dpm_level_enable_mask.mclk_dpm_enable_mask);
  		}
  	} else {
-		if (pi->last_mclk_dpm_enable_mask & 0x1) {
+		if (pi->uvd_enabled == true) {
  			pi->uvd_enabled = false;
  			pi->dpm_level_enable_mask.mclk_dpm_enable_mask |= 1;
  			amdgpu_ci_send_msg_to_smc_with_parameter(adev,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#6 lore raw
In reply to a message not in the archive
Quoted 6 lines · Rex Zhu

the value of last_mclk_dpm_enable_mask will be changed if other clients(vce,dal) trigger set power state between enable and disable uvd dpm.

Change-Id I5bdca2ff7d401243780c71c8d73fdc1e8febaae1
Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -2
index 6ecfc48..966e5bf 100644
@@ -4081,7 +4081,7 @@ static int ci_enable_uvd_dpm(struct amdgpu_device *adev, bool enable)
                                                          pi->dpm_level_enable_mask.mclk_dpm_enable_mask);
                }
        } else {
-               if (pi->last_mclk_dpm_enable_mask & 0x1) {
+               if (pi->uvd_enabled == true) {
                        pi->uvd_enabled = false;
                        pi->dpm_level_enable_mask.mclk_dpm_enable_mask |= 1;
                        amdgpu_ci_send_msg_to_smc_with_parameter(adev,
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx