drm/amdgpu: use amdgpu_bo_create_user() for when possible
authorNirmoy Das <nirmoy.das@amd.com>
Tue, 9 Mar 2021 07:31:25 +0000 (08:31 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Apr 2021 20:45:28 +0000 (16:45 -0400)
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: Nirmoy Das <nirmoy.das@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

index c52e169..c5b27ed 100644 (file)
@@ -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_bo *bo = NULL;
+       struct amdgpu_bo_user *ubo;
        struct amdgpu_bo_param bp;
        int r;
 
@@ -330,13 +331,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;
 }
index bca260d..311bcdc 100644 (file)
@@ -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;