diff options
author | Christian König <christian.koenig@amd.com> | 2017-08-23 10:13:33 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-29 15:28:02 -0400 |
commit | 3d7d4d3a1b9f67c0caecf2b2aa8d7c347f074a33 (patch) | |
tree | 30c048a81343f29c2118246da7a2e556761d49d6 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 08cab989f77582cb19df12d4a75a91b68b0017f6 (diff) |
drm/amdgpu: rework moved handling in the VM v2
Instead of using the vm_state use a separate flag to note
that the BO was moved.
v2: reorder patches to avoid temporary lockless access
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 67c37b22f8ef..1b36c62997b3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1788,10 +1788,16 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1788 | else | 1788 | else |
1789 | flags = 0x0; | 1789 | flags = 0x0; |
1790 | 1790 | ||
1791 | spin_lock(&vm->status_lock); | 1791 | if (!clear && bo_va->base.moved) { |
1792 | if (!list_empty(&bo_va->base.vm_status)) | 1792 | bo_va->base.moved = false; |
1793 | list_splice_init(&bo_va->valids, &bo_va->invalids); | 1793 | list_splice_init(&bo_va->valids, &bo_va->invalids); |
1794 | spin_unlock(&vm->status_lock); | 1794 | |
1795 | } else { | ||
1796 | spin_lock(&vm->status_lock); | ||
1797 | if (!list_empty(&bo_va->base.vm_status)) | ||
1798 | list_splice_init(&bo_va->valids, &bo_va->invalids); | ||
1799 | spin_unlock(&vm->status_lock); | ||
1800 | } | ||
1795 | 1801 | ||
1796 | list_for_each_entry(mapping, &bo_va->invalids, list) { | 1802 | list_for_each_entry(mapping, &bo_va->invalids, list) { |
1797 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, | 1803 | r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm, |
@@ -2419,6 +2425,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | |||
2419 | struct amdgpu_vm_bo_base *bo_base; | 2425 | struct amdgpu_vm_bo_base *bo_base; |
2420 | 2426 | ||
2421 | list_for_each_entry(bo_base, &bo->va, bo_list) { | 2427 | list_for_each_entry(bo_base, &bo->va, bo_list) { |
2428 | bo_base->moved = true; | ||
2422 | spin_lock(&bo_base->vm->status_lock); | 2429 | spin_lock(&bo_base->vm->status_lock); |
2423 | if (list_empty(&bo_base->vm_status)) | 2430 | if (list_empty(&bo_base->vm_status)) |
2424 | list_add(&bo_base->vm_status, | 2431 | list_add(&bo_base->vm_status, |