Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/a6xx: Add a flag to allow preemption to submitqueue_create

Some userspace changes are necessary so add a flag for userspace to
advertise support for preemption when creating the submitqueue.

When this flag is not set preemption will not be allowed in the middle
of the submitted IBs therefore mantaining compatibility with older
userspace.

The flag is rejected if preemption is not supported on the target, this
allows userspace to know whether preemption is supported.

Tested-by: Rob Clark <robdclark@gmail.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8450-HDK
Signed-off-by: Antonino Maniscalco <antomani103@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/618028/
Signed-off-by: Rob Clark <robdclark@chromium.org>

authored by

Antonino Maniscalco and committed by
Rob Clark
7788d320 35d36dc1

+15 -5
+8 -4
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 352 352 OUT_PKT7(ring, CP_SET_MARKER, 1); 353 353 OUT_RING(ring, 0x101); /* IFPC disable */ 354 354 355 - OUT_PKT7(ring, CP_SET_MARKER, 1); 356 - OUT_RING(ring, 0x00d); /* IB1LIST start */ 355 + if (submit->queue->flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT) { 356 + OUT_PKT7(ring, CP_SET_MARKER, 1); 357 + OUT_RING(ring, 0x00d); /* IB1LIST start */ 358 + } 357 359 358 360 /* Submit the commands */ 359 361 for (i = 0; i < submit->nr_cmds; i++) { ··· 386 384 update_shadow_rptr(gpu, ring); 387 385 } 388 386 389 - OUT_PKT7(ring, CP_SET_MARKER, 1); 390 - OUT_RING(ring, 0x00e); /* IB1LIST end */ 387 + if (submit->queue->flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT) { 388 + OUT_PKT7(ring, CP_SET_MARKER, 1); 389 + OUT_RING(ring, 0x00e); /* IB1LIST end */ 390 + } 391 391 392 392 get_stats_counter(ring, REG_A7XX_RBBM_PERFCTR_CP(0), 393 393 rbmemptr_stats(ring, index, cpcycles_end));
+3
drivers/gpu/drm/msm/msm_submitqueue.c
··· 170 170 if (!priv->gpu) 171 171 return -ENODEV; 172 172 173 + if (flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT && priv->gpu->nr_rings == 1) 174 + return -EINVAL; 175 + 173 176 ret = msm_gpu_convert_priority(priv->gpu, prio, &ring_nr, &sched_prio); 174 177 if (ret) 175 178 return ret;
+4 -1
include/uapi/drm/msm_drm.h
··· 347 347 * backwards compatibility as a "default" submitqueue 348 348 */ 349 349 350 - #define MSM_SUBMITQUEUE_FLAGS (0) 350 + #define MSM_SUBMITQUEUE_ALLOW_PREEMPT 0x00000001 351 + #define MSM_SUBMITQUEUE_FLAGS ( \ 352 + MSM_SUBMITQUEUE_ALLOW_PREEMPT | \ 353 + 0) 351 354 352 355 /* 353 356 * The submitqueue priority should be between 0 and MSM_PARAM_PRIORITIES-1,