drm/amdgpu: Correctly establish the suspend/resume hook for amdkfd
authorYong Zhao <yong.zhao@amd.com>
Mon, 9 Nov 2015 22:21:45 +0000 (17:21 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jul 2017 15:06:37 +0000 (11:06 -0400)
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/cik.c

index 0e629931210c6a05ed4df893aef8f7456fe99192..078886c6b7587fd51df397094434ab94522bd56d 100644 (file)
@@ -55,6 +55,8 @@
 #include <linux/firmware.h>
 #include "amdgpu_vf_error.h"
 
+#include "amdgpu_amdkfd.h"
+
 MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");
 
@@ -2378,6 +2380,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
        }
        drm_modeset_unlock_all(dev);
 
+       amdgpu_amdkfd_suspend(adev);
+
        /* unpin the front buffers and cursors */
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
                struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
@@ -2511,6 +2515,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
                        }
                }
        }
+       r = amdgpu_amdkfd_resume(adev);
+       if (r)
+               return r;
 
        /* blat the mode back in */
        if (fbcon) {
index 37a499ab30eb02fc0506727b8004c71dc640db58..567c4a5cf90cc2ce927c151c2665d4d2ab5a8395 100644 (file)
@@ -1824,21 +1824,14 @@ static int cik_common_suspend(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       amdgpu_amdkfd_suspend(adev);
-
        return cik_common_hw_fini(adev);
 }
 
 static int cik_common_resume(void *handle)
 {
-       int r;
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       r = cik_common_hw_init(adev);
-       if (r)
-               return r;
-
-       return amdgpu_amdkfd_resume(adev);
+       return cik_common_hw_init(adev);
 }
 
 static bool cik_common_is_idle(void *handle)