drm/amdgpu: don't update page tables for VM emulation
authorChristian König <christian.koenig@amd.com>
Wed, 22 Jun 2016 12:25:55 +0000 (14:25 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:02:00 +0000 (15:02 -0400)
It's just overhead to do so and allocating a VMID
when we don't need one is actually a bit dangerous.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index cf97a87f76a643e1cfaaed6d39ad533a19f4a68c..95b248159947e5323db04e1c5cb76ddcc9557f31 100644 (file)
@@ -656,20 +656,21 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
 
        /* Only for UVD/VCE VM emulation */
        if (ring->funcs->parse_cs) {
+               p->job->vm = NULL;
                for (i = 0; i < p->job->num_ibs; i++) {
                        r = amdgpu_ring_parse_cs(ring, p, i);
                        if (r)
                                return r;
                }
-       }
-
-       p->job->vm_pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);
+       } else {
+               p->job->vm_pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);
 
-       r = amdgpu_bo_vm_update_pte(p, vm);
-       if (!r)
-               amdgpu_cs_sync_rings(p);
+               r = amdgpu_bo_vm_update_pte(p, vm);
+               if (r)
+                       return r;
+       }
 
-       return r;
+       return amdgpu_cs_sync_rings(p);
 }
 
 static int amdgpu_cs_handle_lockup(struct amdgpu_device *adev, int r)