aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-11-17 11:51:19 -0500
committerLucas Stach <l.stach@pengutronix.de>2018-01-02 11:25:44 -0500
commitb6d6223f5029d3c4fe466ce1711fe4cb23d06013 (patch)
treeecc8f42b128666892000619a2a0a5b498b821df2
parent40c27bdeb00ba234d5062b7c51467a9a51c4606c (diff)
drm/etnaviv: add lockdep annotations to buffer manipulation functions
When manipulating the kernel command buffer the GPU mutex must be held, as otherwise different callers might try to replace the same part of the buffer, wreacking havok in the GPU execution. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_buffer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
index 6ad8972a59cc..b0e046d8ad2d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -100,6 +100,8 @@ static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu,
100{ 100{
101 u32 flush = 0; 101 u32 flush = 0;
102 102
103 lockdep_assert_held(&gpu->lock);
104
103 /* 105 /*
104 * This assumes that if we're switching to 2D, we're switching 106 * This assumes that if we're switching to 2D, we're switching
105 * away from 3D, and vice versa. Hence, if we're switching to 107 * away from 3D, and vice versa. Hence, if we're switching to
@@ -166,6 +168,8 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
166{ 168{
167 struct etnaviv_cmdbuf *buffer = gpu->buffer; 169 struct etnaviv_cmdbuf *buffer = gpu->buffer;
168 170
171 lockdep_assert_held(&gpu->lock);
172
169 /* initialize buffer */ 173 /* initialize buffer */
170 buffer->user_size = 0; 174 buffer->user_size = 0;
171 175
@@ -180,6 +184,8 @@ u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe
180{ 184{
181 struct etnaviv_cmdbuf *buffer = gpu->buffer; 185 struct etnaviv_cmdbuf *buffer = gpu->buffer;
182 186
187 lockdep_assert_held(&gpu->lock);
188
183 buffer->user_size = 0; 189 buffer->user_size = 0;
184 190
185 if (gpu->identity.features & chipFeatures_PIPE_3D) { 191 if (gpu->identity.features & chipFeatures_PIPE_3D) {
@@ -215,6 +221,8 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
215 unsigned int waitlink_offset = buffer->user_size - 16; 221 unsigned int waitlink_offset = buffer->user_size - 16;
216 u32 link_target, flush = 0; 222 u32 link_target, flush = 0;
217 223
224 lockdep_assert_held(&gpu->lock);
225
218 if (gpu->exec_state == ETNA_PIPE_2D) 226 if (gpu->exec_state == ETNA_PIPE_2D)
219 flush = VIVS_GL_FLUSH_CACHE_PE2D; 227 flush = VIVS_GL_FLUSH_CACHE_PE2D;
220 else if (gpu->exec_state == ETNA_PIPE_3D) 228 else if (gpu->exec_state == ETNA_PIPE_3D)
@@ -257,6 +265,8 @@ void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
257 unsigned int waitlink_offset = buffer->user_size - 16; 265 unsigned int waitlink_offset = buffer->user_size - 16;
258 u32 dwords, target; 266 u32 dwords, target;
259 267
268 lockdep_assert_held(&gpu->lock);
269
260 /* 270 /*
261 * We need at most 3 dwords in the return target: 271 * We need at most 3 dwords in the return target:
262 * 1 event + 1 end + 1 wait + 1 link. 272 * 1 event + 1 end + 1 wait + 1 link.
@@ -296,6 +306,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
296 u32 link_target, link_dwords; 306 u32 link_target, link_dwords;
297 bool switch_context = gpu->exec_state != cmdbuf->exec_state; 307 bool switch_context = gpu->exec_state != cmdbuf->exec_state;
298 308
309 lockdep_assert_held(&gpu->lock);
310
299 if (drm_debug & DRM_UT_DRIVER) 311 if (drm_debug & DRM_UT_DRIVER)
300 etnaviv_buffer_dump(gpu, buffer, 0, 0x50); 312 etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
301 313