[PATCH 5/8] drm/amdgpu: remove keeping the addr of the VM PDs

Christian König ckoenig.leichtzumerken at gmail.com
Fri Dec 8 16:41:04 UTC 2017


No more double house keeping.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 ++++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  2 +-
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index ae5451bf5873..abb3d4fb49f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -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) {
@@ -1126,15 +1125,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;
-
 	incr = amdgpu_bo_size(bo);
 	if (shadow) {
 		pde = shadow_addr + (entry - parent->entries) * 8;
@@ -1202,7 +1198,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);
@@ -1335,10 +1330,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
@@ -1412,7 +1407,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;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 7a308a1ea048..228f63e9ac5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -137,7 +137,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;
-- 
2.11.0



More information about the amd-gfx mailing list