drm/amdgpu: drop unnecessary restriction for huge root PDEs
authorChristian König <christian.koenig@amd.com>
Wed, 18 Dec 2019 13:49:35 +0000 (14:49 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Feb 2020 04:30:39 +0000 (23:30 -0500)
The root PD can also contain huge PDEs.

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 d16231d..010561e 100644 (file)
@@ -120,23 +120,17 @@ static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm)
 static unsigned amdgpu_vm_level_shift(struct amdgpu_device *adev,
                                      unsigned level)
 {
-       unsigned shift = 0xff;
-
        switch (level) {
        case AMDGPU_VM_PDB2:
        case AMDGPU_VM_PDB1:
        case AMDGPU_VM_PDB0:
-               shift = 9 * (AMDGPU_VM_PDB0 - level) +
+               return 9 * (AMDGPU_VM_PDB0 - level) +
                        adev->vm_manager.block_size;
-               break;
        case AMDGPU_VM_PTB:
-               shift = 0;
-               break;
+               return 0;
        default:
-               dev_err(adev->dev, "the level%d isn't supported.\n", level);
+               return ~0;
        }
-
-       return shift;
 }
 
 /**
@@ -1458,13 +1452,6 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
 
                pt = cursor.entry->base.bo;
 
-               /* The root level can't be a huge page */
-               if (cursor.level == adev->vm_manager.root_level) {
-                       if (!amdgpu_vm_pt_descendant(adev, &cursor))
-                               return -ENOENT;
-                       continue;
-               }
-
                shift = amdgpu_vm_level_shift(adev, cursor.level);
                parent_shift = amdgpu_vm_level_shift(adev, cursor.level - 1);
                if (adev->asic_type < CHIP_VEGA10 &&
@@ -1483,11 +1470,9 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params,
                        if (!amdgpu_vm_pt_descendant(adev, &cursor))
                                return -ENOENT;
                        continue;
-               } else if (frag >= parent_shift &&
-                          cursor.level - 1 != adev->vm_manager.root_level) {
+               } else if (frag >= parent_shift) {
                        /* If the fragment size is even larger than the parent
-                        * shift we should go up one level and check it again
-                        * unless one level up is the root level.
+                        * shift we should go up one level and check it again.
                         */
                        if (!amdgpu_vm_pt_ancestor(&cursor))
                                return -ENOENT;