[PATCH 4/8] drm/amdgpu: drop the extra VM huge page flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Thursday, August 10, 2017 10:51 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH 4/8] drm/amdgpu: drop the extra VM huge page flag
> 
> From: Christian König <christian.koenig at amd.com>
> 
> Just add the flags to the addr field as well.

The flag makes it easier to understand what is going on.  Can you add some comments to the code when you set the flags to describe that this is for huge pages?  That should make it clear why we need to set them the way we do.  With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 ++++++---------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |  1 -
>  2 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index d982ba7..de652bf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -330,7 +330,6 @@ static int amdgpu_vm_alloc_levels(struct
> amdgpu_device *adev,
> 
>  			entry->bo = pt;
>  			entry->addr = 0;
> -			entry->huge_page = false;
>  		}
> 
>  		if (level < adev->vm_manager.num_level) {
> @@ -1082,11 +1081,11 @@ static int amdgpu_vm_update_level(struct
> amdgpu_device *adev,
> 
>  		pt = amdgpu_bo_gpu_offset(bo);
>  		pt = amdgpu_gart_get_vm_pde(adev, pt);
> -		if (parent->entries[pt_idx].addr == pt ||
> -		    parent->entries[pt_idx].huge_page)
> +		if ((parent->entries[pt_idx].addr & AMDGPU_PDE_PTE) ||
> +		    parent->entries[pt_idx].addr == (pt |
> AMDGPU_PTE_VALID))
>  			continue;
> 
> -		parent->entries[pt_idx].addr = pt;
> +		parent->entries[pt_idx].addr = pt | AMDGPU_PTE_VALID;
> 
>  		pde = pd_addr + pt_idx * 8;
>  		if (((last_pde + 8 * count) != pde) ||
> @@ -1286,12 +1285,10 @@ static void
> amdgpu_vm_handle_huge_pages(struct amdgpu_pte_update_params *p,
>  		flags |= AMDGPU_PDE_PTE;
>  	}
> 
> -	if (entry->addr == dst &&
> -	    entry->huge_page == !!(flags & AMDGPU_PDE_PTE))
> +	if (entry->addr == (dst | flags))
>  		return;
> 
> -	entry->addr = dst;
> -	entry->huge_page = !!(flags & AMDGPU_PDE_PTE);
> +	entry->addr = (dst | flags);
> 
>  	if (use_cpu_update) {
>  		pd_addr = (unsigned long)amdgpu_bo_kptr(parent->bo);
> @@ -1350,7 +1347,7 @@ static int amdgpu_vm_update_ptes(struct
> amdgpu_pte_update_params *params,
> 
>  		amdgpu_vm_handle_huge_pages(params, entry, parent,
>  					    nptes, dst, flags);
> -		if (entry->huge_page)
> +		if (entry->addr & AMDGPU_PDE_PTE)
>  			continue;
> 
>  		pt = entry->bo;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 9c309c5..f12c12f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -103,7 +103,6 @@ struct amdgpu_bo_list_entry;
>  struct amdgpu_vm_pt {
>  	struct amdgpu_bo	*bo;
>  	uint64_t		addr;
> -	bool			huge_page;
> 
>  	/* array of page tables, one for each directory entry */
>  	struct amdgpu_vm_pt	*entries;
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux