From: Christian König Date: Thu, 2 Nov 2017 17:54:59 +0000 (+0100) Subject: amdgpu: sanitize 64bit VA manager X-Git-Tag: libdrm-2.4.89~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a844925c8af45161145ab512efb8d5584c9d97f2;p=platform%2Fupstream%2Flibdrm.git 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 --- diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c index 2b31c45..344e87e 100644 --- a/amdgpu/amdgpu_device.c +++ b/amdgpu/amdgpu_device.c @@ -270,22 +270,16 @@ int amdgpu_device_initialize(int fd, goto cleanup; } - amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset, - dev->dev_info.virtual_address_max, - dev->dev_info.virtual_address_alignment); - + start = dev->dev_info.virtual_address_offset; max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); - start = amdgpu_vamgr_find_va(&dev->vamgr, - max - dev->dev_info.virtual_address_offset, - dev->dev_info.virtual_address_alignment, 0); - if (start > 0xffffffff) { - fprintf(stderr, "%s: amdgpu_vamgr_find_va failed\n", __func__); - goto free_va; /* shouldn't get here */ - } - amdgpu_vamgr_init(&dev->vamgr_32, start, max, dev->dev_info.virtual_address_alignment); + start = MAX2(dev->dev_info.virtual_address_offset, 0x100000000ULL); + max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL); + amdgpu_vamgr_init(&dev->vamgr, start, max, + dev->dev_info.virtual_address_alignment); + r = amdgpu_parse_asic_ids(&dev->asic_ids); if (r) { fprintf(stderr, "%s: Cannot parse ASIC IDs, 0x%x.", @@ -300,12 +294,6 @@ int amdgpu_device_initialize(int fd, return 0; -free_va: - r = -ENOMEM; - amdgpu_vamgr_free_va(&dev->vamgr, start, - max - dev->dev_info.virtual_address_offset); - amdgpu_vamgr_deinit(&dev->vamgr); - cleanup: if (dev->fd >= 0) close(dev->fd); diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h index 56d1511..e26e519 100644 --- a/amdgpu/amdgpu_internal.h +++ b/amdgpu/amdgpu_internal.h @@ -148,13 +148,6 @@ drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr); -drm_private uint64_t -amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, - uint64_t alignment, uint64_t base_required); - -drm_private void -amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size); - drm_private int amdgpu_parse_asic_ids(struct amdgpu_asic_id **asic_ids); drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev); diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c index 8516b59..ab425ef 100644 --- a/amdgpu/amdgpu_vamgr.c +++ b/amdgpu/amdgpu_vamgr.c @@ -66,7 +66,7 @@ drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr) pthread_mutex_destroy(&mgr->bo_va_mutex); } -drm_private uint64_t +static drm_private uint64_t amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, uint64_t alignment, uint64_t base_required) { @@ -155,7 +155,7 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, return offset; } -drm_private void +static drm_private void amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size) { struct amdgpu_bo_va_hole *hole;