From 5d09c908b0679f060bc89ae70eef681a6783ebbc Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Tue, 22 Aug 2017 16:14:56 +0300 Subject: gpu: nvgpu: Direct GMMU PTE kind control Allow userspace to control directly the PTE kind for the mappings by supplying NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL for MAP_BUFFER_EX. In particular, in this mode, the userspace will tell the kernel whether the kind is compressible, and if so, what is the incompressible fallback kind. By supplying only the compressible kind, the userspace can require that the map kind will not be demoted to the incompressible fallback kind in case of comptag allocation failure. Add also a GPU characteristics flag NVGPU_GPU_FLAGS_SUPPORT_MAP_DIRECT_KIND_CTRL to signal whether direct kind control is supported. Fix indentation of nvgpu_as_map_buffer_ex_args header comment. Bug 1705731 Change-Id: I317ab474ae53b78eb8fdd31bd6bca0541fcba9a4 Signed-off-by: Sami Kiminki Reviewed-on: https://git-master.nvidia.com/r/1543462 Reviewed-by: svc-mobile-coverity Reviewed-by: Konsta Holtta Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: svccoveritychecker Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/linux/vm_priv.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/vm_priv.h') diff --git a/drivers/gpu/nvgpu/common/linux/vm_priv.h b/drivers/gpu/nvgpu/common/linux/vm_priv.h index 4f6b10bb..1eadf1d0 100644 --- a/drivers/gpu/nvgpu/common/linux/vm_priv.h +++ b/drivers/gpu/nvgpu/common/linux/vm_priv.h @@ -34,7 +34,9 @@ struct buffer_attrs { 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; }; @@ -42,19 +44,43 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm, struct dma_buf *dmabuf, u64 offset_align, u32 flags, - int kind, + + /* + * compressible kind if + * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is + * specified, otherwise just the kind + */ + s16 compr_kind, + + /* + * incompressible kind if + * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is + * specified, otherwise ignored + */ + s16 incompr_kind, + bool user_mapped, int rw_flag, u64 buffer_offset, u64 mapping_size, struct vm_gk20a_mapping_batch *mapping_batch); -/* Note: batch may be NULL if map op is not part of a batch */ +/* + * Notes: + * - Batch may be NULL if map op is not part of a batch. + * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is set, + * compr_kind and incompr_kind work as explained in nvgpu.h. + * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is NOT set, + * compr_kind holds the kind and kernel will figure out whether + * it is a compressible or incompressible kind. If compressible, kernel will + * also figure out the incompressible counterpart or return an error. + */ int nvgpu_vm_map_buffer(struct vm_gk20a *vm, int dmabuf_fd, u64 *offset_align, u32 flags, /* NVGPU_AS_MAP_BUFFER_FLAGS_ */ - int kind, + s16 compr_kind, + s16 incompr_kind, u64 buffer_offset, u64 mapping_size, struct vm_gk20a_mapping_batch *batch); -- cgit v1.2.2