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>
main
Christian König 2017-11-02 18:54:59 +01:00
parent 4b4ccaac2e
commit a844925c8a
3 changed files with 8 additions and 27 deletions

View File

@ -270,20 +270,14 @@ int amdgpu_device_initialize(int fd,
goto cleanup; goto cleanup;
} }
amdgpu_vamgr_init(&dev->vamgr, dev->dev_info.virtual_address_offset, start = dev->dev_info.virtual_address_offset;
dev->dev_info.virtual_address_max, max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff);
amdgpu_vamgr_init(&dev->vamgr_32, start, max,
dev->dev_info.virtual_address_alignment); dev->dev_info.virtual_address_alignment);
max = MIN2(dev->dev_info.virtual_address_max, 0xffffffff); start = MAX2(dev->dev_info.virtual_address_offset, 0x100000000ULL);
start = amdgpu_vamgr_find_va(&dev->vamgr, max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL);
max - dev->dev_info.virtual_address_offset, amdgpu_vamgr_init(&dev->vamgr, start, max,
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); dev->dev_info.virtual_address_alignment);
r = amdgpu_parse_asic_ids(&dev->asic_ids); r = amdgpu_parse_asic_ids(&dev->asic_ids);
@ -300,12 +294,6 @@ int amdgpu_device_initialize(int fd,
return 0; 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: cleanup:
if (dev->fd >= 0) if (dev->fd >= 0)
close(dev->fd); close(dev->fd);

View File

@ -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 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_parse_asic_ids(struct amdgpu_asic_id **asic_ids);
drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev); drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev);

View File

@ -66,7 +66,7 @@ drm_private void amdgpu_vamgr_deinit(struct amdgpu_bo_va_mgr *mgr)
pthread_mutex_destroy(&mgr->bo_va_mutex); 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, amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size,
uint64_t alignment, uint64_t base_required) 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; 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) amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, uint64_t size)
{ {
struct amdgpu_bo_va_hole *hole; struct amdgpu_bo_va_hole *hole;