aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
index f7d22c44034d..1ef625550442 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
@@ -81,6 +81,20 @@ static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man)
81} 81}
82 82
83/** 83/**
84 * amdgpu_gtt_mgr_is_allocated - Check if mem has address space
85 *
86 * @mem: the mem object to check
87 *
88 * Check if a mem object has already address space allocated.
89 */
90bool amdgpu_gtt_mgr_is_allocated(struct ttm_mem_reg *mem)
91{
92 struct drm_mm_node *node = mem->mm_node;
93
94 return (node->start != AMDGPU_BO_INVALID_OFFSET);
95}
96
97/**
84 * amdgpu_gtt_mgr_alloc - allocate new ranges 98 * amdgpu_gtt_mgr_alloc - allocate new ranges
85 * 99 *
86 * @man: TTM memory type manager 100 * @man: TTM memory type manager
@@ -101,7 +115,7 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
101 unsigned long fpfn, lpfn; 115 unsigned long fpfn, lpfn;
102 int r; 116 int r;
103 117
104 if (node->start != AMDGPU_BO_INVALID_OFFSET) 118 if (amdgpu_gtt_mgr_is_allocated(mem))
105 return 0; 119 return 0;
106 120
107 if (place) 121 if (place)