diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2017-04-20 04:17:34 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-24 17:40:08 -0400 |
commit | 36bbf3bf9b23a9fe66558e2aa235f7d81c4a0727 (patch) | |
tree | 77beadd5e440feba2b76348b604b7692144e2f9d /drivers/gpu | |
parent | cfbcacf42803a690be40068325d20d74b6093c8c (diff) |
drm/amdgpu: add reserved vmid field in vm struct v2
v2: rename dedicated_vmid to reserved_vmid
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index e4e2bacdb230..6eaeed08237c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -2147,10 +2147,12 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
2147 | unsigned ring_instance; | 2147 | unsigned ring_instance; |
2148 | struct amdgpu_ring *ring; | 2148 | struct amdgpu_ring *ring; |
2149 | struct amd_sched_rq *rq; | 2149 | struct amd_sched_rq *rq; |
2150 | int r; | 2150 | int r, i; |
2151 | 2151 | ||
2152 | vm->va = RB_ROOT; | 2152 | vm->va = RB_ROOT; |
2153 | vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter); | 2153 | vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter); |
2154 | for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) | ||
2155 | vm->reserved_vmid[i] = NULL; | ||
2154 | spin_lock_init(&vm->status_lock); | 2156 | spin_lock_init(&vm->status_lock); |
2155 | INIT_LIST_HEAD(&vm->invalidated); | 2157 | INIT_LIST_HEAD(&vm->invalidated); |
2156 | INIT_LIST_HEAD(&vm->cleared); | 2158 | INIT_LIST_HEAD(&vm->cleared); |
@@ -2235,6 +2237,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
2235 | { | 2237 | { |
2236 | struct amdgpu_bo_va_mapping *mapping, *tmp; | 2238 | struct amdgpu_bo_va_mapping *mapping, *tmp; |
2237 | bool prt_fini_needed = !!adev->gart.gart_funcs->set_prt; | 2239 | bool prt_fini_needed = !!adev->gart.gart_funcs->set_prt; |
2240 | int i; | ||
2238 | 2241 | ||
2239 | amd_sched_entity_fini(vm->entity.sched, &vm->entity); | 2242 | amd_sched_entity_fini(vm->entity.sched, &vm->entity); |
2240 | 2243 | ||
@@ -2258,6 +2261,18 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
2258 | 2261 | ||
2259 | amdgpu_vm_free_levels(&vm->root); | 2262 | amdgpu_vm_free_levels(&vm->root); |
2260 | dma_fence_put(vm->last_dir_update); | 2263 | dma_fence_put(vm->last_dir_update); |
2264 | for (i = 0; i < AMDGPU_MAX_VMHUBS; i++) { | ||
2265 | struct amdgpu_vm_id_manager *id_mgr = | ||
2266 | &adev->vm_manager.id_mgr[i]; | ||
2267 | |||
2268 | mutex_lock(&id_mgr->lock); | ||
2269 | if (vm->reserved_vmid[i]) { | ||
2270 | list_add(&vm->reserved_vmid[i]->list, | ||
2271 | &id_mgr->ids_lru); | ||
2272 | vm->reserved_vmid[i] = NULL; | ||
2273 | } | ||
2274 | mutex_unlock(&id_mgr->lock); | ||
2275 | } | ||
2261 | } | 2276 | } |
2262 | 2277 | ||
2263 | /** | 2278 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index b10ce2d08685..24ccf677f5a5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -123,6 +123,8 @@ struct amdgpu_vm { | |||
123 | 123 | ||
124 | /* client id */ | 124 | /* client id */ |
125 | u64 client_id; | 125 | u64 client_id; |
126 | /* dedicated to vm */ | ||
127 | struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; | ||
126 | /* each VM will map on CSA */ | 128 | /* each VM will map on CSA */ |
127 | struct amdgpu_bo_va *csa_bo_va; | 129 | struct amdgpu_bo_va *csa_bo_va; |
128 | }; | 130 | }; |