All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Nirmoy Das <nirmoy.das@amd.com>, amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com
Subject: Re: [PATCH 1/7] drm/amdgpu: add amdgpu_bo_vm bo type
Date: Wed, 26 May 2021 14:01:08 +0200	[thread overview]
Message-ID: <7779bec4-e2bc-83e8-2142-de6208fe8d6f@amd.com> (raw)
In-Reply-To: <20210526101027.14936-1-nirmoy.das@amd.com>

Am 26.05.21 um 12:10 schrieb Nirmoy Das:
> Add new BO subclass that will be used by amdgpu vm code.
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 32 ++++++++++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 10 +++++++
>   2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 3f85ba8222ef..6870cc297ae6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -694,6 +694,38 @@ int amdgpu_bo_create_user(struct amdgpu_device *adev,
>   	*ubo_ptr = to_amdgpu_bo_user(bo_ptr);
>   	return r;
>   }
> +
> +/**
> + * amdgpu_bo_create_vm - create an &amdgpu_bo_vm buffer object
> + * @adev: amdgpu device object
> + * @bp: parameters to be used for the buffer object
> + * @vmbo_ptr: pointer to the buffer object pointer
> + *
> + * Create a BO to be for GPUVM.
> + *
> + * Returns:
> + * 0 for success or a negative error code on failure.
> + */
> +
> +int amdgpu_bo_create_vm(struct amdgpu_device *adev,
> +			struct amdgpu_bo_param *bp,
> +			struct amdgpu_bo_vm **vmbo_ptr)
> +{
> +	struct amdgpu_bo *bo_ptr;
> +	int r;
> +
> +	/* bo_ptr_size will be determined by the caller and it depends on
> +	 * num of amdgpu_vm_pt entries.
> +	 */
> +	BUG_ON(bp->bo_ptr_size < sizeof(struct amdgpu_bo_vm));
> +	r = amdgpu_bo_create(adev, bp, &bo_ptr);
> +	if (r)
> +		return r;
> +
> +	*vmbo_ptr = to_amdgpu_bo_vm(bo_ptr);
> +	return r;
> +}
> +
>   /**
>    * amdgpu_bo_validate - validate an &amdgpu_bo buffer object
>    * @bo: pointer to the buffer object
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index 11480c5a2716..a7fbf5f7051e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -44,6 +44,7 @@
>   #define AMDGPU_AMDKFD_CREATE_SVM_BO	(1ULL << 62)
>   
>   #define to_amdgpu_bo_user(abo) container_of((abo), struct amdgpu_bo_user, bo)
> +#define to_amdgpu_bo_vm(abo) container_of((abo), struct amdgpu_bo_vm, bo)
>   
>   struct amdgpu_bo_param {
>   	unsigned long			size;
> @@ -125,6 +126,12 @@ struct amdgpu_bo_user {
>   
>   };
>   
> +struct amdgpu_bo_vm {
> +	struct amdgpu_bo		bo;
> +	struct amdgpu_bo		*shadow;
> +	struct amdgpu_vm_pt             entries[];
> +};
> +
>   static inline struct amdgpu_bo *ttm_to_amdgpu_bo(struct ttm_buffer_object *tbo)
>   {
>   	return container_of(tbo, struct amdgpu_bo, tbo);
> @@ -272,6 +279,9 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>   int amdgpu_bo_create_user(struct amdgpu_device *adev,
>   			  struct amdgpu_bo_param *bp,
>   			  struct amdgpu_bo_user **ubo_ptr);
> +int amdgpu_bo_create_vm(struct amdgpu_device *adev,
> +			struct amdgpu_bo_param *bp,
> +			struct amdgpu_bo_vm **ubo_ptr);
>   void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
>   			   void **cpu_addr);
>   int amdgpu_bo_create_shadow(struct amdgpu_device *adev,

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2021-05-26 12:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 10:10 Nirmoy Das
2021-05-26 10:10 ` [PATCH 2/7] drm/amdgpu: move shadow bo validation to VM code Nirmoy Das
2021-05-26 12:02   ` Christian König
2021-05-26 12:38     ` Das, Nirmoy
2021-05-26 10:10 ` [PATCH 3/7] drm/amdgpu: use amdgpu_bo_vm for vm code Nirmoy Das
2021-05-26 12:39   ` Christian König
2021-05-26 10:10 ` [PATCH 4/7] drm/amdgpu: create shadow bo directly Nirmoy Das
2021-05-26 10:10 ` [PATCH 5/7] drm/amdgpu: switch to amdgpu_bo_vm for shadow pointer Nirmoy Das
2021-05-26 10:10 ` [PATCH 6/7] drm/amdgpu: remove unused code Nirmoy Das
2021-05-26 11:34   ` Das, Nirmoy
2021-05-26 10:10 ` [PATCH v2 7/7] drm/amdgpu: do not allocate entries separately Nirmoy Das
2021-05-26 12:01 ` Christian König [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-21 12:45 [PATCH 1/7] drm/amdgpu: add amdgpu_bo_vm bo type Nirmoy Das
2021-05-21 14:54 ` Alex Deucher
2021-05-21 15:19   ` Nirmoy

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=7779bec4-e2bc-83e8-2142-de6208fe8d6f@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=nirmoy.das@amd.com \
    --subject='Re: [PATCH 1/7] drm/amdgpu: add amdgpu_bo_vm bo type' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.