aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König2017-11-02 12:54:59 -0500
committerChristian König2017-11-08 09:11:40 -0600
commita844925c8af45161145ab512efb8d5584c9d97f2 (patch)
tree1a368bb7e9d66b794a8356774ff856595426092b /amdgpu/amdgpu_device.c
parent4b4ccaac2e01af2d5846d168dedc2ee9cb8e7672 (diff)
downloadexternal-libdrm-a844925c8af45161145ab512efb8d5584c9d97f2.tar.gz
external-libdrm-a844925c8af45161145ab512efb8d5584c9d97f2.tar.xz
external-libdrm-a844925c8af45161145ab512efb8d5584c9d97f2.zip
amdgpu: sanitize 64bit VA manager
Adding the extra reservation of the 32bit space to the 64bit manager is complete nonsense and just a waste of memory and CPU cycles. Signed-off-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'amdgpu/amdgpu_device.c')
-rw-r--r--amdgpu/amdgpu_device.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 2b31c45b..344e87ed 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -270,22 +270,16 @@ int amdgpu_device_initialize(int fd,
270 goto cleanup; 270 goto cleanup;
271 } 271 }
272 272
273 amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset, 273 start = dev->dev_info.virtual_address_offset;
274 dev->dev_info.virtual_address_max,
275 dev->dev_info.virtual_address_alignment);
276
277 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); 274 max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
278 start = amdgpu_vamgr_find_va(&dev->vamgr,
279 max - dev->dev_info.virtual_address_offset,
280 dev->dev_info.virtual_address_alignment, 0);
281 if (start > 0xffffffff) {
282 fprintf(stderr, "%s: amdgpu_vamgr_find_va failed\n", __func__);
283 goto free_va; /* shouldn't get here */
284 }
285
286 amdgpu_vamgr_init(&dev->vamgr_32, start, max, 275 amdgpu_vamgr_init(&dev->vamgr_32, start, max,
287 dev->dev_info.virtual_address_alignment); 276 dev->dev_info.virtual_address_alignment);
288 277
278 start = MAX2(dev->dev_info.virtual_address_offset, 0x100000000ULL);
279 max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL);
280 amdgpu_vamgr_init(&dev->vamgr, start, max,
281 dev->dev_info.virtual_address_alignment);
282
289 r = amdgpu_parse_asic_ids(&dev->asic_ids); 283 r = amdgpu_parse_asic_ids(&dev->asic_ids);
290 if (r) { 284 if (r) {
291 fprintf(stderr, "%s: Cannot parse ASIC IDs, 0x%x.", 285 fprintf(stderr, "%s: Cannot parse ASIC IDs, 0x%x.",
@@ -300,12 +294,6 @@ int amdgpu_device_initialize(int fd,
300 294
301 return 0; 295 return 0;
302 296
303free_va:
304 r = -ENOMEM;
305 amdgpu_vamgr_free_va(&dev->vamgr, start,
306 max - dev->dev_info.virtual_address_offset);
307 amdgpu_vamgr_deinit(&dev->vamgr);
308
309cleanup: 297cleanup:
310 if (dev->fd >= 0) 298 if (dev->fd >= 0)
311 close(dev->fd); 299 close(dev->fd);