OSDN Git Service

drm/amdgpu: remove keeping the addr of the VM PDs
authorChristian König <christian.koenig@amd.com>
Thu, 30 Nov 2017 14:41:28 +0000 (15:41 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Dec 2017 19:46:06 +0000 (14:46 -0500)
No more double house keeping.

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

index 25fdcba..9e6cf13 100644 (file)
@@ -383,7 +383,6 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
                        spin_lock(&vm->status_lock);
                        list_add(&entry->base.vm_status, &vm->relocated);
                        spin_unlock(&vm->status_lock);
-                       entry->addr = 0;
                }
 
                if (level < adev->vm_manager.num_level) {
@@ -1125,15 +1124,12 @@ static int amdgpu_vm_update_pde(struct amdgpu_device *adev,
        pt = amdgpu_bo_gpu_offset(bo);
        pt = amdgpu_gart_get_vm_pde(adev, pt);
        /* Don't update huge pages here */
-       if (entry->addr & AMDGPU_PDE_PTE ||
-           entry->addr == (pt | AMDGPU_PTE_VALID)) {
+       if (entry->huge) {
                if (!vm->use_cpu_for_update)
                        amdgpu_job_free(job);
                return 0;
        }
 
-       entry->addr = pt | AMDGPU_PTE_VALID;
-
        if (shadow) {
                pde = shadow_addr + (entry - parent->entries) * 8;
                params.func(&params, pde, pt, 1, 0, AMDGPU_PTE_VALID);
@@ -1199,7 +1195,6 @@ static void amdgpu_vm_invalidate_level(struct amdgpu_device *adev,
                if (!entry->base.bo)
                        continue;
 
-               entry->addr = ~0ULL;
                spin_lock(&vm->status_lock);
                if (list_empty(&entry->base.vm_status))
                        list_add(&entry->base.vm_status, &vm->relocated);
@@ -1332,10 +1327,10 @@ static void amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
                flags |= AMDGPU_PDE_PTE;
        }
 
-       if (entry->addr == (dst | flags))
+       if (!entry->huge && !(flags & AMDGPU_PDE_PTE))
                return;
 
-       entry->addr = (dst | flags);
+       entry->huge = !!(flags & AMDGPU_PDE_PTE);
 
        if (use_cpu_update) {
                /* In case a huge page is replaced with a system
@@ -1409,7 +1404,7 @@ static int amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
                amdgpu_vm_handle_huge_pages(params, entry, parent,
                                            nptes, dst, flags);
                /* We don't need to update PTEs for huge pages */
-               if (entry->addr & AMDGPU_PDE_PTE)
+               if (entry->huge)
                        continue;
 
                pt = entry->base.bo;
index 2f1d0c8..e52bf98 100644 (file)
@@ -138,7 +138,7 @@ struct amdgpu_vm_bo_base {
 
 struct amdgpu_vm_pt {
        struct amdgpu_vm_bo_base        base;
-       uint64_t                        addr;
+       bool                            huge;
 
        /* array of page tables, one for each directory entry */
        struct amdgpu_vm_pt             *entries;