drm/amdgpu: fix initializing the VM BO shadow
authorChristian König <christian.koenig@amd.com>
Fri, 16 Sep 2016 12:07:46 +0000 (14:07 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 28 Sep 2016 20:16:22 +0000 (16:16 -0400)
We need to clear the shadows as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 04aa5a77e953ff037edfa948027d5743357e3bcc..3a43000bdf8cd2ab592e6218cd4581f463595f3c 100644 (file)
@@ -1435,6 +1435,15 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
                        goto error_free;
                }
 
+               if (pt->shadow) {
+                       r = amdgpu_vm_clear_bo(adev, vm, pt->shadow);
+                       if (r) {
+                               amdgpu_bo_unref(&pt->shadow);
+                               amdgpu_bo_unref(&pt);
+                               goto error_free;
+                       }
+               }
+
                entry->robj = pt;
                entry->priority = 0;
                entry->tv.bo = &entry->robj->tbo;
@@ -1632,6 +1641,12 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
        if (r)
                goto error_unreserve;
 
+       if (vm->page_directory->shadow) {
+               r = amdgpu_vm_clear_bo(adev, vm, vm->page_directory->shadow);
+               if (r)
+                       goto error_unreserve;
+       }
+
        vm->last_eviction_counter = atomic64_read(&adev->num_evictions);
        amdgpu_bo_unreserve(vm->page_directory);