diff options
author | Sami Kiminki <skiminki@nvidia.com> | 2017-11-13 06:52:29 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-15 16:26:02 -0500 |
commit | 23396c58db7e9d9c974bb3334a159aad960afc3e (patch) | |
tree | 21600214cdd1737075b73354b40fca7fbe97f93e /drivers/gpu/nvgpu/include | |
parent | 434385ca54053b13ac06a5f11cb7564d6740f02d (diff) |
gpu: nvgpu: Simplify compbits alloc and add needs_clear
Simplify compbits alloc by making the alloc function re-callable for
the buffer, and making it return the comptags info. This simplifies
the calling code: alloc_or_get vs. get + alloc + get again.
Add tracking whether the allocated compbits need clearing before they
can be used in PTEs. We do this, since clearing is part of the gmmu
map call on vgpu, which can fail.
Bug 1902982
Change-Id: Ic4ab8d326910443b128e82491d302a1f49120f5b
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1597130
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 | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/comptags.h b/drivers/gpu/nvgpu/include/nvgpu/comptags.h index 2d9f034a..41a918b5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/comptags.h +++ b/drivers/gpu/nvgpu/include/nvgpu/comptags.h | |||
@@ -27,12 +27,17 @@ struct gk20a_comptags { | |||
27 | u32 lines; | 27 | u32 lines; |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * This signals whether allocation has been attempted. Observe | 30 | * This signals whether allocation has been attempted. Observe 'lines' |
31 | * 'lines' to see whether comptags were actually allocated. We | 31 | * to see whether the comptags were actually allocated. We try alloc |
32 | * try alloc only once per buffer in order not to break | 32 | * only once per buffer in order not to break multiple compressible-kind |
33 | * multiple compressible-kind mappings. | 33 | * mappings. |
34 | */ | 34 | */ |
35 | bool allocated; | 35 | bool allocated; |
36 | |||
37 | /* | ||
38 | * Do comptags need to be cleared before mapping? | ||
39 | */ | ||
40 | bool needs_clear; | ||
36 | }; | 41 | }; |
37 | 42 | ||
38 | struct gk20a_comptag_allocator { | 43 | struct gk20a_comptag_allocator { |
@@ -63,13 +68,13 @@ void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator, | |||
63 | * Defined by OS specific code since comptags are stored in a highly OS specific | 68 | * Defined by OS specific code since comptags are stored in a highly OS specific |
64 | * way. | 69 | * way. |
65 | */ | 70 | */ |
66 | int gk20a_alloc_comptags(struct gk20a *g, | 71 | int gk20a_alloc_or_get_comptags(struct gk20a *g, |
67 | struct nvgpu_os_buffer *buf, | 72 | struct nvgpu_os_buffer *buf, |
68 | struct gk20a_comptag_allocator *allocator, | 73 | struct gk20a_comptag_allocator *allocator, |
69 | u32 lines); | 74 | u32 lines, |
75 | struct gk20a_comptags *comptags); | ||
70 | void gk20a_get_comptags(struct nvgpu_os_buffer *buf, | 76 | void gk20a_get_comptags(struct nvgpu_os_buffer *buf, |
71 | struct gk20a_comptags *comptags); | 77 | struct gk20a_comptags *comptags); |
72 | 78 | void gk20a_mark_comptags_cleared(struct nvgpu_os_buffer *buf); | |
73 | |||
74 | 79 | ||
75 | #endif | 80 | #endif |