drm/amdgpu: add pre_soft_reset ip func
authorChunming Zhou <David1.Zhou@amd.com>
Mon, 18 Jul 2016 02:04:34 +0000 (10:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Aug 2016 15:32:02 +0000 (11:32 -0400)
It will be used before soft_reset to do some preparing work for reset.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/include/amd_shared.h

index fd7698a56f3b447406b5b861998596ff875e2377..b88620586c8ef83ddca00730c85bcff4b9ff1473 100644 (file)
@@ -1955,6 +1955,23 @@ static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
        return asic_hang;
 }
 
+int amdgpu_pre_soft_reset(struct amdgpu_device *adev)
+{
+       int i, r = 0;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (!adev->ip_block_status[i].valid)
+                       continue;
+               if (adev->ip_blocks[i].funcs->pre_soft_reset) {
+                       r = adev->ip_blocks[i].funcs->pre_soft_reset(adev);
+                       if (r)
+                               return r;
+               }
+       }
+
+       return 0;
+}
+
 /**
  * amdgpu_gpu_reset - reset the asic
  *
index fe4aa09252abd07ca8e08d2b153baeeffe624796..2a2a5aa39b994829f091f0dcfb42bf28f9d28d55 100644 (file)
@@ -161,6 +161,8 @@ struct amd_ip_funcs {
        int (*wait_for_idle)(void *handle);
        /* check soft reset the IP block */
        int (*check_soft_reset)(void *handle);
+       /* pre soft reset the IP block */
+       int (*pre_soft_reset)(void *handle);
        /* soft reset the IP block */
        int (*soft_reset)(void *handle);
        /* enable/disable cg for the IP block */