drm/amdgpu: fix ATC handling for Ryzen
authorChristian König <christian.koenig@amd.com>
Thu, 28 Mar 2019 12:53:38 +0000 (13:53 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Apr 2019 15:00:29 +0000 (10:00 -0500)
Otherwise we don't correctly use translate further.

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

index 21c712e34148883b386b4bb6c5bde51494560eae..eb8a5064eadf22cb35a6df4ed25516568e5d5152 100644 (file)
@@ -769,14 +769,17 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 
        addr = 0;
        if (ats_entries) {
-               uint64_t ats_value;
+               uint64_t value = 0, flags;
 
-               ats_value = AMDGPU_PTE_DEFAULT_ATC;
-               if (level != AMDGPU_VM_PTB)
-                       ats_value |= AMDGPU_PDE_PTE;
+               flags = AMDGPU_PTE_DEFAULT_ATC;
+               if (level != AMDGPU_VM_PTB) {
+                       /* Handle leaf PDEs as PTEs */
+                       flags |= AMDGPU_PDE_PTE;
+                       amdgpu_gmc_get_vm_pde(adev, level, &value, &flags);
+               }
 
                r = vm->update_funcs->update(&params, bo, addr, 0, ats_entries,
-                                            0, ats_value);
+                                            value, flags);
                if (r)
                        return r;