drm/amdgpu: abstract amdgpu_vm_is_gpu_reset
authorChunming Zhou <David1.Zhou@amd.com>
Wed, 29 Jun 2016 06:01:15 +0000 (14:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:06:16 +0000 (15:06 -0400)
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_vm.c

index f39679a556f32d5182b2ab58d8c1cee24c19a1de..60fc9a508c0b926c4ab3822cbf3df6931f1218dd 100644 (file)
@@ -173,6 +173,13 @@ void amdgpu_vm_move_pt_bos_in_lru(struct amdgpu_device *adev,
        spin_unlock(&glob->lru_lock);
 }
 
+static bool amdgpu_vm_is_gpu_reset(struct amdgpu_device *adev,
+                             struct amdgpu_vm_id *id)
+{
+       return id->current_gpu_reset_count !=
+               atomic_read(&adev->gpu_reset_counter) ? true : false;
+}
+
 /**
  * amdgpu_vm_grab_id - allocate the next free VMID
  *
@@ -256,7 +263,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
                /* Check all the prerequisites to using this VMID */
                if (!id)
                        continue;
-               if (id->current_gpu_reset_count != atomic_read(&adev->gpu_reset_counter))
+               if (amdgpu_vm_is_gpu_reset(adev, id))
                        continue;
 
                if (atomic64_read(&id->owner) != vm->client_id)