diff options
| author | Oak Zeng <[email protected]> | 2018-08-27 19:18:36 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2018-08-29 17:35:00 +0000 |
| commit | bf47afbabf1cf149f9ebc8e1f7dab6913e360dc4 (patch) | |
| tree | c199e1bcd080fa3878d025b5c419b8ecb172dd05 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
| parent | drm/amdgpu: Set pasid for compute vm (v2) (diff) | |
| download | kernel-bf47afbabf1cf149f9ebc8e1f7dab6913e360dc4.tar.gz kernel-bf47afbabf1cf149f9ebc8e1f7dab6913e360dc4.zip | |
drm/amdkfd: Release an acquired process vm
For compute vm acquired from amdgpu, vm.pasid is managed
by kfd. Decouple pasid from such vm on process destroy
to avoid duplicate pasid release.
Signed-off-by: Oak Zeng <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 272b7902a25c..23c78af850c6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2824,6 +2824,26 @@ unreserve_bo: } /** + * amdgpu_vm_release_compute - release a compute vm + * @adev: amdgpu_device pointer + * @vm: a vm turned into compute vm by calling amdgpu_vm_make_compute + * + * This is a correspondant of amdgpu_vm_make_compute. It decouples compute + * pasid from vm. Compute should stop use of vm after this call. + */ +void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm) +{ + if (vm->pasid) { + unsigned long flags; + + spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags); + idr_remove(&adev->vm_manager.pasid_idr, vm->pasid); + spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags); + } + vm->pasid = 0; +} + +/** * amdgpu_vm_free_levels - free PD/PT levels * * @adev: amdgpu device structure |
