Re: [PATCH 4/5] drm/amdgpu: use amdgpu_bo_create_user() for when possible

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

 



Am 09.03.21 um 09:46 schrieb Nirmoy Das:
Use amdgpu_bo_create_user() for all the BO allocations for
ttm_bo_type_device type.

v2: include amdgpu_amdkfd_alloc_gws() as well it calls amdgpu_bo_create()
     for  ttm_bo_type_device

CC: felix.kuehling@xxxxxxx
Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx>

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

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 +++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    | 4 +++-
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 2151fcb1e19d..de6b3ca64b45 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -317,6 +317,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
  	struct amdgpu_bo *bo = NULL;
+	struct amdgpu_bo_user *ubo;
  	struct amdgpu_bo_param bp;
  	int r;

@@ -329,13 +330,14 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
  	bp.resv = NULL;
  	bp.bo_ptr_size = sizeof(struct amdgpu_bo);

-	r = amdgpu_bo_create(adev, &bp, &bo);
+	r = amdgpu_bo_create_user(adev, &bp, &ubo);
  	if (r) {
  		dev_err(adev->dev,
  			"failed to allocate gws BO for amdkfd (%d)\n", r);
  		return r;
  	}

+	bo = &ubo->bo;
  	*mem_obj = bo;
  	return 0;
  }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index bca260d56f76..311bcdc59eda 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -58,6 +58,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
  			     struct drm_gem_object **obj)
  {
  	struct amdgpu_bo *bo;
+	struct amdgpu_bo_user *ubo;
  	struct amdgpu_bo_param bp;
  	int r;

@@ -73,10 +74,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
  	bp.domain = initial_domain;
  	bp.bo_ptr_size = sizeof(struct amdgpu_bo);

-	r = amdgpu_bo_create(adev, &bp, &bo);
+	r = amdgpu_bo_create_user(adev, &bp, &ubo);
  	if (r)
  		return r;

+	bo = &ubo->bo;
  	*obj = &bo->tbo.base;
  	(*obj)->funcs = &amdgpu_gem_object_funcs;

--
2.30.1


_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
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