gpu: nvgpu: use NO_KERNEL_MAPPING for default vidmem

Commit 8f3875393e ("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 8a15e02ca9 ("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 <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1331252
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Holtta
2017-03-30 10:17:01 +03:00
committed by mobile promotions
parent 7aa2f44e8b
commit 2119213467

View File

@@ -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);