[PATCH 2/3] drm/amdgpu: only bind VM shadows after validation v2

Felix Kuehling felix.kuehling at amd.com
Mon Jul 31 15:24:26 UTC 2017


Hi Christian,

If I'm reading this correctly, now you're only binding page directories,
but not the leaf page tables. Is that intentional?

Regards,
  Felix


On 17-07-29 07:32 AM, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
>
> No need to do this on every CS.
>
> v2: remove all other bind, reorder code
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index a375135..0308bb4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -165,6 +165,14 @@ static int amdgpu_vm_validate_level(struct amdgpu_vm_pt *parent,
>  	unsigned i;
>  	int r;
>  
> +	if (parent->bo->shadow) {
> +		struct amdgpu_bo *shadow = parent->bo->shadow;
> +
> +		r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
> +		if (r)
> +			return r;
> +	}
> +
>  	if (use_cpu_for_update) {
>  		r = amdgpu_bo_kmap(parent->bo, NULL);
>  		if (r)
> @@ -1030,11 +1038,6 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
>  
>  		params.func = amdgpu_vm_cpu_set_ptes;
>  	} else {
> -		if (shadow) {
> -			r = amdgpu_ttm_bind(&shadow->tbo, &shadow->tbo.mem);
> -			if (r)
> -				return r;
> -		}
>  		ring = container_of(vm->entity.sched, struct amdgpu_ring,
>  				    sched);
>  
> @@ -1070,15 +1073,6 @@ static int amdgpu_vm_update_level(struct amdgpu_device *adev,
>  		if (bo == NULL)
>  			continue;
>  
> -		if (bo->shadow) {
> -			struct amdgpu_bo *pt_shadow = bo->shadow;
> -
> -			r = amdgpu_ttm_bind(&pt_shadow->tbo,
> -					    &pt_shadow->tbo.mem);
> -			if (r)
> -				return r;
> -		}
> -
>  		pt = amdgpu_bo_gpu_offset(bo);
>  		pt = amdgpu_gart_get_vm_pde(adev, pt);
>  		if (parent->entries[pt_idx].addr == pt ||



More information about the amd-gfx mailing list