summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vm_priv.h
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2017-08-22 09:14:56 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-15 18:45:45 -0400
commit5d09c908b0679f060bc89ae70eef681a6783ebbc (patch)
tree244177eb4425e765b9a043e66533ca624f0d3cbd /drivers/gpu/nvgpu/common/linux/vm_priv.h
parent2b7e8a2c2a5df041c9a434804d0f3f6d9df82737 (diff)
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 <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1543462 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vm_priv.h')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vm_priv.h32
1 files changed, 29 insertions, 3 deletions
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 {
34 u32 ctag_allocated_lines; 34 u32 ctag_allocated_lines;
35 int pgsz_idx; 35 int pgsz_idx;
36 u8 kind_v; 36 u8 kind_v;
37 bool use_kind_v;
37 u8 uc_kind_v; 38 u8 uc_kind_v;
39 bool use_uc_kind_v;
38 bool ctag_user_mappable; 40 bool ctag_user_mappable;
39}; 41};
40 42
@@ -42,19 +44,43 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm,
42 struct dma_buf *dmabuf, 44 struct dma_buf *dmabuf,
43 u64 offset_align, 45 u64 offset_align,
44 u32 flags, 46 u32 flags,
45 int kind, 47
48 /*
49 * compressible kind if
50 * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is
51 * specified, otherwise just the kind
52 */
53 s16 compr_kind,
54
55 /*
56 * incompressible kind if
57 * NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is
58 * specified, otherwise ignored
59 */
60 s16 incompr_kind,
61
46 bool user_mapped, 62 bool user_mapped,
47 int rw_flag, 63 int rw_flag,
48 u64 buffer_offset, 64 u64 buffer_offset,
49 u64 mapping_size, 65 u64 mapping_size,
50 struct vm_gk20a_mapping_batch *mapping_batch); 66 struct vm_gk20a_mapping_batch *mapping_batch);
51 67
52/* Note: batch may be NULL if map op is not part of a batch */ 68/*
69 * Notes:
70 * - Batch may be NULL if map op is not part of a batch.
71 * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is set,
72 * compr_kind and incompr_kind work as explained in nvgpu.h.
73 * - If NVGPU_AS_MAP_BUFFER_FLAGS_DIRECT_KIND_CTRL is NOT set,
74 * compr_kind holds the kind and kernel will figure out whether
75 * it is a compressible or incompressible kind. If compressible, kernel will
76 * also figure out the incompressible counterpart or return an error.
77 */
53int nvgpu_vm_map_buffer(struct vm_gk20a *vm, 78int nvgpu_vm_map_buffer(struct vm_gk20a *vm,
54 int dmabuf_fd, 79 int dmabuf_fd,
55 u64 *offset_align, 80 u64 *offset_align,
56 u32 flags, /* NVGPU_AS_MAP_BUFFER_FLAGS_ */ 81 u32 flags, /* NVGPU_AS_MAP_BUFFER_FLAGS_ */
57 int kind, 82 s16 compr_kind,
83 s16 incompr_kind,
58 u64 buffer_offset, 84 u64 buffer_offset,
59 u64 mapping_size, 85 u64 mapping_size,
60 struct vm_gk20a_mapping_batch *batch); 86 struct vm_gk20a_mapping_batch *batch);