]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amdgpu: remove amdgpu_pin_restricted()
authorChristian König <christian.koenig@amd.com>
Wed, 5 Jun 2024 14:34:49 +0000 (16:34 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Sep 2024 20:15:09 +0000 (16:15 -0400)
We haven't used the functionality to pin BOs in a certain range at all
while the driver existed. Just nuke it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

index 4afef5b46c7d53199cddf3319bcc0995608f5aeb..ce5ca304dba93bb417ada7965397bb71173b7ba3 100644 (file)
@@ -1499,7 +1499,7 @@ static int amdgpu_amdkfd_gpuvm_pin_bo(struct amdgpu_bo *bo, u32 domain)
                }
        }
 
-       ret = amdgpu_bo_pin_restricted(bo, domain, 0, 0);
+       ret = amdgpu_bo_pin(bo, domain);
        if (ret)
                pr_err("Error in Pinning BO to domain: %d\n", domain);
 
index d62df3b5a0149277b7a49be789f55e576d29507a..5bff4249b35737e2be6aaf17ee0aa3ebf0ee2f71 100644 (file)
@@ -809,29 +809,22 @@ void amdgpu_bo_unref(struct amdgpu_bo **bo)
 }
 
 /**
- * amdgpu_bo_pin_restricted - pin an &amdgpu_bo buffer object
+ * amdgpu_bo_pin - pin an &amdgpu_bo buffer object
  * @bo: &amdgpu_bo buffer object to be pinned
  * @domain: domain to be pinned to
- * @min_offset: the start of requested address range
- * @max_offset: the end of requested address range
  *
- * Pins the buffer object according to requested domain and address range. If
- * the memory is unbound gart memory, binds the pages into gart table. Adjusts
- * pin_count and pin_size accordingly.
+ * Pins the buffer object according to requested domain. If the memory is
+ * unbound gart memory, binds the pages into gart table. Adjusts pin_count and
+ * pin_size accordingly.
  *
  * Pinning means to lock pages in memory along with keeping them at a fixed
  * offset. It is required when a buffer can not be moved, for example, when
  * a display buffer is being scanned out.
  *
- * Compared with amdgpu_bo_pin(), this function gives more flexibility on
- * where to pin a buffer if there are specific restrictions on where a buffer
- * must be located.
- *
  * Returns:
  * 0 for success or a negative error code on failure.
  */
-int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
-                            u64 min_offset, u64 max_offset)
+int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain)
 {
        struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
        struct ttm_operation_ctx ctx = { false, false };
@@ -840,9 +833,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
        if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
                return -EPERM;
 
-       if (WARN_ON_ONCE(min_offset > max_offset))
-               return -EINVAL;
-
        /* Check domain to be pinned to against preferred domains */
        if (bo->preferred_domains & domain)
                domain = bo->preferred_domains & domain;
@@ -868,14 +858,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                        return -EINVAL;
 
                ttm_bo_pin(&bo->tbo);
-
-               if (max_offset != 0) {
-                       u64 domain_start = amdgpu_ttm_domain_start(adev,
-                                                                  mem_type);
-                       WARN_ON_ONCE(max_offset <
-                                    (amdgpu_bo_gpu_offset(bo) - domain_start));
-               }
-
                return 0;
        }
 
@@ -892,17 +874,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
        amdgpu_bo_placement_from_domain(bo, domain);
        for (i = 0; i < bo->placement.num_placement; i++) {
-               unsigned int fpfn, lpfn;
-
-               fpfn = min_offset >> PAGE_SHIFT;
-               lpfn = max_offset >> PAGE_SHIFT;
-
-               if (fpfn > bo->placements[i].fpfn)
-                       bo->placements[i].fpfn = fpfn;
-               if (!bo->placements[i].lpfn ||
-                   (lpfn && lpfn < bo->placements[i].lpfn))
-                       bo->placements[i].lpfn = lpfn;
-
                if (bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS &&
                    bo->placements[i].mem_type == TTM_PL_VRAM)
                        bo->placements[i].flags |= TTM_PL_FLAG_CONTIGUOUS;
@@ -928,23 +899,6 @@ error:
        return r;
 }
 
-/**
- * amdgpu_bo_pin - pin an &amdgpu_bo buffer object
- * @bo: &amdgpu_bo buffer object to be pinned
- * @domain: domain to be pinned to
- *
- * A simple wrapper to amdgpu_bo_pin_restricted().
- * Provides a simpler API for buffers that do not have any strict restrictions
- * on where a buffer must be located.
- *
- * Returns:
- * 0 for success or a negative error code on failure.
- */
-int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain)
-{
-       return amdgpu_bo_pin_restricted(bo, domain, 0, 0);
-}
-
 /**
  * amdgpu_bo_unpin - unpin an &amdgpu_bo buffer object
  * @bo: &amdgpu_bo buffer object to be unpinned
index e42c34a3289d5073b10c4b8746cfbe275378713f..717e47b46167a4330d36655d0df43e5765e4b4c3 100644 (file)
@@ -304,8 +304,6 @@ void amdgpu_bo_kunmap(struct amdgpu_bo *bo);
 struct amdgpu_bo *amdgpu_bo_ref(struct amdgpu_bo *bo);
 void amdgpu_bo_unref(struct amdgpu_bo **bo);
 int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain);
-int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
-                            u64 min_offset, u64 max_offset);
 void amdgpu_bo_unpin(struct amdgpu_bo *bo);
 int amdgpu_bo_init(struct amdgpu_device *adev);
 void amdgpu_bo_fini(struct amdgpu_device *adev);