diff options
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 |
3 files changed, 16 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index a288fa6d72c8..e613ba42f167 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -55,6 +55,9 @@ struct amdgpu_bo_va { | |||
55 | /* mappings for this bo_va */ | 55 | /* mappings for this bo_va */ |
56 | struct list_head invalids; | 56 | struct list_head invalids; |
57 | struct list_head valids; | 57 | struct list_head valids; |
58 | |||
59 | /* If the mappings are cleared or filled */ | ||
60 | bool cleared; | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | struct amdgpu_bo { | 63 | struct amdgpu_bo { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 1b36c62997b3..1334bbb82634 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1792,11 +1792,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1792 | bo_va->base.moved = false; | 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 | 1794 | ||
1795 | } else { | 1795 | } else if (bo_va->cleared != clear) { |
1796 | spin_lock(&vm->status_lock); | 1796 | list_splice_init(&bo_va->valids, &bo_va->invalids); |
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 | } | 1797 | } |
1801 | 1798 | ||
1802 | list_for_each_entry(mapping, &bo_va->invalids, list) { | 1799 | list_for_each_entry(mapping, &bo_va->invalids, list) { |
@@ -1807,25 +1804,22 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1807 | return r; | 1804 | return r; |
1808 | } | 1805 | } |
1809 | 1806 | ||
1810 | if (trace_amdgpu_vm_bo_mapping_enabled()) { | 1807 | if (vm->use_cpu_for_update) { |
1811 | list_for_each_entry(mapping, &bo_va->valids, list) | 1808 | /* Flush HDP */ |
1812 | trace_amdgpu_vm_bo_mapping(mapping); | 1809 | mb(); |
1813 | 1810 | amdgpu_gart_flush_gpu_tlb(adev, 0); | |
1814 | list_for_each_entry(mapping, &bo_va->invalids, list) | ||
1815 | trace_amdgpu_vm_bo_mapping(mapping); | ||
1816 | } | 1811 | } |
1817 | 1812 | ||
1818 | spin_lock(&vm->status_lock); | 1813 | spin_lock(&vm->status_lock); |
1819 | list_splice_init(&bo_va->invalids, &bo_va->valids); | ||
1820 | list_del_init(&bo_va->base.vm_status); | 1814 | list_del_init(&bo_va->base.vm_status); |
1821 | if (clear) | ||
1822 | list_add(&bo_va->base.vm_status, &vm->cleared); | ||
1823 | spin_unlock(&vm->status_lock); | 1815 | spin_unlock(&vm->status_lock); |
1824 | 1816 | ||
1825 | if (vm->use_cpu_for_update) { | 1817 | list_splice_init(&bo_va->invalids, &bo_va->valids); |
1826 | /* Flush HDP */ | 1818 | bo_va->cleared = clear; |
1827 | mb(); | 1819 | |
1828 | amdgpu_gart_flush_gpu_tlb(adev, 0); | 1820 | if (trace_amdgpu_vm_bo_mapping_enabled()) { |
1821 | list_for_each_entry(mapping, &bo_va->valids, list) | ||
1822 | trace_amdgpu_vm_bo_mapping(mapping); | ||
1829 | } | 1823 | } |
1830 | 1824 | ||
1831 | return 0; | 1825 | return 0; |
@@ -2427,9 +2421,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | |||
2427 | list_for_each_entry(bo_base, &bo->va, bo_list) { | 2421 | list_for_each_entry(bo_base, &bo->va, bo_list) { |
2428 | bo_base->moved = true; | 2422 | bo_base->moved = true; |
2429 | spin_lock(&bo_base->vm->status_lock); | 2423 | spin_lock(&bo_base->vm->status_lock); |
2430 | if (list_empty(&bo_base->vm_status)) | 2424 | list_move(&bo_base->vm_status, &bo_base->vm->moved); |
2431 | list_add(&bo_base->vm_status, | ||
2432 | &bo_base->vm->moved); | ||
2433 | spin_unlock(&bo_base->vm->status_lock); | 2425 | spin_unlock(&bo_base->vm->status_lock); |
2434 | } | 2426 | } |
2435 | } | 2427 | } |
@@ -2516,7 +2508,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
2516 | vm->reserved_vmid[i] = NULL; | 2508 | vm->reserved_vmid[i] = NULL; |
2517 | spin_lock_init(&vm->status_lock); | 2509 | spin_lock_init(&vm->status_lock); |
2518 | INIT_LIST_HEAD(&vm->moved); | 2510 | INIT_LIST_HEAD(&vm->moved); |
2519 | INIT_LIST_HEAD(&vm->cleared); | ||
2520 | INIT_LIST_HEAD(&vm->freed); | 2511 | INIT_LIST_HEAD(&vm->freed); |
2521 | 2512 | ||
2522 | /* create scheduler entity for page table updates */ | 2513 | /* create scheduler entity for page table updates */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 1b478e62a948..ff093d4b5e11 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -129,9 +129,6 @@ struct amdgpu_vm { | |||
129 | /* BOs moved, but not yet updated in the PT */ | 129 | /* BOs moved, but not yet updated in the PT */ |
130 | struct list_head moved; | 130 | struct list_head moved; |
131 | 131 | ||
132 | /* BOs cleared in the PT because of a move */ | ||
133 | struct list_head cleared; | ||
134 | |||
135 | /* BO mappings freed, but not yet updated in the PT */ | 132 | /* BO mappings freed, but not yet updated in the PT */ |
136 | struct list_head freed; | 133 | struct list_head freed; |
137 | 134 | ||