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>
This commit is contained in:
Sami Kiminki
2017-11-13 13:52:29 +02:00
committed by mobile promotions
parent 434385ca54
commit 23396c58db
3 changed files with 67 additions and 55 deletions

View File

@@ -27,12 +27,17 @@ struct gk20a_comptags {
u32 lines;
/*
* This signals whether allocation has been attempted. Observe
* 'lines' to see whether comptags were actually allocated. We
* try alloc only once per buffer in order not to break
* multiple compressible-kind mappings.
* This signals whether allocation has been attempted. Observe 'lines'
* to see whether the comptags were actually allocated. We try alloc
* only once per buffer in order not to break multiple compressible-kind
* mappings.
*/
bool allocated;
/*
* Do comptags need to be cleared before mapping?
*/
bool needs_clear;
};
struct gk20a_comptag_allocator {
@@ -63,13 +68,13 @@ void gk20a_comptaglines_free(struct gk20a_comptag_allocator *allocator,
* Defined by OS specific code since comptags are stored in a highly OS specific
* way.
*/
int gk20a_alloc_comptags(struct gk20a *g,
struct nvgpu_os_buffer *buf,
struct gk20a_comptag_allocator *allocator,
u32 lines);
int gk20a_alloc_or_get_comptags(struct gk20a *g,
struct nvgpu_os_buffer *buf,
struct gk20a_comptag_allocator *allocator,
u32 lines,
struct gk20a_comptags *comptags);
void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
struct gk20a_comptags *comptags);
void gk20a_mark_comptags_cleared(struct nvgpu_os_buffer *buf);
#endif