From 88ee812d56333375f7ae44e28b483c1a161d75da Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 17 Oct 2017 17:12:28 -0700 Subject: gpu: nvgpu: Remove buffer_attrs struct Remove the buffer_attrs struct and replace it with a more streamlined nvgpu_ctag_buffer_info struct. This struct allows several different fields to all be passed by pointer to the various kind/compression functions in the VM map process. This path also moves several comptag/kind related functions to the core vm.c code since these functions can be reused by other OSes. Change-Id: I2a0f0a1c4b554ce4c8f2acdbe3161392e717d3bf Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1583984 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: svc-mobile-coverity Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/linux/vm.h | 19 ------------------- drivers/gpu/nvgpu/include/nvgpu/vm.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h index 3794706c..596a3b62 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/vm.h @@ -38,21 +38,6 @@ struct vm_gk20a; struct vm_gk20a_mapping_batch; struct nvgpu_vm_area; -struct buffer_attrs { - struct sg_table *sgt; - u64 size; - u64 align; - u32 ctag_offset; - u32 ctag_lines; - u32 ctag_allocated_lines; - int pgsz_idx; - u8 kind_v; - bool use_kind_v; - u8 uc_kind_v; - bool use_uc_kind_v; - bool ctag_user_mappable; -}; - u64 nvgpu_vm_map_linux(struct vm_gk20a *vm, struct dma_buf *dmabuf, u64 offset_align, @@ -104,9 +89,5 @@ int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g, struct dma_buf *dmabuf); -int validate_fixed_buffer(struct vm_gk20a *vm, - struct buffer_attrs *bfr, - u64 map_offset, u64 map_size, - struct nvgpu_vm_area **pva_node); #endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h index 7370a8e3..801fb8ed 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h @@ -122,6 +122,19 @@ mapped_buffer_from_rbtree_node(struct nvgpu_rbtree_node *node) ((uintptr_t)node - offsetof(struct nvgpu_mapped_buf, node)); } +struct nvgpu_ctag_buffer_info { + u64 size; + enum gmmu_pgsz_gk20a pgsz_idx; + u32 flags; + + u8 kind_v; + u8 uc_kind_v; + bool use_kind_v; + bool use_uc_kind_v; + + u32 ctag_lines; +}; + struct vm_gk20a { struct mm_gk20a *mm; struct gk20a_as_share *as_share; /* as_share this represents */ @@ -189,6 +202,11 @@ 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); +int nvgpu_vm_init_kind_info(struct nvgpu_ctag_buffer_info *binfo, + s16 compr_kind, s16 incompr_kind); +int nvgpu_vm_compute_kind_and_compression(struct vm_gk20a *vm, + struct nvgpu_ctag_buffer_info *binfo); + /* batching eliminates redundant cache flushes and invalidates */ void nvgpu_vm_mapping_batch_start(struct vm_gk20a_mapping_batch *batch); void nvgpu_vm_mapping_batch_finish( -- cgit v1.2.2