From fbafc7eba41ba7654dfdadf51a53acf1638e9fa1 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 1 May 2017 16:12:16 -0700 Subject: gpu: nvgpu: Refactor VM init/cleanup Refactor the API for initializing and cleaning up VMs. This also involved moving a bunch of GMMU code out into the gmmu code since part of initializing a VM involves initializing the page tables for the VM. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: I4710f08c26a6e39806f0762a35f6db5c94b64c50 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1477746 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/include/nvgpu/gmmu.h | 6 ++++++ drivers/gpu/nvgpu/include/nvgpu/vm.h | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h index 6d8aa025..45c5def4 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h @@ -63,6 +63,12 @@ struct gk20a_mmu_level { size_t entry_size; }; +int nvgpu_zalloc_gmmu_page_table(struct vm_gk20a *vm, + enum gmmu_pgsz_gk20a pgsz_idx, + const struct gk20a_mmu_level *l, + struct gk20a_mm_entry *entry, + struct gk20a_mm_entry *prev_entry); + /** * nvgpu_gmmu_map - Map memory into the GMMU. * diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h index fb55483d..c89282bf 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h @@ -181,6 +181,7 @@ void nvgpu_vm_get(struct vm_gk20a *vm); void nvgpu_vm_put(struct vm_gk20a *vm); int vm_aspace_id(struct vm_gk20a *vm); +int nvgpu_big_pages_possible(struct vm_gk20a *vm, u64 base, u64 size); /* batching eliminates redundant cache flushes and invalidates */ void nvgpu_vm_mapping_batch_start(struct vm_gk20a_mapping_batch *batch); @@ -194,7 +195,6 @@ void nvgpu_vm_mapping_batch_finish_locked( int nvgpu_vm_get_buffers(struct vm_gk20a *vm, struct nvgpu_mapped_buf ***mapped_buffers, int *num_buffers); - /* put references on the given buffers */ void nvgpu_vm_put_buffers(struct vm_gk20a *vm, struct nvgpu_mapped_buf **mapped_buffers, @@ -220,7 +220,6 @@ struct nvgpu_mapped_buf *__nvgpu_vm_find_mapped_buf_less_than( int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, struct dma_buf **dmabuf, u64 *offset); - int nvgpu_insert_mapped_buf(struct vm_gk20a *vm, struct nvgpu_mapped_buf *mapped_buffer); void nvgpu_remove_mapped_buf(struct vm_gk20a *vm, @@ -228,8 +227,7 @@ void nvgpu_remove_mapped_buf(struct vm_gk20a *vm, void nvgpu_vm_remove_support_nofree(struct vm_gk20a *vm); void nvgpu_vm_remove_support(struct vm_gk20a *vm); - -void nvgpu_remove_vm(struct vm_gk20a *vm, struct nvgpu_mem *inst_block); +void nvgpu_vm_remove(struct vm_gk20a *vm, struct nvgpu_mem *inst_block); int nvgpu_init_vm(struct mm_gk20a *mm, struct vm_gk20a *vm, -- cgit v1.2.2