提交 36bbf3bf 编写于 作者: C Chunming Zhou 提交者: Alex Deucher

drm/amdgpu: add reserved vmid field in vm struct v2

v2: rename dedicated_vmid to reserved_vmid
Signed-off-by: NChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: NJunwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 cfbcacf4
...@@ -2147,10 +2147,12 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) ...@@ -2147,10 +2147,12 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
unsigned ring_instance; unsigned ring_instance;
struct amdgpu_ring *ring; struct amdgpu_ring *ring;
struct amd_sched_rq *rq; struct amd_sched_rq *rq;
int r; int r, i;
vm->va = RB_ROOT; vm->va = RB_ROOT;
vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter); vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter);
for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
vm->reserved_vmid[i] = NULL;
spin_lock_init(&vm->status_lock); spin_lock_init(&vm->status_lock);
INIT_LIST_HEAD(&vm->invalidated); INIT_LIST_HEAD(&vm->invalidated);
INIT_LIST_HEAD(&vm->cleared); INIT_LIST_HEAD(&vm->cleared);
...@@ -2235,6 +2237,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) ...@@ -2235,6 +2237,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
{ {
struct amdgpu_bo_va_mapping *mapping, *tmp; struct amdgpu_bo_va_mapping *mapping, *tmp;
bool prt_fini_needed = !!adev->gart.gart_funcs->set_prt; bool prt_fini_needed = !!adev->gart.gart_funcs->set_prt;
int i;
amd_sched_entity_fini(vm->entity.sched, &vm->entity); amd_sched_entity_fini(vm->entity.sched, &vm->entity);
...@@ -2258,6 +2261,18 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) ...@@ -2258,6 +2261,18 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
amdgpu_vm_free_levels(&vm->root); amdgpu_vm_free_levels(&vm->root);
dma_fence_put(vm->last_dir_update); dma_fence_put(vm->last_dir_update);
for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) {
struct amdgpu_vm_id_manager *id_mgr =
&adev->vm_manager.id_mgr[i];
mutex_lock(&id_mgr->lock);
if (vm->reserved_vmid[i]) {
list_add(&vm->reserved_vmid[i]->list,
&id_mgr->ids_lru);
vm->reserved_vmid[i] = NULL;
}
mutex_unlock(&id_mgr->lock);
}
} }
/** /**
......
...@@ -123,6 +123,8 @@ struct amdgpu_vm { ...@@ -123,6 +123,8 @@ struct amdgpu_vm {
/* client id */ /* client id */
u64 client_id; u64 client_id;
/* dedicated to vm */
struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS];
/* each VM will map on CSA */ /* each VM will map on CSA */
struct amdgpu_bo_va *csa_bo_va; struct amdgpu_bo_va *csa_bo_va;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册