gpu: nvgpu: Remove bools from nvgpu_mem

Replace a couple of boolean fields in nvgpu_mem with bits in a
bitmap introduced in an earlier patch.

JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: Iffc31bd629cab9a37e5a4fd13377eb9090353410
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1464079
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
This commit is contained in:
Alex Waterman
2017-04-10 14:03:16 -07:00
committed by mobile promotions
parent 126c735d30
commit 5714f5eaaf
3 changed files with 18 additions and 7 deletions

View File

@@ -204,9 +204,7 @@ int nvgpu_dma_alloc_flags_vid_at(struct gk20a *g, unsigned long flags,
}
if (at)
mem->fixed = true;
else
mem->fixed = false;
mem->mem_flags |= NVGPU_MEM_FLAG_FIXED;
mem->priv.sgt = nvgpu_kzalloc(g, sizeof(struct sg_table));
if (!mem->priv.sgt) {
@@ -375,7 +373,7 @@ static void nvgpu_dma_free_vid(struct gk20a *g, struct nvgpu_mem *mem)
/* Sanity check - only this supported when allocating. */
WARN_ON(mem->priv.flags != NVGPU_DMA_NO_KERNEL_MAPPING);
if (mem->user_mem) {
if (mem->mem_flags & NVGPU_MEM_FLAG_USER_MEM) {
nvgpu_mutex_acquire(&g->mm.vidmem.clear_list_mutex);
was_empty = nvgpu_list_empty(&g->mm.vidmem.clear_list_head);
nvgpu_list_add_tail(&mem->clear_list_entry,

View File

@@ -1862,7 +1862,7 @@ int gk20a_vidmem_buf_alloc(struct gk20a *g, size_t bytes)
if (!buf->mem)
goto err_kfree;
buf->mem->user_mem = true;
buf->mem->mem_flags |= NVGPU_MEM_FLAG_USER_MEM;
err = nvgpu_dma_alloc_vid(g, bytes, buf->mem);
if (err)

View File

@@ -53,6 +53,21 @@ struct nvgpu_mem {
* the struct is just a copy of another nvgpu_mem struct.
*/
#define NVGPU_MEM_FLAG_SHADOW_COPY (1 << 0)
/*
* Specify that the GVA mapping is a fixed mapping - that is the caller
* chose the GPU VA, not the GMMU mapping function. Only relevant for
* VIDMEM.
*/
#define NVGPU_MEM_FLAG_FIXED (1 << 1)
/*
* Set for user generated VIDMEM allocations. This triggers a special
* cleanup path that clears the vidmem on free. Given that the VIDMEM is
* zeroed on boot this means that all user vidmem allocations are
* therefor zeroed (to prevent leaking information in VIDMEM buffers).
*/
#define NVGPU_MEM_FLAG_USER_MEM (1 << 2)
unsigned long mem_flags;
/*
@@ -63,8 +78,6 @@ struct nvgpu_mem {
/*
* Fields only populated for vidmem allocations.
*/
bool fixed;
bool user_mem;
struct nvgpu_allocator *allocator;
struct nvgpu_list_node clear_list_entry;