public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/3] drm/amdgpu: move size calculations to the front of the file again
Date: Mon, 3 Sep 2018 10:56:58 +0800	[thread overview]
Message-ID: <5B8CA2FA.4060801@amd.com> (raw)
In-Reply-To: <20180901180509.1442-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>

On 09/02/2018 02:05 AM, Christian König wrote:
> amdgpu_vm_bo_* functions should come much later.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 90 +++++++++++++++++-----------------
>   1 file changed, 45 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index d59222fb5931..a9275a99d793 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -133,51 +133,6 @@ struct amdgpu_prt_cb {
>   	struct dma_fence_cb cb;
>   };
>
> -/**
> - * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
> - *
> - * @base: base structure for tracking BO usage in a VM
> - * @vm: vm to which bo is to be added
> - * @bo: amdgpu buffer object
> - *
> - * Initialize a bo_va_base structure and add it to the appropriate lists
> - *
> - */
> -static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
> -				   struct amdgpu_vm *vm,
> -				   struct amdgpu_bo *bo)
> -{
> -	base->vm = vm;
> -	base->bo = bo;
> -	INIT_LIST_HEAD(&base->bo_list);
> -	INIT_LIST_HEAD(&base->vm_status);
> -
> -	if (!bo)
> -		return;
> -	list_add_tail(&base->bo_list, &bo->va);
> -
> -	if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
> -		return;
> -
> -	vm->bulk_moveable = false;
> -	if (bo->tbo.type == ttm_bo_type_kernel)
> -		list_move(&base->vm_status, &vm->relocated);
> -	else
> -		list_move(&base->vm_status, &vm->idle);
> -
> -	if (bo->preferred_domains &
> -	    amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
> -		return;
> -
> -	/*
> -	 * we checked all the prerequisites, but it looks like this per vm bo
> -	 * is currently evicted. add the bo to the evicted list to make sure it
> -	 * is validated on next vm use to avoid fault.
> -	 * */
> -	list_move_tail(&base->vm_status, &vm->evicted);
> -	base->moved = true;
> -}
> -
>   /**
>    * amdgpu_vm_level_shift - return the addr shift for each level
>    *
> @@ -249,6 +204,51 @@ static unsigned amdgpu_vm_bo_size(struct amdgpu_device *adev, unsigned level)
>   	return AMDGPU_GPU_PAGE_ALIGN(amdgpu_vm_num_entries(adev, level) * 8);
>   }
>
> +/**
> + * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
> + *
> + * @base: base structure for tracking BO usage in a VM
> + * @vm: vm to which bo is to be added
> + * @bo: amdgpu buffer object
> + *
> + * Initialize a bo_va_base structure and add it to the appropriate lists
> + *
> + */
> +static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
> +				   struct amdgpu_vm *vm,
> +				   struct amdgpu_bo *bo)
> +{
> +	base->vm = vm;
> +	base->bo = bo;
> +	INIT_LIST_HEAD(&base->bo_list);
> +	INIT_LIST_HEAD(&base->vm_status);
> +
> +	if (!bo)
> +		return;
> +	list_add_tail(&base->bo_list, &bo->va);
> +
> +	if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
> +		return;
> +
> +	vm->bulk_moveable = false;
> +	if (bo->tbo.type == ttm_bo_type_kernel)
> +		list_move(&base->vm_status, &vm->relocated);
> +	else
> +		list_move(&base->vm_status, &vm->idle);
> +
> +	if (bo->preferred_domains &
> +	    amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
> +		return;
> +
> +	/*
> +	 * we checked all the prerequisites, but it looks like this per vm bo
> +	 * is currently evicted. add the bo to the evicted list to make sure it
> +	 * is validated on next vm use to avoid fault.
> +	 * */
> +	list_move_tail(&base->vm_status, &vm->evicted);
> +	base->moved = true;
> +}
> +
>   /**
>    * amdgpu_vm_get_pd_bo - add the VM PD to a validation list
>    *
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-09-03  2:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01 18:05 [PATCH 1/3] drm/amdgpu: move size calculations to the front of the file again Christian König
     [not found] ` <20180901180509.1442-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-01 18:05   ` [PATCH 2/3] drm/amdgpu: separate per VM BOs from normal in the moved state Christian König
     [not found]     ` <20180901180509.1442-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-03  2:52       ` Zhang, Jerry (Junwei)
2018-09-01 18:05   ` [PATCH 3/3] drm/amdgpu: improve VM state machine documentation Christian König
     [not found]     ` <20180901180509.1442-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-09-03  2:56       ` Zhang, Jerry (Junwei)
2018-09-03  2:56   ` Zhang, Jerry (Junwei) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B8CA2FA.4060801@amd.com \
    --to=jerry.zhang-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox