aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'amdgpu/amdgpu_vamgr.c')
-rw-r--r--amdgpu/amdgpu_vamgr.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index 58400428..ac1202de 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -201,10 +201,21 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
201{ 201{
202 struct amdgpu_bo_va_mgr *vamgr; 202 struct amdgpu_bo_va_mgr *vamgr;
203 203
204 if (flags & AMDGPU_VA_RANGE_32_BIT) 204 /* Clear the flag when the high VA manager is not initialized */
205 vamgr = &dev->vamgr_32; 205 if (flags & AMDGPU_VA_RANGE_HIGH && !dev->vamgr_high_32.va_max)
206 else 206 flags &= ~AMDGPU_VA_RANGE_HIGH;
207 vamgr = &dev->vamgr; 207
208 if (flags & AMDGPU_VA_RANGE_HIGH) {
209 if (flags & AMDGPU_VA_RANGE_32_BIT)
210 vamgr = &dev->vamgr_high_32;
211 else
212 vamgr = &dev->vamgr_high;
213 } else {
214 if (flags & AMDGPU_VA_RANGE_32_BIT)
215 vamgr = &dev->vamgr_32;
216 else
217 vamgr = &dev->vamgr;
218 }
208 219
209 va_base_alignment = MAX2(va_base_alignment, vamgr->va_alignment); 220 va_base_alignment = MAX2(va_base_alignment, vamgr->va_alignment);
210 size = ALIGN(size, vamgr->va_alignment); 221 size = ALIGN(size, vamgr->va_alignment);
@@ -215,7 +226,10 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
215 if (!(flags & AMDGPU_VA_RANGE_32_BIT) && 226 if (!(flags & AMDGPU_VA_RANGE_32_BIT) &&
216 (*va_base_allocated == AMDGPU_INVALID_VA_ADDRESS)) { 227 (*va_base_allocated == AMDGPU_INVALID_VA_ADDRESS)) {
217 /* fallback to 32bit address */ 228 /* fallback to 32bit address */
218 vamgr = &dev->vamgr_32; 229 if (flags & AMDGPU_VA_RANGE_HIGH)
230 vamgr = &dev->vamgr_high_32;
231 else
232 vamgr = &dev->vamgr_32;
219 *va_base_allocated = amdgpu_vamgr_find_va(vamgr, size, 233 *va_base_allocated = amdgpu_vamgr_find_va(vamgr, size,
220 va_base_alignment, va_base_required); 234 va_base_alignment, va_base_required);
221 } 235 }