drm/msm: Disallow relocs on a6xx+
authorRob Clark <robdclark@chromium.org>
Thu, 3 Aug 2023 18:32:45 +0000 (11:32 -0700)
committerRob Clark <robdclark@chromium.org>
Mon, 7 Aug 2023 21:51:21 +0000 (14:51 -0700)
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/

drivers/gpu/drm/msm/adreno/adreno_gpu.c
drivers/gpu/drm/msm/msm_gem_submit.c
drivers/gpu/drm/msm/msm_gpu.h

index ba35c2a..695cce8 100644 (file)
@@ -1078,6 +1078,8 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
        adreno_gpu->info = config->info;
        adreno_gpu->chip_id = config->chip_id;
 
+       gpu->allow_relocs = config->info->family < ADRENO_6XX_GEN1;
+
        /* Only handle the core clock when GMU is not in use (or is absent). */
        if (adreno_has_gmu_wrapper(adreno_gpu) ||
            adreno_gpu->info->family < ADRENO_6XX_GEN1) {
index 63c9641..3b908f9 100644 (file)
@@ -882,6 +882,16 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
                if (submit->valid)
                        continue;
 
+               if (!gpu->allow_relocs) {
+                       if (submit->cmd[i].nr_relocs) {
+                               DRM_ERROR("relocs not allowed\n");
+                               ret = -EINVAL;
+                               goto out;
+                       }
+
+                       continue;
+               }
+
                ret = submit_reloc(submit, msm_obj, submit->cmd[i].offset * 4,
                                submit->cmd[i].nr_relocs, submit->cmd[i].relocs);
                if (ret)
index 7a4fa1b..4252e38 100644 (file)
@@ -285,6 +285,15 @@ struct msm_gpu {
        /* True if the hardware supports expanded apriv (a650 and newer) */
        bool hw_apriv;
 
+       /**
+        * @allow_relocs: allow relocs in SUBMIT ioctl
+        *
+        * Mesa won't use relocs for driver version 1.4.0 and later.  This
+        * switch-over happened early enough in mesa a6xx bringup that we
+        * can disallow relocs for a6xx and newer.
+        */
+       bool allow_relocs;
+
        struct thermal_cooling_device *cooling;
 };