diff options
author | Sami Kiminki <skiminki@nvidia.com> | 2017-11-08 13:55:47 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-15 16:25:58 -0500 |
commit | 434385ca54053b13ac06a5f11cb7564d6740f02d (patch) | |
tree | 04cbfac9575af77c90e11da0fd8488fa221f2581 /drivers/gpu/nvgpu/include | |
parent | 3ff666c4b97c5ad869aefe0d9c335c187962c20e (diff) |
gpu: nvgpu: Clean up comptag data structs and alloc
Clean up the comptag-related data structures and allocation logic. The
most important change is that we only ever try comptag allocation once
to prevent incorrect map aliasing.
If we were to retry the allocation on further map calls, the following
situation would become possible:
(1) Request compressible kind mapping for a buffer. Comptag alloc failed
and we proceed with incompressible kind fallback.
(2) Request another compressible kind mapping for a buffer. Comptag alloc
retry succeeded and now we use the compressible kind.
(3) After writes through the compressible kind mapping, the buffer is no
longer legible via the fallback incompressible kind mapping.
The other changes are about removing the unused comptag-related fields
in gk20a_comptags and nvgpu_mapped_buf, and retrieving comptags info
only for compressible buffers. We also make nvgpu_ctag_buffer_info and
nvgpu_vm_compute_compression as private mm/vm.c definitions, since
they're not used elsewhere.
Bug 1902982
Change-Id: I0c9fe48ccc585a80dd2c05ec606a079c1c1d41f1
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1595153
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/comptags.h | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/vm.h | 17 |
2 files changed, 8 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/comptags.h b/drivers/gpu/nvgpu/include/nvgpu/comptags.h index 5482d0ce..2d9f034a 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/comptags.h +++ b/drivers/gpu/nvgpu/include/nvgpu/comptags.h | |||
@@ -25,8 +25,14 @@ struct nvgpu_os_buffer; | |||
25 | struct gk20a_comptags { | 25 | struct gk20a_comptags { |
26 | u32 offset; | 26 | u32 offset; |
27 | u32 lines; | 27 | u32 lines; |
28 | u32 allocated_lines; | 28 | |
29 | bool user_mappable; | 29 | /* |
30 | * This signals whether allocation has been attempted. Observe | ||
31 | * 'lines' to see whether comptags were actually allocated. We | ||
32 | * try alloc only once per buffer in order not to break | ||
33 | * multiple compressible-kind mappings. | ||
34 | */ | ||
35 | bool allocated; | ||
30 | }; | 36 | }; |
31 | 37 | ||
32 | struct gk20a_comptag_allocator { | 38 | struct gk20a_comptag_allocator { |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h index abb297ab..c0a4124c 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/vm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h | |||
@@ -110,9 +110,6 @@ struct nvgpu_mapped_buf { | |||
110 | u64 size; | 110 | u64 size; |
111 | 111 | ||
112 | u32 pgsz_idx; | 112 | u32 pgsz_idx; |
113 | u32 ctag_offset; | ||
114 | u32 ctag_lines; | ||
115 | u32 ctag_allocated_lines; | ||
116 | 113 | ||
117 | u32 flags; | 114 | u32 flags; |
118 | u32 kind; | 115 | u32 kind; |
@@ -143,17 +140,6 @@ mapped_buffer_from_rbtree_node(struct nvgpu_rbtree_node *node) | |||
143 | ((uintptr_t)node - offsetof(struct nvgpu_mapped_buf, node)); | 140 | ((uintptr_t)node - offsetof(struct nvgpu_mapped_buf, node)); |
144 | } | 141 | } |
145 | 142 | ||
146 | struct nvgpu_ctag_buffer_info { | ||
147 | u64 size; | ||
148 | enum gmmu_pgsz_gk20a pgsz_idx; | ||
149 | u32 flags; | ||
150 | |||
151 | s16 compr_kind; | ||
152 | s16 incompr_kind; | ||
153 | |||
154 | u32 ctag_lines; | ||
155 | }; | ||
156 | |||
157 | struct vm_gk20a { | 143 | struct vm_gk20a { |
158 | struct mm_gk20a *mm; | 144 | struct mm_gk20a *mm; |
159 | struct gk20a_as_share *as_share; /* as_share this represents */ | 145 | struct gk20a_as_share *as_share; /* as_share this represents */ |
@@ -221,9 +207,6 @@ void nvgpu_vm_put(struct vm_gk20a *vm); | |||
221 | int vm_aspace_id(struct vm_gk20a *vm); | 207 | int vm_aspace_id(struct vm_gk20a *vm); |
222 | int nvgpu_big_pages_possible(struct vm_gk20a *vm, u64 base, u64 size); | 208 | int nvgpu_big_pages_possible(struct vm_gk20a *vm, u64 base, u64 size); |
223 | 209 | ||
224 | int nvgpu_vm_compute_compression(struct vm_gk20a *vm, | ||
225 | struct nvgpu_ctag_buffer_info *binfo); | ||
226 | |||
227 | /* batching eliminates redundant cache flushes and invalidates */ | 210 | /* batching eliminates redundant cache flushes and invalidates */ |
228 | void nvgpu_vm_mapping_batch_start(struct vm_gk20a_mapping_batch *batch); | 211 | void nvgpu_vm_mapping_batch_start(struct vm_gk20a_mapping_batch *batch); |
229 | void nvgpu_vm_mapping_batch_finish( | 212 | void nvgpu_vm_mapping_batch_finish( |