Skip to content

Commit 2b520c6

Browse files
cwabbott0Rob Clark
authored andcommitted
drm/msm/a7xx: Call CP_RESET_CONTEXT_STATE
Calling this packet is necessary when we switch contexts because there are various pieces of state used by userspace to synchronize between BR and BV that are persistent across submits and we need to make sure that they are in a "safe" state when switching contexts. Otherwise a userspace submission in one context could cause another context to function incorrectly and hang, effectively a denial of service (although without leaking data). This was missed during initial a7xx bringup. Fixes: af66706 ("drm/msm/a6xx: Add skeleton A7xx support") Signed-off-by: Connor Abbott <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/654924/ Signed-off-by: Rob Clark <[email protected]>
1 parent b1c9e79 commit 2b520c6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu,
130130
OUT_RING(ring, lower_32_bits(rbmemptr(ring, fence)));
131131
OUT_RING(ring, upper_32_bits(rbmemptr(ring, fence)));
132132
OUT_RING(ring, submit->seqno - 1);
133+
134+
OUT_PKT7(ring, CP_THREAD_CONTROL, 1);
135+
OUT_RING(ring, CP_SET_THREAD_BOTH);
136+
137+
/* Reset state used to synchronize BR and BV */
138+
OUT_PKT7(ring, CP_RESET_CONTEXT_STATE, 1);
139+
OUT_RING(ring,
140+
CP_RESET_CONTEXT_STATE_0_CLEAR_ON_CHIP_TS |
141+
CP_RESET_CONTEXT_STATE_0_CLEAR_RESOURCE_TABLE |
142+
CP_RESET_CONTEXT_STATE_0_CLEAR_BV_BR_COUNTER |
143+
CP_RESET_CONTEXT_STATE_0_RESET_GLOBAL_LOCAL_TS);
144+
145+
OUT_PKT7(ring, CP_THREAD_CONTROL, 1);
146+
OUT_RING(ring, CP_SET_THREAD_BR);
133147
}
134148

135149
if (!sysprof) {

0 commit comments

Comments
 (0)