summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-08-29 15:59:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-12 18:54:46 -0400
commit72f40c211eca854f713530e68f789d4a7c3bb9fa (patch)
tree5378f6b8103c1ea902077ecfa2a56f6a353589fd /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parentb79c165fd74f8269000f33691d8a480359e71585 (diff)
gpu: nvgpu: page align DMA allocs
Explicitly page align DMA memory allocations. Non-page aligned DMA allocs can lead to nvgpu_mem structs that have a size that's not page aligned. Those allocs, in some cases, can cause vGPU maps to return an error. More generally DMA allocs in Linux are never going to not be page aligned both in size and address. So might as well page align the alloc size to make code else where in the driver more simple. To imlpement this an aligned_size field has been added to struct nvgpu_mem. This field has the real page aligned size of the allocation. The original size is still saved in size. Change-Id: Ie08cfc4f39d5f97db84a54b8e314ad1fa53b72be Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1547902 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 2d69a2aa..a6507d2d 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -1207,7 +1207,7 @@ static void gk20a_vidmem_clear_mem_worker(struct work_struct *work)
1207 (u64)get_vidmem_page_alloc(mem->priv.sgt->sgl)); 1207 (u64)get_vidmem_page_alloc(mem->priv.sgt->sgl));
1208 nvgpu_free_sgtable(g, &mem->priv.sgt); 1208 nvgpu_free_sgtable(g, &mem->priv.sgt);
1209 1209
1210 WARN_ON(nvgpu_atomic64_sub_return(mem->size, 1210 WARN_ON(nvgpu_atomic64_sub_return(mem->aligned_size,
1211 &g->mm.vidmem.bytes_pending) < 0); 1211 &g->mm.vidmem.bytes_pending) < 0);
1212 mem->size = 0; 1212 mem->size = 0;
1213 mem->aperture = APERTURE_INVALID; 1213 mem->aperture = APERTURE_INVALID;