Skip to content

Commit 42854f8

Browse files
committed
drm/msm: Disallow relocs on a6xx+
Mesa stopped using these pretty early in a6xx bringup[1]. Take advantage of this to disallow some legacy UABI. [1] https://gitlab.freedesktop.org/mesa/mesa/-/commit/7ef722861b691ce99be3827ed05f8c0ddf2cd66e Signed-off-by: Rob Clark <robdclark@chromium.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Patchwork: https://patchwork.freedesktop.org/patch/551175/
1 parent 3136a0f commit 42854f8

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
10781078
adreno_gpu->info = config->info;
10791079
adreno_gpu->chip_id = config->chip_id;
10801080

1081+
gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1;
1082+
10811083
/* Only handle the core clock when GMU is not in use (or is absent). */
10821084
if (adreno_has_gmu_wrapper(adreno_gpu) ||
10831085
adreno_gpu->info->family < ADRENO_6XX_GEN1) {

drivers/gpu/drm/msm/msm_gem_submit.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
882882
if (submit->valid)
883883
continue;
884884

885+
if (!gpu->allow_relocs) {
886+
if (submit->cmd[i].nr_relocs) {
887+
DRM_ERROR("relocs not allowed\n");
888+
ret = -EINVAL;
889+
goto out;
890+
}
891+
892+
continue;
893+
}
894+
885895
ret = submit_reloc(submit, msm_obj, submit->cmd[i].offset * 4,
886896
submit->cmd[i].nr_relocs, submit->cmd[i].relocs);
887897
if (ret)

drivers/gpu/drm/msm/msm_gpu.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ struct msm_gpu {
285285
/* True if the hardware supports expanded apriv (a650 and newer) */
286286
bool hw_apriv;
287287

288+
/**
289+
* @allow_relocs: allow relocs in SUBMIT ioctl
290+
*
291+
* Mesa won't use relocs for driver version 1.4.0 and later. This
292+
* switch-over happened early enough in mesa a6xx bringup that we
293+
* can disallow relocs for a6xx and newer.
294+
*/
295+
bool allow_relocs;
296+
288297
struct thermal_cooling_device *cooling;
289298
};
290299

0 commit comments

Comments
 (0)