diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-01-19 03:59:46 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-01-19 12:25:09 -0500 |
commit | 9571e1d84042f5670df9fabdcbe7dd5da3abe43e (patch) | |
tree | 676f409d110053ea71a0848088a2c6c69f912270 /drivers/gpu/drm/amd/amdgpu | |
parent | 7776a69386179ea477f501aa222692b9856ec56c (diff) |
drm/amdgpu: Use drm_calloc_large for VM page_tables array
It can be big, depending on the VM address space size, which is tunable
via the vm_size module parameter.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93721
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index aefc668e6b5d..9599f7559b3d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1282,7 +1282,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1282 | { | 1282 | { |
1283 | const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE, | 1283 | const unsigned align = min(AMDGPU_VM_PTB_ALIGN_SIZE, |
1284 | AMDGPU_VM_PTE_COUNT * 8); | 1284 | AMDGPU_VM_PTE_COUNT * 8); |
1285 | unsigned pd_size, pd_entries, pts_size; | 1285 | unsigned pd_size, pd_entries; |
1286 | int i, r; | 1286 | int i, r; |
1287 | 1287 | ||
1288 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 1288 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { |
@@ -1300,8 +1300,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1300 | pd_entries = amdgpu_vm_num_pdes(adev); | 1300 | pd_entries = amdgpu_vm_num_pdes(adev); |
1301 | 1301 | ||
1302 | /* allocate page table array */ | 1302 | /* allocate page table array */ |
1303 | pts_size = pd_entries * sizeof(struct amdgpu_vm_pt); | 1303 | vm->page_tables = drm_calloc_large(pd_entries, sizeof(struct amdgpu_vm_pt)); |
1304 | vm->page_tables = kzalloc(pts_size, GFP_KERNEL); | ||
1305 | if (vm->page_tables == NULL) { | 1304 | if (vm->page_tables == NULL) { |
1306 | DRM_ERROR("Cannot allocate memory for page table array\n"); | 1305 | DRM_ERROR("Cannot allocate memory for page table array\n"); |
1307 | return -ENOMEM; | 1306 | return -ENOMEM; |
@@ -1361,7 +1360,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1361 | 1360 | ||
1362 | for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) | 1361 | for (i = 0; i < amdgpu_vm_num_pdes(adev); i++) |
1363 | amdgpu_bo_unref(&vm->page_tables[i].entry.robj); | 1362 | amdgpu_bo_unref(&vm->page_tables[i].entry.robj); |
1364 | kfree(vm->page_tables); | 1363 | drm_free_large(vm->page_tables); |
1365 | 1364 | ||
1366 | amdgpu_bo_unref(&vm->page_directory); | 1365 | amdgpu_bo_unref(&vm->page_directory); |
1367 | fence_put(vm->page_directory_fence); | 1366 | fence_put(vm->page_directory_fence); |