mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
drm/amdgpu/mes: implement removing mes gang
Free the mes gang and its resources. Signed-off-by: Jack Xiao <Jack.Xiao@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5d0f619f72
commit
b0306e5840
2 changed files with 31 additions and 0 deletions
|
@ -416,3 +416,33 @@ clean_up:
|
|||
mutex_unlock(&adev->mes.mutex);
|
||||
return r;
|
||||
}
|
||||
|
||||
int amdgpu_mes_remove_gang(struct amdgpu_device *adev, int gang_id)
|
||||
{
|
||||
struct amdgpu_mes_gang *gang;
|
||||
|
||||
mutex_lock(&adev->mes.mutex);
|
||||
|
||||
gang = idr_find(&adev->mes.gang_id_idr, gang_id);
|
||||
if (!gang) {
|
||||
DRM_ERROR("gang id %d doesn't exist\n", gang_id);
|
||||
mutex_unlock(&adev->mes.mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!list_empty(&gang->queue_list)) {
|
||||
DRM_ERROR("queue list is not empty\n");
|
||||
mutex_unlock(&adev->mes.mutex);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
idr_remove(&adev->mes.gang_id_idr, gang->gang_id);
|
||||
amdgpu_bo_free_kernel(&gang->gang_ctx_bo,
|
||||
&gang->gang_ctx_gpu_addr,
|
||||
&gang->gang_ctx_cpu_ptr);
|
||||
list_del(&gang->list);
|
||||
kfree(gang);
|
||||
|
||||
mutex_unlock(&adev->mes.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -229,5 +229,6 @@ void amdgpu_mes_destroy_process(struct amdgpu_device *adev, int pasid);
|
|||
int amdgpu_mes_add_gang(struct amdgpu_device *adev, int pasid,
|
||||
struct amdgpu_mes_gang_properties *gprops,
|
||||
int *gang_id);
|
||||
int amdgpu_mes_remove_gang(struct amdgpu_device *adev, int gang_id);
|
||||
|
||||
#endif /* __AMDGPU_MES_H__ */
|
||||
|
|
Loading…
Add table
Reference in a new issue