aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 512f59836436..79cdbf1b9dc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -252,11 +252,13 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
252 goto error_free; 252 goto error_free;
253 } 253 }
254 254
255 r = amdgpu_bo_pin(*bo_ptr, domain, gpu_addr); 255 r = amdgpu_bo_pin(*bo_ptr, domain);
256 if (r) { 256 if (r) {
257 dev_err(adev->dev, "(%d) kernel bo pin failed\n", r); 257 dev_err(adev->dev, "(%d) kernel bo pin failed\n", r);
258 goto error_unreserve; 258 goto error_unreserve;
259 } 259 }
260 if (gpu_addr)
261 *gpu_addr = amdgpu_bo_gpu_offset(*bo_ptr);
260 262
261 if (cpu_addr) { 263 if (cpu_addr) {
262 r = amdgpu_bo_kmap(*bo_ptr, cpu_addr); 264 r = amdgpu_bo_kmap(*bo_ptr, cpu_addr);
@@ -817,7 +819,6 @@ void amdgpu_bo_unref(struct amdgpu_bo **bo)
817 * @domain: domain to be pinned to 819 * @domain: domain to be pinned to
818 * @min_offset: the start of requested address range 820 * @min_offset: the start of requested address range
819 * @max_offset: the end of requested address range 821 * @max_offset: the end of requested address range
820 * @gpu_addr: GPU offset of the &amdgpu_bo buffer object
821 * 822 *
822 * Pins the buffer object according to requested domain and address range. If 823 * Pins the buffer object according to requested domain and address range. If
823 * the memory is unbound gart memory, binds the pages into gart table. Adjusts 824 * the memory is unbound gart memory, binds the pages into gart table. Adjusts
@@ -835,8 +836,7 @@ void amdgpu_bo_unref(struct amdgpu_bo **bo)
835 * 0 for success or a negative error code on failure. 836 * 0 for success or a negative error code on failure.
836 */ 837 */
837int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, 838int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
838 u64 min_offset, u64 max_offset, 839 u64 min_offset, u64 max_offset)
839 u64 *gpu_addr)
840{ 840{
841 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); 841 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
842 struct ttm_operation_ctx ctx = { false, false }; 842 struct ttm_operation_ctx ctx = { false, false };
@@ -868,8 +868,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
868 return -EINVAL; 868 return -EINVAL;
869 869
870 bo->pin_count++; 870 bo->pin_count++;
871 if (gpu_addr)
872 *gpu_addr = amdgpu_bo_gpu_offset(bo);
873 871
874 if (max_offset != 0) { 872 if (max_offset != 0) {
875 u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset; 873 u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;
@@ -912,8 +910,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
912 } 910 }
913 911
914 bo->pin_count = 1; 912 bo->pin_count = 1;
915 if (gpu_addr != NULL)
916 *gpu_addr = amdgpu_bo_gpu_offset(bo);
917 913
918 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); 914 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
919 if (domain == AMDGPU_GEM_DOMAIN_VRAM) { 915 if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
@@ -931,7 +927,6 @@ error:
931 * amdgpu_bo_pin - pin an &amdgpu_bo buffer object 927 * amdgpu_bo_pin - pin an &amdgpu_bo buffer object
932 * @bo: &amdgpu_bo buffer object to be pinned 928 * @bo: &amdgpu_bo buffer object to be pinned
933 * @domain: domain to be pinned to 929 * @domain: domain to be pinned to
934 * @gpu_addr: GPU offset of the &amdgpu_bo buffer object
935 * 930 *
936 * A simple wrapper to amdgpu_bo_pin_restricted(). 931 * A simple wrapper to amdgpu_bo_pin_restricted().
937 * Provides a simpler API for buffers that do not have any strict restrictions 932 * Provides a simpler API for buffers that do not have any strict restrictions
@@ -940,9 +935,9 @@ error:
940 * Returns: 935 * Returns:
941 * 0 for success or a negative error code on failure. 936 * 0 for success or a negative error code on failure.
942 */ 937 */
943int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr) 938int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain)
944{ 939{
945 return amdgpu_bo_pin_restricted(bo, domain, 0, 0, gpu_addr); 940 return amdgpu_bo_pin_restricted(bo, domain, 0, 0);
946} 941}
947 942
948/** 943/**