drm/amdgpu: always reserve two slots for the VM
authorChristian König <christian.koenig@amd.com>
Fri, 21 Sep 2018 16:09:59 +0000 (18:09 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 7 Dec 2018 22:53:45 +0000 (17:53 -0500)
And drop the now superflous extra reservations.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index ce58af6..8cc640a 100644 (file)
@@ -964,10 +964,6 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
        if (r)
                return r;
 
-       r = reservation_object_reserve_shared(vm->root.base.bo->tbo.resv, 1);
-       if (r)
-               return r;
-
        p->job->vm_pd_addr = amdgpu_gmc_pd_addr(vm->root.base.bo);
 
        if (amdgpu_vm_debug) {
index 39fb5d2..b303ac7 100644 (file)
@@ -617,7 +617,8 @@ void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
 {
        entry->priority = 0;
        entry->tv.bo = &vm->root.base.bo->tbo;
-       entry->tv.num_shared = 1;
+       /* One for the VM updates and one for the CS job */
+       entry->tv.num_shared = 2;
        entry->user_pages = NULL;
        list_add(&entry->tv.head, validated);
 }
@@ -773,10 +774,6 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 
        ring = container_of(vm->entity.rq->sched, struct amdgpu_ring, sched);
 
-       r = reservation_object_reserve_shared(bo->tbo.resv, 1);
-       if (r)
-               return r;
-
        r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
        if (r)
                goto error;
@@ -1842,10 +1839,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
        if (r)
                goto error_free;
 
-       r = reservation_object_reserve_shared(vm->root.base.bo->tbo.resv, 1);
-       if (r)
-               goto error_free;
-
        r = amdgpu_vm_update_ptes(&params, start, last + 1, addr, flags);
        if (r)
                goto error_free;
@@ -3026,6 +3019,10 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        if (r)
                goto error_free_root;
 
+       r = reservation_object_reserve_shared(root->tbo.resv, 1);
+       if (r)
+               goto error_unreserve;
+
        r = amdgpu_vm_clear_bo(adev, vm, root,
                               adev->vm_manager.root_level,
                               vm->pte_support_ats);