Commit b6d6223f authored by Lucas Stach's avatar Lucas Stach

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: default avatarLucas Stach <l.stach@pengutronix.de>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 40c27bde
...@@ -100,6 +100,8 @@ static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu, ...@@ -100,6 +100,8 @@ static void etnaviv_cmd_select_pipe(struct etnaviv_gpu *gpu,
{ {
u32 flush = 0; u32 flush = 0;
lockdep_assert_held(&gpu->lock);
/* /*
* This assumes that if we're switching to 2D, we're switching * This assumes that if we're switching to 2D, we're switching
* away from 3D, and vice versa. Hence, if we're switching to * 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,6 +168,8 @@ u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu)
{ {
struct etnaviv_cmdbuf *buffer = gpu->buffer; struct etnaviv_cmdbuf *buffer = gpu->buffer;
lockdep_assert_held(&gpu->lock);
/* initialize buffer */ /* initialize buffer */
buffer->user_size = 0; buffer->user_size = 0;
...@@ -180,6 +184,8 @@ u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe ...@@ -180,6 +184,8 @@ u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe
{ {
struct etnaviv_cmdbuf *buffer = gpu->buffer; struct etnaviv_cmdbuf *buffer = gpu->buffer;
lockdep_assert_held(&gpu->lock);
buffer->user_size = 0; buffer->user_size = 0;
if (gpu->identity.features & chipFeatures_PIPE_3D) { if (gpu->identity.features & chipFeatures_PIPE_3D) {
...@@ -215,6 +221,8 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu) ...@@ -215,6 +221,8 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
unsigned int waitlink_offset = buffer->user_size - 16; unsigned int waitlink_offset = buffer->user_size - 16;
u32 link_target, flush = 0; u32 link_target, flush = 0;
lockdep_assert_held(&gpu->lock);
if (gpu->exec_state == ETNA_PIPE_2D) if (gpu->exec_state == ETNA_PIPE_2D)
flush = VIVS_GL_FLUSH_CACHE_PE2D; flush = VIVS_GL_FLUSH_CACHE_PE2D;
else if (gpu->exec_state == ETNA_PIPE_3D) 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,6 +265,8 @@ void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
unsigned int waitlink_offset = buffer->user_size - 16; unsigned int waitlink_offset = buffer->user_size - 16;
u32 dwords, target; u32 dwords, target;
lockdep_assert_held(&gpu->lock);
/* /*
* We need at most 3 dwords in the return target: * We need at most 3 dwords in the return target:
* 1 event + 1 end + 1 wait + 1 link. * 1 event + 1 end + 1 wait + 1 link.
...@@ -296,6 +306,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, ...@@ -296,6 +306,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event,
u32 link_target, link_dwords; u32 link_target, link_dwords;
bool switch_context = gpu->exec_state != cmdbuf->exec_state; bool switch_context = gpu->exec_state != cmdbuf->exec_state;
lockdep_assert_held(&gpu->lock);
if (drm_debug & DRM_UT_DRIVER) if (drm_debug & DRM_UT_DRIVER)
etnaviv_buffer_dump(gpu, buffer, 0, 0x50); etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment