Commit 22b40f7a authored by Nirmoy Das's avatar Nirmoy Das Committed by Alex Deucher

drm/amdgpu: use amdgpu_bo_create_user() for when possible

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
Signed-off-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9ad0d033
...@@ -318,6 +318,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size, ...@@ -318,6 +318,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)kgd; struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
struct amdgpu_bo *bo = NULL; struct amdgpu_bo *bo = NULL;
struct amdgpu_bo_user *ubo;
struct amdgpu_bo_param bp; struct amdgpu_bo_param bp;
int r; int r;
...@@ -330,13 +331,14 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size, ...@@ -330,13 +331,14 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
bp.resv = NULL; bp.resv = NULL;
bp.bo_ptr_size = sizeof(struct amdgpu_bo); 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) { if (r) {
dev_err(adev->dev, dev_err(adev->dev,
"failed to allocate gws BO for amdkfd (%d)\n", r); "failed to allocate gws BO for amdkfd (%d)\n", r);
return r; return r;
} }
bo = &ubo->bo;
*mem_obj = bo; *mem_obj = bo;
return 0; return 0;
} }
......
...@@ -58,6 +58,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, ...@@ -58,6 +58,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
struct drm_gem_object **obj) struct drm_gem_object **obj)
{ {
struct amdgpu_bo *bo; struct amdgpu_bo *bo;
struct amdgpu_bo_user *ubo;
struct amdgpu_bo_param bp; struct amdgpu_bo_param bp;
int r; int r;
...@@ -73,10 +74,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, ...@@ -73,10 +74,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
bp.domain = initial_domain; bp.domain = initial_domain;
bp.bo_ptr_size = sizeof(struct amdgpu_bo); 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) if (r)
return r; return r;
bo = &ubo->bo;
*obj = &bo->tbo.base; *obj = &bo->tbo.base;
(*obj)->funcs = &amdgpu_gem_object_funcs; (*obj)->funcs = &amdgpu_gem_object_funcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment