答复: [PATCH 1/2] drm/amdgpu: reset the asic when hibernating

Qu, Jim Jim.Qu at amd.com
Tue Aug 23 04:41:53 UTC 2016


Hi Alex:

I remember that the freeze() is called before hibernation image is made. So is it possible that driver lost some contents when restore hibernation image.

Thanks
JimQu

________________________________________
发件人: Qu, Jim
发送时间: 2016年8月23日 12:18:59
收件人: Alex Deucher; amd-gfx at lists.freedesktop.org
抄送: Deucher, Alexander
主题: 答复: [PATCH 1/2] drm/amdgpu: reset the asic when hibernating

Hi Alex:

Are you working on S4 issue ?

Thanks
JimQu

________________________________________
发件人: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> 代表 Alex Deucher <alexdeucher at gmail.com>
发送时间: 2016年8月23日 0:05:24
收件人: amd-gfx at lists.freedesktop.org
抄送: Deucher, Alexander
主题: [PATCH 1/2] drm/amdgpu: reset the asic when hibernating

Some blocks require a reset to properly resume if there
is no power down of the asic like during various
hibernation steps.

Port of:
274ad65c9d02bdcbee9bae045517864c3521d530
(drm/radeon: hard reset r600 and newer GPU when hibernating.)
from radeon.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  6 +++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 6fa8268..d0d0588 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -2436,7 +2436,8 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
                                 struct drm_file *file_priv);
 void amdgpu_driver_preclose_kms(struct drm_device *dev,
                                struct drm_file *file_priv);
-int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon);
+int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon,
+                      bool freeze);
 int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
 u32 amdgpu_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe);
 int amdgpu_enable_vblank_kms(struct drm_device *dev, unsigned int pipe);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 21f4b74..5747e37 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1037,7 +1037,7 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
                printk(KERN_INFO "amdgpu: switched off\n");
                drm_kms_helper_poll_disable(dev);
                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
-               amdgpu_suspend_kms(dev, true, true);
+               amdgpu_suspend_kms(dev, true, true, false);
                dev->switch_power_state = DRM_SWITCH_POWER_OFF;
        }
 }
@@ -1780,7 +1780,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
  * Returns 0 for success or an error on failure.
  * Called at driver suspend.
  */
-int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
+int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon,
+                      bool freeze)
 {
        struct amdgpu_device *adev;
        struct drm_crtc *crtc;
@@ -1844,7 +1845,10 @@ int amdgpu_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
        amdgpu_bo_evict_vram(adev);

        pci_save_state(dev->pdev);
-       if (suspend) {
+       if (freeze) {
+               /* reset the asic during freeze */
+               r = amdgpu_asic_reset(adev);
+       } else if (suspend) {
                /* Shut down the device */
                pci_disable_device(dev->pdev);
                pci_set_power_state(dev->pdev, PCI_D3hot);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 58b1db8..eb4c9b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -395,7 +395,7 @@ static int amdgpu_pmops_suspend(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
-       return amdgpu_suspend_kms(drm_dev, true, true);
+       return amdgpu_suspend_kms(drm_dev, true, true, false);
 }

 static int amdgpu_pmops_resume(struct device *dev)
@@ -409,7 +409,7 @@ static int amdgpu_pmops_freeze(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
-       return amdgpu_suspend_kms(drm_dev, false, true);
+       return amdgpu_suspend_kms(drm_dev, false, true, true);
 }

 static int amdgpu_pmops_thaw(struct device *dev)
@@ -434,7 +434,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
        drm_kms_helper_poll_disable(drm_dev);
        vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);

-       ret = amdgpu_suspend_kms(drm_dev, false, false);
+       ret = amdgpu_suspend_kms(drm_dev, false, false, false);
        pci_save_state(pdev);
        pci_disable_device(pdev);
        pci_ignore_hotplug(pdev);
--
2.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list