summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/linux/dma.c6
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h17
3 files changed, 18 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c
index b943aabf..abcf36f1 100644
--- a/drivers/gpu/nvgpu/common/linux/dma.c
+++ b/drivers/gpu/nvgpu/common/linux/dma.c
@@ -204,9 +204,7 @@ int nvgpu_dma_alloc_flags_vid_at(struct gk20a *g, unsigned long flags,
204 } 204 }
205 205
206 if (at) 206 if (at)
207 mem->fixed = true; 207 mem->mem_flags |= NVGPU_MEM_FLAG_FIXED;
208 else
209 mem->fixed = false;
210 208
211 mem->priv.sgt = nvgpu_kzalloc(g, sizeof(struct sg_table)); 209 mem->priv.sgt = nvgpu_kzalloc(g, sizeof(struct sg_table));
212 if (!mem->priv.sgt) { 210 if (!mem->priv.sgt) {
@@ -375,7 +373,7 @@ static void nvgpu_dma_free_vid(struct gk20a *g, struct nvgpu_mem *mem)
375 /* Sanity check - only this supported when allocating. */ 373 /* Sanity check - only this supported when allocating. */
376 WARN_ON(mem->priv.flags != NVGPU_DMA_NO_KERNEL_MAPPING); 374 WARN_ON(mem->priv.flags != NVGPU_DMA_NO_KERNEL_MAPPING);
377 375
378 if (mem->user_mem) { 376 if (mem->mem_flags & NVGPU_MEM_FLAG_USER_MEM) {
379 nvgpu_mutex_acquire(&g->mm.vidmem.clear_list_mutex); 377 nvgpu_mutex_acquire(&g->mm.vidmem.clear_list_mutex);
380 was_empty = nvgpu_list_empty(&g->mm.vidmem.clear_list_head); 378 was_empty = nvgpu_list_empty(&g->mm.vidmem.clear_list_head);
381 nvgpu_list_add_tail(&mem->clear_list_entry, 379 nvgpu_list_add_tail(&mem->clear_list_entry,
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 79aa44a5..00892e98 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -1862,7 +1862,7 @@ int gk20a_vidmem_buf_alloc(struct gk20a *g, size_t bytes)
1862 if (!buf->mem) 1862 if (!buf->mem)
1863 goto err_kfree; 1863 goto err_kfree;
1864 1864
1865 buf->mem->user_mem = true; 1865 buf->mem->mem_flags |= NVGPU_MEM_FLAG_USER_MEM;
1866 1866
1867 err = nvgpu_dma_alloc_vid(g, bytes, buf->mem); 1867 err = nvgpu_dma_alloc_vid(g, bytes, buf->mem);
1868 if (err) 1868 if (err)
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index 397e9ab1..b01fbec5 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -53,6 +53,21 @@ struct nvgpu_mem {
53 * the struct is just a copy of another nvgpu_mem struct. 53 * the struct is just a copy of another nvgpu_mem struct.
54 */ 54 */
55#define NVGPU_MEM_FLAG_SHADOW_COPY (1 << 0) 55#define NVGPU_MEM_FLAG_SHADOW_COPY (1 << 0)
56
57 /*
58 * Specify that the GVA mapping is a fixed mapping - that is the caller
59 * chose the GPU VA, not the GMMU mapping function. Only relevant for
60 * VIDMEM.
61 */
62#define NVGPU_MEM_FLAG_FIXED (1 << 1)
63
64 /*
65 * Set for user generated VIDMEM allocations. This triggers a special
66 * cleanup path that clears the vidmem on free. Given that the VIDMEM is
67 * zeroed on boot this means that all user vidmem allocations are
68 * therefor zeroed (to prevent leaking information in VIDMEM buffers).
69 */
70#define NVGPU_MEM_FLAG_USER_MEM (1 << 2)
56 unsigned long mem_flags; 71 unsigned long mem_flags;
57 72
58 /* 73 /*
@@ -63,8 +78,6 @@ struct nvgpu_mem {
63 /* 78 /*
64 * Fields only populated for vidmem allocations. 79 * Fields only populated for vidmem allocations.
65 */ 80 */
66 bool fixed;
67 bool user_mem;
68 struct nvgpu_allocator *allocator; 81 struct nvgpu_allocator *allocator;
69 struct nvgpu_list_node clear_list_entry; 82 struct nvgpu_list_node clear_list_entry;
70 83