amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: Nirmoy Das <nirmoy.das@amd.com>, Christian.Koenig@amd.com
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/amdgpu: cleanup amdgpu_vm_init()
Date: Thu, 22 Apr 2021 12:13:04 -0400	[thread overview]
Message-ID: <2b855a1c-d9c3-12fc-d3d2-3c590ce9b149@amd.com> (raw)
In-Reply-To: <20210422154003.4048-2-nirmoy.das@amd.com>


Am 2021-04-22 um 11:39 a.m. schrieb Nirmoy Das:
> Currently only way to create compute vm is through
> amdgpu_vm_make_compute(). So vm_context isn't required
> anymore for amdgpu_vm_init().
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>

I believe you can also remove the AMDGPU_VM_CONTEXT_* #defines from
amdgpu_vm.h. With that fixed, the patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  3 ++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 16 +++-------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  3 +--
>  3 files changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 39ee88d29cca..07e8a7c28561 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1114,7 +1114,8 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
>  		dev_warn(adev->dev, "No more PASIDs available!");
>  		pasid = 0;
>  	}
> -	r = amdgpu_vm_init(adev, &fpriv->vm, AMDGPU_VM_CONTEXT_GFX, pasid);
> +
> +	r = amdgpu_vm_init(adev, &fpriv->vm, pasid);
>  	if (r)
>  		goto error_pasid;
>  
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index f95bcda8463f..577148a4ffaa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -2782,8 +2782,7 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout)
>   * Returns:
>   * 0 for success, error for failure.
>   */
> -int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
> -		   int vm_context, u32 pasid)
> +int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid)
>  {
>  	struct amdgpu_bo_param bp;
>  	struct amdgpu_bo *root;
> @@ -2817,16 +2816,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	vm->pte_support_ats = false;
>  	vm->is_compute_context = false;
>  
> -	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE) {
> -		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
> -						AMDGPU_VM_USE_CPU_FOR_COMPUTE);
> +	vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
> +				    AMDGPU_VM_USE_CPU_FOR_GFX);
>  
> -		if (adev->asic_type == CHIP_RAVEN)
> -			vm->pte_support_ats = true;
> -	} else {
> -		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
> -						AMDGPU_VM_USE_CPU_FOR_GFX);
> -	}
>  	DRM_DEBUG_DRIVER("VM update mode is %s\n",
>  			 vm->use_cpu_for_update ? "CPU" : "SDMA");
>  	WARN_ONCE((vm->use_cpu_for_update &&
> @@ -2844,8 +2836,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>  	vm->evicting = false;
>  
>  	amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, false, &bp);
> -	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE)
> -		bp.flags &= ~AMDGPU_GEM_CREATE_SHADOW;
>  	r = amdgpu_bo_create(adev, &bp, &root);
>  	if (r)
>  		goto error_free_delayed;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 848e175e99ff..7f07acae447b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -379,8 +379,7 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev);
>  void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
>  
>  long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
> -int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
> -		   int vm_context, u32 pasid);
> +int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid);
>  int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, u32 pasid);
>  void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
>  void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-04-22 16:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 15:39 [PATCH 1/6] drm/amdgpu: expose amdgpu_bo_create_shadow() Nirmoy Das
2021-04-22 15:39 ` [PATCH 2/6] drm/amdgpu: cleanup amdgpu_vm_init() Nirmoy Das
2021-04-22 16:13   ` Felix Kuehling [this message]
2021-04-22 15:40 ` [PATCH 3/6] drm/amdgpu: remove unused vm context flags Nirmoy Das
2021-04-22 16:14   ` Felix Kuehling
2021-04-22 15:40 ` [PATCH 4/6] create shadow bo using amdgpu_bo_create_shadow() Nirmoy Das
2021-04-23  7:55   ` Christian König
2021-04-23  9:32     ` Nirmoy
2021-04-22 15:40 ` [PATCH 5/6] drm/amdgpu: cleanup amdgpu_bo_create() Nirmoy Das
2021-04-22 15:40 ` [PATCH 6/6] drm/amdgpu: remove AMDGPU_GEM_CREATE_SHADOW flag Nirmoy Das
2021-04-23  7:57   ` Christian König
2021-04-23 11:17 [PATCH 1/6] drm/amdgpu: expose amdgpu_bo_create_shadow() Nirmoy Das
2021-04-23 11:17 ` [PATCH 2/6] drm/amdgpu: cleanup amdgpu_vm_init() Nirmoy Das

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=2b855a1c-d9c3-12fc-d3d2-3c590ce9b149@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=nirmoy.das@amd.com \
    /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;
as well as URLs for NNTP newsgroup(s).