From 2119213467a9e70a7e6cbf78d9b8954b27898716 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 30 Mar 2017 10:17:01 +0300 Subject: gpu: nvgpu: use NO_KERNEL_MAPPING for default vidmem Commit 8f3875393e7a6bd0fc03afdb1fa99b7e33b71576 ("abstract away dma alloc attrs") added an implicit NVGPU_DMA_NO_KERNEL_MAPPING for the explicit vidmem buffer allocation path. The default allocation api that chooses vidmem or sysmem based on available support still passed a zero flag and produced a warning when the flag should have been there. Force the NO_KERNEL_MAPPING flag on currently via the default-allocator api. Commit 8a15e02ca92b83aa5a216ea9cd42680373212ecd ("gpu: nvgpu: add NO_KERNEL_MAPPING for alloc_map_vid") did the same for flagless alloc-and-map calls but this default alloc-only call got overlooked. Also, store the flags in the mem_desc during allocation, just like in the sysmem allocator, to be checked during freeing. Bug 1896734 Bug 1853519 Change-Id: I4b4182b4fd52298bdd2a77197c095a23d2a67c4a Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1331252 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 709f2fd2..9a2dbeb9 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2735,7 +2735,15 @@ int gk20a_gmmu_alloc_flags(struct gk20a *g, unsigned long flags, size_t size, struct mem_desc *mem) { if (g->mm.vidmem_is_vidmem) { - int err = gk20a_gmmu_alloc_flags_vid(g, flags, size, mem); + /* + * Force the no-kernel-mapping flag on because we don't support + * the lack of it for vidmem - the user should not care when + * using gk20a_gmmu_alloc_map and it's vidmem, or if there's a + * difference, the user should use the flag explicitly anyway. + */ + int err = gk20a_gmmu_alloc_flags_vid(g, + flags | NVGPU_DMA_NO_KERNEL_MAPPING, + size, mem); if (!err) return 0; @@ -3012,6 +3020,7 @@ int gk20a_gmmu_alloc_flags_vid_at(struct gk20a *g, unsigned long flags, mem->size = size; mem->aperture = APERTURE_VIDMEM; mem->allocator = vidmem_alloc; + mem->flags = flags; nvgpu_init_list_node(&mem->clear_list_entry); -- cgit v1.2.2