aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-08-03 11:24:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-16 13:59:11 -0400
commitc9533d1bca3393fbdfe5b24ccb4cfe6a1a02d794 (patch)
tree515b7b7197b24e8d1216c255a27cab227089d05b /drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
parentdddc0557e3a02499ce336b1e2e67f5afaecccc80 (diff)
drm/amdgpu: Use kvmalloc for allocating UVD/VCE/VCN BO backup memory
The allocated size can be (at least?) as large as megabytes, and there's no need for it to be physically contiguous. May avoid spurious failures to initialize / suspend the corresponding block while there's memory pressure. Bugzilla: https://bugs.freedesktop.org/107432 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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 433a741d0762..e5a6db6beab7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -302,7 +302,7 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev)
302 for (j = 0; j < adev->uvd.num_uvd_inst; ++j) { 302 for (j = 0; j < adev->uvd.num_uvd_inst; ++j) {
303 if (adev->uvd.harvest_config & (1 << j)) 303 if (adev->uvd.harvest_config & (1 << j))
304 continue; 304 continue;
305 kfree(adev->uvd.inst[j].saved_bo); 305 kvfree(adev->uvd.inst[j].saved_bo);
306 306
307 amdgpu_bo_free_kernel(&adev->uvd.inst[j].vcpu_bo, 307 amdgpu_bo_free_kernel(&adev->uvd.inst[j].vcpu_bo,
308 &adev->uvd.inst[j].gpu_addr, 308 &adev->uvd.inst[j].gpu_addr,
@@ -368,7 +368,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
368 size = amdgpu_bo_size(adev->uvd.inst[j].vcpu_bo); 368 size = amdgpu_bo_size(adev->uvd.inst[j].vcpu_bo);
369 ptr = adev->uvd.inst[j].cpu_addr; 369 ptr = adev->uvd.inst[j].cpu_addr;
370 370
371 adev->uvd.inst[j].saved_bo = kmalloc(size, GFP_KERNEL); 371 adev->uvd.inst[j].saved_bo = kvmalloc(size, GFP_KERNEL);
372 if (!adev->uvd.inst[j].saved_bo) 372 if (!adev->uvd.inst[j].saved_bo)
373 return -ENOMEM; 373 return -ENOMEM;
374 374
@@ -394,7 +394,7 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
394 394
395 if (adev->uvd.inst[i].saved_bo != NULL) { 395 if (adev->uvd.inst[i].saved_bo != NULL) {
396 memcpy_toio(ptr, adev->uvd.inst[i].saved_bo, size); 396 memcpy_toio(ptr, adev->uvd.inst[i].saved_bo, size);
397 kfree(adev->uvd.inst[i].saved_bo); 397 kvfree(adev->uvd.inst[i].saved_bo);
398 adev->uvd.inst[i].saved_bo = NULL; 398 adev->uvd.inst[i].saved_bo = NULL;
399 } else { 399 } else {
400 const struct common_firmware_header *hdr; 400 const struct common_firmware_header *hdr;