summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2017-11-14 08:56:09 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-15 16:26:19 -0500
commit69e032653df5aae335764f6346703a1e55c96a2d (patch)
tree4554eb5596bed720865e70a448674c7b1da4e1b9 /drivers/gpu/nvgpu/include
parent44f8b11f47bc31aafd0e3d2486125e1d87725fd4 (diff)
gpu: nvgpu: Add synchronization to comptag alloc and clearing
Comptags allocation and clearing was not synchronized for a buffer. Fix this race by serializing the operations with the gk20a_dmabuf_priv lock. While doing that, add an error check in the cbc_ctrl call. Bug 1902982 Change-Id: Icd96f1855eb5e5340651bcc85849b5ccc199b821 Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1597904 Reviewed-by: Alex Waterman <alexw@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.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/comptags.h b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
index 99e2d657..679a0f9e 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/comptags.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/comptags.h
@@ -74,6 +74,24 @@ int gk20a_alloc_or_get_comptags(struct gk20a *g,
74 struct gk20a_comptags *comptags); 74 struct gk20a_comptags *comptags);
75void gk20a_get_comptags(struct nvgpu_os_buffer *buf, 75void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
76 struct gk20a_comptags *comptags); 76 struct gk20a_comptags *comptags);
77void gk20a_mark_comptags_cleared(struct nvgpu_os_buffer *buf); 77
78/*
79 * These functions must be used to synchronize comptags clear. The usage:
80 *
81 * if (gk20a_comptags_start_clear(os_buf)) {
82 * // we now hold the buffer lock for clearing
83 *
84 * bool successful = hw_clear_comptags();
85 *
86 * // mark the buf cleared (or not) and release the buffer lock
87 * gk20a_comptags_finish_clear(os_buf, successful);
88 * }
89 *
90 * If gk20a_start_comptags_clear() returns false, another caller has
91 * already cleared the comptags.
92 */
93bool gk20a_comptags_start_clear(struct nvgpu_os_buffer *buf);
94void gk20a_comptags_finish_clear(struct nvgpu_os_buffer *buf,
95 bool clear_successful);
78 96
79#endif 97#endif