aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--amdgpu/amdgpu.h1
-rw-r--r--amdgpu/amdgpu_device.c6
-rw-r--r--amdgpu/amdgpu_internal.h1
-rw-r--r--amdgpu/amdgpu_vamgr.c24
4 files changed, 24 insertions, 8 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 928b2a68..36f91058 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1162,6 +1162,7 @@ int amdgpu_read_mm_registers(amdgpu_device_handle dev, unsigned dword_offset,
1162 * Flag to request VA address range in the 32bit address space 1162 * Flag to request VA address range in the 32bit address space
1163*/ 1163*/
1164#define AMDGPU_VA_RANGE_32_BIT 0x1 1164#define AMDGPU_VA_RANGE_32_BIT 0x1
1165#define AMDGPU_VA_RANGE_HIGH 0x2
1165 1166
1166/** 1167/**
1167 * Allocate virtual address range 1168 * Allocate virtual address range
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index ca0c7987..9ff6ad16 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -268,7 +268,6 @@ int amdgpu_device_initialize(int fd,
268 max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL); 268 max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL);
269 amdgpu_vamgr_init(&dev->vamgr_32, start, max, 269 amdgpu_vamgr_init(&dev->vamgr_32, start, max,
270 dev->dev_info.virtual_address_alignment); 270 dev->dev_info.virtual_address_alignment);
271 dev->address32_hi = start >> 32;
272 271
273 start = max; 272 start = max;
274 max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL); 273 max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL);
@@ -323,7 +322,10 @@ int amdgpu_query_sw_info(amdgpu_device_handle dev, enum amdgpu_sw_info info,
323 322
324 switch (info) { 323 switch (info) {
325 case amdgpu_sw_info_address32_hi: 324 case amdgpu_sw_info_address32_hi:
326 *val32 = dev->address32_hi; 325 if (dev->vamgr_high_32.va_max)
326 *val32 = dev->vamgr_high_32.va_max >> 32;
327 else
328 *val32 = dev->vamgr_32.va_max >> 32;
327 return 0; 329 return 0;
328 } 330 }
329 return -EINVAL; 331 return -EINVAL;
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 423880ed..aeb5d651 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -73,7 +73,6 @@ struct amdgpu_device {
73 int flink_fd; 73 int flink_fd;
74 unsigned major_version; 74 unsigned major_version;
75 unsigned minor_version; 75 unsigned minor_version;
76 uint32_t address32_hi;
77 76
78 char *marketing_name; 77 char *marketing_name;
79 /** List of buffer handles. Protected by bo_table_mutex. */ 78 /** List of buffer handles. Protected by bo_table_mutex. */
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 }