Commit 075e8080 authored by Eric Huang's avatar Eric Huang Committed by Alex Deucher

drm/amdgpu: Add table_freed parameter to amdgpu_vm_bo_update

It is to pass the flag to KFD, and optimize table_freed in
amdgpu_vm_bo_update_mapping.
Signed-off-by: default avatarEric Huang <jinhuieric.huang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1098d658
...@@ -781,7 +781,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) ...@@ -781,7 +781,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
if (r) if (r)
return r; return r;
r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false); r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false, NULL);
if (r) if (r)
return r; return r;
...@@ -792,7 +792,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) ...@@ -792,7 +792,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) { if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
bo_va = fpriv->csa_va; bo_va = fpriv->csa_va;
BUG_ON(!bo_va); BUG_ON(!bo_va);
r = amdgpu_vm_bo_update(adev, bo_va, false); r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
if (r) if (r)
return r; return r;
...@@ -811,7 +811,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) ...@@ -811,7 +811,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
if (bo_va == NULL) if (bo_va == NULL)
continue; continue;
r = amdgpu_vm_bo_update(adev, bo_va, false); r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
if (r) if (r)
return r; return r;
......
...@@ -613,7 +613,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, ...@@ -613,7 +613,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
if (operation == AMDGPU_VA_OP_MAP || if (operation == AMDGPU_VA_OP_MAP ||
operation == AMDGPU_VA_OP_REPLACE) { operation == AMDGPU_VA_OP_REPLACE) {
r = amdgpu_vm_bo_update(adev, bo_va, false); r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
if (r) if (r)
goto error; goto error;
} }
......
...@@ -1768,7 +1768,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, ...@@ -1768,7 +1768,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
r = vm->update_funcs->commit(&params, fence); r = vm->update_funcs->commit(&params, fence);
if (table_freed) if (table_freed)
*table_freed = params.table_freed; *table_freed = *table_freed || params.table_freed;
error_unlock: error_unlock:
amdgpu_vm_eviction_unlock(vm); amdgpu_vm_eviction_unlock(vm);
...@@ -1833,7 +1833,7 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem, ...@@ -1833,7 +1833,7 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem,
* 0 for success, -EINVAL for failure. * 0 for success, -EINVAL for failure.
*/ */
int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
bool clear) bool clear, bool *table_freed)
{ {
struct amdgpu_bo *bo = bo_va->base.bo; struct amdgpu_bo *bo = bo_va->base.bo;
struct amdgpu_vm *vm = bo_va->base.vm; struct amdgpu_vm *vm = bo_va->base.vm;
...@@ -1912,7 +1912,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, ...@@ -1912,7 +1912,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
resv, mapping->start, resv, mapping->start,
mapping->last, update_flags, mapping->last, update_flags,
mapping->offset, mem, mapping->offset, mem,
pages_addr, last_update, NULL); pages_addr, last_update, table_freed);
if (r) if (r)
return r; return r;
} }
...@@ -2165,7 +2165,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, ...@@ -2165,7 +2165,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) { list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
/* Per VM BOs never need to bo cleared in the page tables */ /* Per VM BOs never need to bo cleared in the page tables */
r = amdgpu_vm_bo_update(adev, bo_va, false); r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
if (r) if (r)
return r; return r;
} }
...@@ -2184,7 +2184,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, ...@@ -2184,7 +2184,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
else else
clear = true; clear = true;
r = amdgpu_vm_bo_update(adev, bo_va, clear); r = amdgpu_vm_bo_update(adev, bo_va, clear, NULL);
if (r) if (r)
return r; return r;
......
...@@ -413,7 +413,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, ...@@ -413,7 +413,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
struct dma_fence **fence, bool *free_table); struct dma_fence **fence, bool *free_table);
int amdgpu_vm_bo_update(struct amdgpu_device *adev, int amdgpu_vm_bo_update(struct amdgpu_device *adev,
struct amdgpu_bo_va *bo_va, struct amdgpu_bo_va *bo_va,
bool clear); bool clear, bool *table_freed);
bool amdgpu_vm_evictable(struct amdgpu_bo *bo); bool amdgpu_vm_evictable(struct amdgpu_bo *bo);
void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
struct amdgpu_bo *bo, bool evicted); struct amdgpu_bo *bo, bool evicted);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment